启动 named: [确定]
查看生成的文件:
[root@cp2 ~]# ls /var/named/slaves/
123.com.zone 147.168.192.zone
查看123.com.zone内容(可以看到在主DNS上的配置被同步到从DNS上):
[root@cp2 ~]# cat /var/named/slaves/123.com.zone
$ORIGIN .
$TTL 86400 ; 1 day
123.com IN SOA 123.com. admin.123.com. (
2015010901 ; 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.134.129
ns A 192.168.134.128
www A 11.11.11.11
测试从DNS解析:
[root@cp2 ~]# dig @192.168.147.138
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.138
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38327
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
; IN A
;; ANSWER SECTION:
86400 IN A 11.11.11.11
;; AUTHORITY SECTION:
123.com. 86400 IN NS ns.123.com.
;; ADDITIONAL SECTION:
ns.123.com. 86400 IN A 192.168.134.128
;; Query time: 1 msec
;; SERVER: 192.168.147.138#53(192.168.147.138)
;; WHEN: Tue Mar 14 00:34:43 2017
;; MSG SIZE rcvd: 78
测试从DNSbbs:
[root@cp2 ~]# dig @192.168.147.138 bbs.123.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.138 bbs.123.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36960
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;bbs.123.com. IN A
;; ANSWER SECTION:
bbs.123.com. 86400 IN CNAME
86400 IN A 11.11.11.11
;; AUTHORITY SECTION:
123.com. 86400 IN NS ns.123.com.
;; ADDITIONAL SECTION:
ns.123.com. 86400 IN A 192.168.134.128
;; Query time: 0 msec
;; SERVER: 192.168.147.138#53(192.168.147.138)
;; WHEN: Tue Mar 14 00:46:35 2017
;; MSG SIZE rcvd: 96
测试反解析:
[root@cp2 ~]# dig @192.168.147.138 -x 192.168.147.137
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.138 -x 192.168.147.137
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5809
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;137.147.168.192.in-addr.arpa. IN PTR
;; ANSWER SECTION:
137.147.168.192.in-addr.arpa. 86400 IN PTR ns.123.com.
;; AUTHORITY SECTION:
147.168.192.in-addr.arpa. 86400 IN NS ns.123.com.
;; ADDITIONAL SECTION:
ns.123.com. 86400 IN A 192.168.134.128
;; Query time: 0 msec
;; SERVER: 192.168.147.138#53(192.168.147.138)
;; WHEN: Tue Mar 14 00:48:28 2017
;; MSG SIZE rcvd: 100
测试结果发现,从DNS服务器正常工作。
在主上增加一条记录:
[root@cp1 ~]# vim /var/named/123.com.zone
$TTL 1D
@ IN SOA @ admin.123.com. (
2015010902 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns.123.com.
IN MX 5 mail.123.com.
mail IN A 192.168.147.137
ns IN A 192.168.147.138
www IN A 11.11.11.11
bbs IN CNAME www
test IN A 111.111.111.111
重启:
[root@cp1 ~]# /etc/init.d/named restart