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

启动bind

# /usr/local/named/sbin/named -gc /usr/local/named/etc/named.conf

建立备dns IP:5.6.7.8 域名:ns2.XXX.com

# ../sbin/rndc-confgen

copy下面注释的部分代码,并去掉注释,修改rndc-key为ns2,有两处啊。。。再把代码加入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 "ns2" {
algorithm hmac-md5;
secret "XXXXXXXXXXXXXXXXXXXXXXX";
};

controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "ns2"; };
};
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 s;
file "db.XXX.com";
masters { 1.2.3.4; };
};
zone "3.2.1.in-addr.arpa" IN {
type master;
file "named.rev";
masters {1.2.3.4; };
};

建立named.ca,localhost.zone,named.local文件,内容全部同主dns一样

# dig > named.ca

# vi localhost.zone

# vi named.local

启动备dns,这时个从主dns自动同步主DNS的内容。自动在你定义的工作目录内生成数据文件

# /usr/local/named/sbin/named -gc /usr/local/named/etc/named.conf &

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwyppx.html