DNS详解及DNS主从配置(7)

启动 named:                                               [确定]

测试解析新加入的记录 test.123.com:

[root@cp1 ~]# dig @192.168.147.137 test.123.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.137 test.123.com

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2695

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;test.123.com.                  IN      A

;; ANSWER SECTION:

test.123.com.           86400   IN      A       111.111.111.111

;; AUTHORITY SECTION:

123.com.                86400   IN      NS      ns.123.com.

;; ADDITIONAL SECTION:

ns.123.com.             86400   IN      A       192.168.147.138

;; Query time: 0 msec

;; SERVER: 192.168.147.137#53(192.168.147.137)

;; WHEN: Tue Mar 14 00:53:47 2017

;; MSG SIZE  rcvd: 79

1天刷新一次不方便测试,我们想只要主发生更改,从立即跟着更改:

在主上编辑配置文件:加入向从发送通知的配置

zone "123.com" IN {

type master;

file "123.com.zone";

notify yes;

also-notify { 192.168.147.138; };

};

zone "147.168.192.in-addr.arpa" IN {

type master;

file "147.168.192.zone";

notify yes;

also-notify { 192.168.147.138; };

};

检查配置:

[root@cp1 ~]# named-checkconf

重启:[root@cp1 ~]# /etc/init.d/named restart

停止 named:.                                              [确定]

启动 named:                                               [确定]

在从上测试:

发现从DNS上配置文件123.com.zone也自动更新:

[root@cp2 ~]# cat /var/named/slaves/123.com.zone

$ORIGIN .

$TTL 86400      ; 1 day

123.com                 IN SOA  123.com. admin.123.com. (

2015010902 ; serial

86400      ; refresh (1 day)

3600       ; retry (1 hour)

604800     ; expire (1 week)

10800      ; minimum (3 hours)

)

NS      ns.123.com.

MX      5 mail.123.com.

$ORIGIN 123.com.

bbs                     CNAME   www

mail                    A       192.168.147.137

ns                      A       192.168.147.138

test                    A       111.111.111.111

www                     A       11.11.11.11

测试解析 test.123.com:

[root@cp2 ~]# dig @192.168.147.138 test.123.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.138 test.123.com

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57454

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;test.123.com.                  IN      A

;; ANSWER SECTION:

test.123.com.           86400   IN      A       111.111.111.111

;; AUTHORITY SECTION:

123.com.                86400   IN      NS      ns.123.com.

;; ADDITIONAL SECTION:

ns.123.com.             86400   IN      A       192.168.147.138

;; Query time: 0 msec

;; SERVER: 192.168.147.138#53(192.168.147.138)

;; WHEN: Tue Mar 14 00:58:05 2017

;; MSG SIZE  rcvd: 79

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

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