环境同正向解析一样。
切换到/var/named/chroot/etc目录下:
编辑named.rfc1912.zones文件,在末尾添加如下内容:
[root@sishen63 etc]# vim named.rfc1912.zones
创建反向解析配置文件
[root@sishen63 named]# cp -p sishen63.cn.zone sishen63.cn.rev
编辑sishen63.cn.rev文件:
[root@sishen63 named]# vim sishen63.cn.rev
检查配置文件:
重启named服务:
测试并查看:
[root@sishen63 named]# dig -x 192.168.1.123 @localhost #因为默认是正向解析,故需加-x参数
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> -x 192.168.1.123 @localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23643
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;123.1.168.192.in-addr.arpa. IN PTR
;; ANSWER SECTION:
123.1.168.192.in-addr.arpa. 86400 IN PTR abc.sishen63.cn.
;; AUTHORITY SECTION:
1.168.192.in-addr.arpa. 86400 IN NS dns.sishen63.cn.
;; ADDITIONAL SECTION:
dns.sishen63.cn. 86400 IN A 192.168.1.63
;; Query time: 0 msec
;; SERVER: ::1#53(::1)
;; WHEN: Sat Jan 20 15:12:42 2018
;; MSG SIZE rcvd: 107
解析成功~
[root@sishen63 named]# dig -x 192.168.1.234 @localhost
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> -x 192.168.1.234 @localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63020
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;234.1.168.192.in-addr.arpa. IN PTR
;; ANSWER SECTION:
234.1.168.192.in-addr.arpa. 86400 IN PTR def.sishen63.cn.
;; AUTHORITY SECTION:
1.168.192.in-addr.arpa. 86400 IN NS dns.sishen63.cn.
;; ADDITIONAL SECTION:
dns.sishen63.cn. 86400 IN A 192.168.1.63
;; Query time: 0 msec
;; SERVER: ::1#53(::1)
;; WHEN: Sat Jan 20 15:14:27 2018
;; MSG SIZE rcvd: 107
解析成功~