反向解析哪个ip地址段到名字
每个网段要建立一个反向区域
1.创建方向区域
cat /etc/named.rfc1912.zones
zone "0.0.10.in-addr.arpa" {
type master;
file "10.0.0.zone";
};
2.创建方向数据库文件
/var/named/10.0.0.zone
$TTL 1D
@ IN SOA dns1.cnpc.com. dnsadmin.john.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @#@表示继承dns1.cnpc.com
A 127.0.0.1
201 PTR ndsserver.a.com.
3.linux测试
点击查看代码
[root@centos7 named]#dig -x 10.0.0.100 @10.0.0.10
; <<>> DiG 9.11.4-P2-RedHat-9.11.4-26.P2.el7_9.7 <<>> -x 10.0.0.100 @10.0.0.10
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 32286
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;100.0.0.10.in-addr.arpa. IN PTR
;; AUTHORITY SECTION:
#0.0.10.in-addr.arpa. 10800 IN SOA dns1.cnpc.com. admin.a.com. 0 86400 3600 604800 10800
;; Query time: 0 msec
;; SERVER: 10.0.0.10#53(10.0.0.10)
;; WHEN: Sun Nov 28 07:57:10 CST 2021
;; MSG SIZE rcvd: 109
4.windwos测试
C:\Users\Administrator>nslookup
默认服务器: UnKnown
Address: 10.0.0.10
> exit
C:\Users\Administrator>nslookup
#默认服务器: ndsserver.a.com
Address: 10.0.0.10