linux+bind9.4.1 配置主备dns同步

bind9.4.1下载地址:http://ftp.isc.org/isc/bind9/9.4.1/bind-9.4.1.tar.gz

下载bind-9.4.1.tar.gz 放到/usr/local/src/目录下

# tar zxvf bind-9.4.1.tar.gz

# cd bind-9.4.1

# ./configure --prefix=/usr/local/named --enable-threads

# make

# make install

# cd /usr/local/named/etc

建立主dns IP:1.2.3.4 域名:ns1.XXX.com

# ../sbin/rndc-confgen

copy下面注释的部分代码,并去掉注释,修改rndc-key为ns1,有两处啊。。。再把代码加入named.conf

# key "rndc-key" {
# algorithm hmac-md5;
# secret "XXXXXXXXXXXXXXXXXXXXXXX";
# };
#
# controls {
# inet 127.0.0.1 port 953
# allow { 127.0.0.1; } keys { "rndc-key"; };
# };



建立named.conf

例子:

# vi named.conf

options {
directory "/usr/local/named/etc/";
};

logging {
category lame-servers { null; };
};

key "ns1" {
algorithm hmac-md5;
secret "XXXXXXXXXXXXXXXXXXXXXXX";
};

controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "ns1"; };
};
zone "." IN {
type hint;
file "named.ca";
};

zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
zone "XXX.com" IN {
type master;
file "db.XXX.com";
};
zone "3.2.1.in-addr.arpa" IN {
type master;
file "named.rev";
};