从服务器上IP为192.168.10.109
1.配置主从
先在第二台服务器上安装bind
[root@localhost ~]# yum -y install bind
配置主配置文件
[root@localhost ~]# vim /etc/named.conf
注释监听的两行,目的是为了监听所有IP网段
options {
// listen-on port 53 { 127.0.0.1; };
// listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
在最后添加两段:
zone "jqm.com" IN {
type slave;
file "slaves/jqm.com.zone";
masters { 192.168.10.105; };
};
zone "10.168.192.in-addr.arpa" IN {
type slave;
file "slaves/10.168.192.zone";
masters { 192.168.10.105; };
};
重启服务
service named restart
注意:以上配置中file一行中添加了slaves,其根目录为:/var/named/slaves
配置的内容都在这目录中,可以进目录中查看是否有jqm.com.zone和10.168.192.zone
测试:正向解析是否正常
dig @192.168.10.109 mail.jqm.com
显示正常
测试二、反向解析
dig @192.168.10.109 -x 192.168.10.105
显示正常
2.当在主服务器上添加一个新的域名时测试从服务器上是否可以同步
[root@localhost ~]# vim /var/named/jqm.com.zone
修改serial的值2016071001修改为2016071002在最后添加一条记录
@ IN SOA @ admin.jqm.com. (
2016071002 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns1.jqm.com.
IN MX 5 mail.jqm.com.
mail IN A 192.168.10.102
ns1 IN A 192.168.10.105
www IN A 192.168.10.103
bbs IN CNAME www.jqm.com.
添加:
aming IN A 111.111.111.111
重启服务
[root@localhost ~]# service named restart
在主上测试:
[root@localhost ~]# dig @192.168.10.105 aming.jqm.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6 <<>> @192.168.10.105 aming.jqm.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33774
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;aming.jqm.com. IN A
;; ANSWER SECTION:
aming.jqm.com. 86400 IN A 111.111.111.111
;; AUTHORITY SECTION:
jqm.com. 86400 IN NS ns1.jqm.com.
;; ADDITIONAL SECTION:
ns1.jqm.com. 86400 IN A 192.168.10.105
;; Query time: 5 msec
;; SERVER: 192.168.10.105#53(192.168.10.105)
;; WHEN: Mon Aug 29 12:09:45 2016
;; MSG SIZE rcvd: 81
显示成功
在从服务器上测试
[root@localhost ~]# dig @192.168.10.105 aming.jqm.com
发现不能同步
解决:
因为主和从之间配置了一个时间间隔差
在主服务中的jqm.com.zone中配置了serial的值为2016071002,而从服务器上配置的为修改2016071001,它需要时间去刷新,
而刷新的时间配置为1D ; refresh(1天),时间太久,所以要设置成随时更新,配置如下
在主服务器上的主配置文件中修改
zone "jqm.com" IN {
type master;
file "jqm.com.zone";
添加:
notify yes;
also-notify { 192.168.10.109; };
};
zone "10.168.192.in-addr.arpa" IN {
type master;
file "10.168.192.zone";
添加
notify yes;
also-notify { 192.168.10.109; };
重启服务:
[root@localhost ~]# service named restart
测试:
[root@localhost named]# dig @192.168.10.109 aming.jqm.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6 <<>> @192.168.10.109 aming.jqm.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23767
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;aming.jqm.com. IN A
;; ANSWER SECTION:
aming.jqm.com. 86400 IN A 111.111.111.111
;; AUTHORITY SECTION:
jqm.com. 86400 IN NS ns1.jqm.com.
;; ADDITIONAL SECTION:
ns1.jqm.com. 86400 IN A 192.168.10.105
;; Query time: 2 msec
;; SERVER: 192.168.10.109#53(192.168.10.109)
;; WHEN: Mon Aug 29 12:21:14 2016
;; MSG SIZE rcvd: 81
显示正常(及时更新了)
1.配置主从
先在第二台服务器上安装bind
[root@localhost ~]# yum -y install bind
配置主配置文件
[root@localhost ~]# vim /etc/named.conf
注释监听的两行,目的是为了监听所有IP网段
options {
// listen-on port 53 { 127.0.0.1; };
// listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
在最后添加两段:
zone "jqm.com" IN {
type slave;
file "slaves/jqm.com.zone";
masters { 192.168.10.105; };
};
zone "10.168.192.in-addr.arpa" IN {
type slave;
file "slaves/10.168.192.zone";
masters { 192.168.10.105; };
};
重启服务
service named restart
注意:以上配置中file一行中添加了slaves,其根目录为:/var/named/slaves
配置的内容都在这目录中,可以进目录中查看是否有jqm.com.zone和10.168.192.zone
测试:正向解析是否正常
dig @192.168.10.109 mail.jqm.com
显示正常
测试二、反向解析
dig @192.168.10.109 -x 192.168.10.105
显示正常
2.当在主服务器上添加一个新的域名时测试从服务器上是否可以同步
[root@localhost ~]# vim /var/named/jqm.com.zone
修改serial的值2016071001修改为2016071002在最后添加一条记录
@ IN SOA @ admin.jqm.com. (
2016071002 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns1.jqm.com.
IN MX 5 mail.jqm.com.
mail IN A 192.168.10.102
ns1 IN A 192.168.10.105
www IN A 192.168.10.103
bbs IN CNAME www.jqm.com.
添加:
aming IN A 111.111.111.111
重启服务
[root@localhost ~]# service named restart
在主上测试:
[root@localhost ~]# dig @192.168.10.105 aming.jqm.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6 <<>> @192.168.10.105 aming.jqm.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33774
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;aming.jqm.com. IN A
;; ANSWER SECTION:
aming.jqm.com. 86400 IN A 111.111.111.111
;; AUTHORITY SECTION:
jqm.com. 86400 IN NS ns1.jqm.com.
;; ADDITIONAL SECTION:
ns1.jqm.com. 86400 IN A 192.168.10.105
;; Query time: 5 msec
;; SERVER: 192.168.10.105#53(192.168.10.105)
;; WHEN: Mon Aug 29 12:09:45 2016
;; MSG SIZE rcvd: 81
显示成功
在从服务器上测试
[root@localhost ~]# dig @192.168.10.105 aming.jqm.com
发现不能同步
解决:
因为主和从之间配置了一个时间间隔差
在主服务中的jqm.com.zone中配置了serial的值为2016071002,而从服务器上配置的为修改2016071001,它需要时间去刷新,
而刷新的时间配置为1D ; refresh(1天),时间太久,所以要设置成随时更新,配置如下
在主服务器上的主配置文件中修改
zone "jqm.com" IN {
type master;
file "jqm.com.zone";
添加:
notify yes;
also-notify { 192.168.10.109; };
};
zone "10.168.192.in-addr.arpa" IN {
type master;
file "10.168.192.zone";
添加
notify yes;
also-notify { 192.168.10.109; };
重启服务:
[root@localhost ~]# service named restart
测试:
[root@localhost named]# dig @192.168.10.109 aming.jqm.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6 <<>> @192.168.10.109 aming.jqm.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23767
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;aming.jqm.com. IN A
;; ANSWER SECTION:
aming.jqm.com. 86400 IN A 111.111.111.111
;; AUTHORITY SECTION:
jqm.com. 86400 IN NS ns1.jqm.com.
;; ADDITIONAL SECTION:
ns1.jqm.com. 86400 IN A 192.168.10.105
;; Query time: 2 msec
;; SERVER: 192.168.10.109#53(192.168.10.109)
;; WHEN: Mon Aug 29 12:21:14 2016
;; MSG SIZE rcvd: 81
显示正常(及时更新了)
编辑回复