正向解析
- 安装bind软件
[root@localhost ~]
- 修改主配置文件
/etc/named.conf
[root@localhost ~]
- 重启DNS服务(named)
[root@localhost ~]
- 编辑数据配置文件。在
/var/named
目录下
[root@localhost ~]
[root@localhost named]
- 重启
named
服务
[root@localhost named]
- 测试
反向解析
- 修改主配置文件
[root@localhost named]
- 编辑数据文件
[root@localhost named]
- 重启named服务
[root@localhost named]
- 测试
[root@localhost named]; <<>> DiG 9.16.23-RH <<>> -x A www.haha.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 32215
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 7dc28dc4d6837c6601000000668942625655cf5e92891c05 (good)
;; QUESTION SECTION:
;A.in-addr.arpa. IN PTR;; AUTHORITY SECTION:
in-addr.arpa. 3600 IN SOA b.in-addr-servers.arpa. nstld.iana.org. 2022094448 1800 900 604800 3600;; Query time: 862 msec
;; SERVER: 192.168.209.136
;; WHEN: Sat Jul 06 21:10:58 CST 2024
;; MSG SIZE rcvd: 143;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20119
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 7dc28dc4d6837c6601000000668942625655cf5e92891c05 (good)
;; QUESTION SECTION:
;www.haha.com. IN A;; ANSWER SECTION:
www.haha.com. 86400 IN A 192.168.209.140;; Query time: 1 msec
;; SERVER: 192.168.209.136
;; WHEN: Sat Jul 06 21:10:58 CST 2024
;; MSG SIZE rcvd: 85[root@localhost named]; <<>> DiG 9.16.23-RH <<>> -x A 192.168.209.136
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 46539
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 7baf9331949152f2010000006689428e6f53054233542489 (good)
;; QUESTION SECTION:
;A.in-addr.arpa. IN PTR;; AUTHORITY SECTION:
in-addr.arpa. 3556 IN SOA b.in-addr-servers.arpa. nstld.iana.org. 2022094448 1800 900 604800 3600;; Query time: 1 msec
;; SERVER: 192.168.209.136
;; WHEN: Sat Jul 06 21:11:42 CST 2024
;; MSG SIZE rcvd: 143;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 8491
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 7baf9331949152f2010000006689429498a1106a679dcba1 (good)
;; QUESTION SECTION:
;192.168.209.136. IN A;; AUTHORITY SECTION:
. 10800 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2024070600 1800 900 604800 86400;; Query time: 988 msec
;; SERVER: 192.168.209.136
;; WHEN: Sat Jul 06 21:11:48 CST 2024
;; MSG SIZE rcvd: 147