zone "gfs.com" IN { type slave; masters { 10.0.30.95; }; allow-notify { 10.0.30.95; }; file "slaves/node.conf"; };
zone "30.0.10.in-addr.arpa" IN{ type slave; masters { 10.0.30.95; }; allow-notify { 10.0.30.95; }; file "slaves/node.txt"; };
13、从服务器启动dns服务
1
systemctl start named.service
14、查看/var/named/slaves目录下已经多出了node.*的两个文件
1 2 3 4 5 6
[root@node3 slaves]# pwd /var/named/slaves [root@node3 slaves]# ll total 8 -rw-r--r--. 1 named named 416 Nov 22 16:12 node.conf -rw-r--r--. 1 named named 514 Nov 22 16:12 node.txt
15、测试主从文件能否正常同步,修改主节点node.*配置文件
1 2 3 4 5 6
[root@node4 named]# vim node.conf [root@node4 named]# vim node.txt [root@node4 named]# [root@node4 named]# ll node.* -rw-r-----. 1 named root 265 Nov 22 18:48 node.conf -rw-r-----. 1 named root 272 Nov 22 18:48 node.txt
Nov 22 18:48:55 node3 named[98442]: client 10.0.30.95#52505: received notify for zone 'gfs.com' Nov 22 18:48:55 node3 named[98442]: zone gfs.com/IN: Transfer started. Nov 22 18:48:55 node3 named[98442]: transfer of 'gfs.com/IN' from 10.0.30.95#53: connected using 10.0.30.117#58148 Nov 22 18:48:55 node3 named[98442]: zone gfs.com/IN: transferred serial 3 Nov 22 18:48:55 node3 named[98442]: transfer of 'gfs.com/IN' from 10.0.30.95#53: Transfer completed: 1 messages, 9 records, 252 bytes, 0.008 secs (31500 bytes/sec) Nov 22 18:48:55 node3 named[98442]: zone gfs.com/IN: sending notifies (serial 3) Nov 22 18:48:55 node3 named[98442]: client 10.0.30.95#54023: received notify for zone '30.0.10.in-addr.arpa' Nov 22 18:48:55 node3 named[98442]: zone 30.0.10.in-addr.arpa/IN: Transfer started. Nov 22 18:48:55 node3 named[98442]: transfer of '30.0.10.in-addr.arpa/IN' from 10.0.30.95#53: connected using 10.0.30.117#51530 Nov 22 18:48:55 node3 named[98442]: zone 30.0.10.in-addr.arpa/IN: transferred serial 3 Nov 22 18:48:55 node3 named[98442]: transfer of '30.0.10.in-addr.arpa/IN' from 10.0.30.95#53: Transfer completed: 1 messages, 8 records, 249 bytes, 0.002 secs (124500 bytes/sec) Nov 22 18:48:55 node3 named[98442]: zone 30.0.10.in-addr.arpa/IN: sending notifies (serial 3)
18、查看从节点配置文件信息
1 2 3 4
[root@node3 slaves]# ll total 8 -rw-r--r--. 1 named named 375 Nov 22 18:48 node.conf -rw-r--r--. 1 named named 433 Nov 22 18:48 node.txt
从节点文件已和主节点正常同步
19、客户端测试主节点dns服务器挂掉从节点能否正常使用
1 2 3 4
[root@node2 ~]# more /etc/resolv.conf # Generated by NetworkManager nameserver 10.0.30.95 nameserver 10.0.30.117
[root@node4 named]# systemctl stop named.service [root@node4 named]# systemctl status named.service ● named.service - Berkeley Internet Name Domain (DNS) Loaded: loaded (/usr/lib/systemd/system/named.service; disabled; vendor preset: disabled) Active: inactive (dead)
Nov 22 18:48:55 node4 named[10366]: zone 30.0.10.in-addr.arpa/IN: sending notifies (serial 3) Nov 22 18:48:55 node4 named[10366]: client 10.0.30.117#58148 (gfs.com): transfer of 'gfs.com/IN': AXFR-style IXFR started Nov 22 18:48:55 node4 named[10366]: client 10.0.30.117#58148 (gfs.com): transfer of 'gfs.com/IN': AXFR-style IXFR ended Nov 22 18:48:55 node4 named[10366]: client 10.0.30.117#28664: received notify for zone 'gfs.com' Nov 22 18:48:55 node4 named[10366]: client 10.0.30.117#51530 (30.0.10.in-addr.arpa): transfer of '30.0.10.in-addr.arpa/IN': AXFR-style IXFR started Nov 22 18:48:55 node4 named[10366]: client 10.0.30.117#51530 (30.0.10.in-addr.arpa): transfer of '30.0.10.in-addr.arpa/IN': AXFR-style IXFR ended Nov 22 18:48:56 node4 named[10366]: client 10.0.30.117#41288: received notify for zone '30.0.10.in-addr.arpa' Nov 22 18:59:26 node4 systemd[1]: Stopping Berkeley Internet Name Domain (DNS)... Nov 22 18:59:26 node4 named[10366]: received control channel command 'stop' Nov 22 18:59:26 node4 systemd[1]: Stopped Berkeley Internet Name Domain (DNS).