玄箱X4/サーバー設定/bind

出典: Fukudat.com

Berkeley Internet Name Domain (BIND), Dynamic Domain Name Service (DDNS)

インストール

# apt-get install bind9 host

設定

まず,/etc/bind ディレクトリを bindグループが書き込みできるようにする.

# ls -ld /etc/bind
drwxr-sr-x 2 root bind 4096 Feb 17 14:04 /etc/bind
# chmod g+w /etc/bind
# ls -ld /etc/bind
drwxrwsr-x 2 root bind 4096 Feb 17 14:04 /etc/bind

こうしないとbindというユーザで動いている named (bindのサーバープロセス) がデータベースを更新できないので,Dynamic DNS (DDNS) にならない. このディレクトリにあるファイルも bind group のものにしたほうがよいかも.

/etc/bind/named.conf.options を編集.

options {
        directory "/var/cache/bind";

        // If there is a firewall between you and nameservers you want
        // to talk to, you may need to fix the firewall to allow multiple
        // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

        // If your ISP provided one or more IP addresses for stable
        // nameservers, you probably want to use them as forwarders.
        // Uncomment the following block, and insert the addresses replacing
        // the all-0's placeholder.

        forwarders {
                192.168.0.1;
        };

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
};

ただし,192.168.0.1はブロードバンドルータ.

/etc/bind/named.conf.local を編集.

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

zone "fukudat.com" {
        type master;
        file "/etc/bind/db.fukudat.com";
        allow-update {
                192.168.0.0/24;
                127.0.0.1;
        };
};

zone "0.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/db.0.168.192";
        allow-update {
                192.168.0.0/24;
                127.0.0.1;
        };
};

/etc/bind/named.conf.xxx を編集.(xxxはVPNでつながっているプライベートドメイン)

zone "xxx.com" {
        type forward;
        forwarders { 9.0.4.1; 9.0.5.1; };
};

zone "9.in-addr.arpa" {
        type forward;
        forwarders { 9.0.4.1; 9.0.5.1; };
};

VPNのネームサーバー(上記では9.0.4.1, 9.0.5.1)へのルーティングがあることを確認.なければ永続的な静的ルーティングを参照して作成.

最後にサービスをリスタート.

# /etc/init.d/bind9 restart