2012年5月5日土曜日

BIND9の設定

  1. インストール
  2. apt-get install bind9
  3. 正引きの設定
  4. named.conf.local
    zone "test" {
        type master;
        file "/etc/bind/db.test";
    };
    
    db.test
    $TTL    1D
    @       IN      SOA     dns.test. root.hoge. (
                             20120505       ; Serial
                             604800         ; Refresh
                              86400         ; Retry
                            2419200         ; Expire
                             604800 )       ; Negative Cache TTL
    ;
    @       IN      NS      dns.test.
    main            IN      A               192.168.0.2
    vista           IN      A               192.168.0.3
    dns             IN      A               192.168.0.4
    note            IN      CNAME           dns.test.
    jitaku          IN      A               192.168.0.11
    
  5. 逆引きの設定
  6. named.conf.local
    zone "0.168.192.in-addr.arpa" {
            type master;
            file "/etc/bind/db.testrev";
    };
    
    db.testrev
    $TTL    1D
    @       IN      SOA     dns.test. root.hoge. (
                             20120505       ; Serial
                             604800         ; Refresh
                              86400         ; Retry
                            2419200         ; Expire
                             604800 )       ; Negative Cache TTL
    ;
    @       IN      NS      dns.test.
    ;
    2                       IN      PTR             main.test.
    3                       IN      PTR             vista.test.
    4                       IN      PTR             note.test.
    11                      IN      PTR             jitaku.test.
    
  7. セカンダリDNS設定
  8. セカンダリDNSの設定は以下のようにする これでプライマリからゾーン転送されてくる
    named.conf.local
    zone "hoge.jp" {
        type slave;
        file "/tmp/db.hoge";
        masters { 123.123.123.123; };
    };
    
    ゾーン転送(完全転送:AXFR)をエミュレートするには
    nslookup
    server ns.example.co.jp
    ls example.co.jp
    
    digでも出来る
    dig @ns.example.co.jp example.co.jp axfr
    
    http://www.atmarkit.co.jp/fsecurity/rensai/iprotect01/iprotect01.html
  9. その他Tips
  10. フォワーダ設定
    named.conf.options
    forwarders {
        210.130.1.1;
        210.130.0.1;
        8.8.8.8;
        8.8.4.4;
    };
    
    chacheファイルの在り処
    /var/cache/bind/named_dump.db
    
    chacheのクリア
    rndc flush
    
    時間は秒数以外も指定できる
    W 週
    D 日
    H 時間
    M 分
    
    http://kajuhome.com/tips/tips_04_002.shtml
参考リンク http://www.atmarkit.co.jp/flinux/index/indexfiles/index-linux.html#bind8

0 件のコメント: