一、host追踪地址
1、要显示主机www.test.web的主机地址
# host www.test.web
www.test.web has address 192.168.0.119
2、显示主机地址192.168.0.119的主机地址
#host 192.168.0.119
119.0.168.192.in-addr.arpa domain name pointer mail.test.web.
119.0.168.192.in-addr.arpa domain name pointer ns.test.web.
119.0.168.192.in-addr.arpa domain name pointer www.test.web.
3、显示www.test.web的域的MX地址
#host -n -t mx www.test.web
www.test.web has no MX record
二、nslookup的用法
1、查询A记录
# nslookup www.test.web
Server: 192.168.0.119
Address: 192.168.0.119#53
Name: www.test.web
Address: 192.168.0.119
2、查询PTR记录
#nslookup 192.168.0.119
Server: 192.168.0.119
Address: 192.168.0.119#53
119.0.168.192.in-addr.arpa name = ns.test.web.
119.0.168.192.in-addr.arpa name = www.test.web.
119.0.168.192.in-addr.arpa name = mail.test.web.
3、查询MX记录
#nslookup -type=mx test.web
Server: 192.168.0.119
Address: 192.168.0.119#53
test.web mail exchanger = 10 mail.test.web.
4、查看CNAME记录
# nslookup -type=cname test.web
Server: 192.168.0.119
Address: 192.168.0.119#53
*** Can't find test.web: No answer
5、查询域名服务器
#nslookup -type=ns test.web
Server: 192.168.0.119
Address: 192.168.0.119#53
test.web nameserver = ns.test.web.
三、dig查询地址
1、查询A记录
# dig www.test.web
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.4 <<>> www.test.web
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17668
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;www.test.web. IN A
;; ANSWER SECTION:
www.test.web. 86400 IN A 192.168.0.119
;; AUTHORITY SECTION:
test.web. 86400 IN NS ns.test.web.
;; ADDITIONAL SECTION:
ns.test.web. 86400 IN A 192.168.0.119
;; Query time: 0 msec
;; SERVER: 192.168.0.119#53(192.168.0.119)
;; WHEN: Tue Nov 3 10:11:26 2015
;; MSG SIZE rcvd: 79
2、查询NS记录
#dig www.test.web ns
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.4 <<>> www.test.web ns
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40019
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;www.test.web. IN NS
;; AUTHORITY SECTION:
test.web. 86400 IN SOA ns.test.web. root.test.web.test.web. 42 10800 900 604800 86400
;; Query time: 0 msec
;; SERVER: 192.168.0.119#53(192.168.0.119)
;; WHEN: Tue Nov 3 10:12:48 2015
;; MSG SIZE rcvd: 83
3、查询SOA记录
#dig www.test.web soa
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.4 <<>> www.test.web soa
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37865
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;www.test.web. IN SOA
;; AUTHORITY SECTION:
test.web. 86400 IN SOA ns.test.web. root.test.web.test.web. 42 10800 900 604800 86400
;; Query time: 0 msec
;; SERVER: 192.168.0.119#53(192.168.0.119)
;; WHEN: Tue Nov 3 10:14:14 2015
;; MSG SIZE rcvd: 83
4、查询MX记录
# dig www.test.web mx
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.4 <<>> www.test.web mx
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23287
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;www.test.web. IN MX
;; AUTHORITY SECTION:
test.web. 86400 IN SOA ns.test.web. root.test.web.test.web. 42 10800 900 604800 86400
;; Query time: 0 msec
;; SERVER: 192.168.0.119#53(192.168.0.119)
;; WHEN: Tue Nov 3 10:15:21 2015
;; MSG SIZE rcvd: 83
三、追踪域名的解析过程
#dig www.test.web +trace
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.4 <<>> www.test.web +trace
;; global options: +cmd
. 518085 IN NS g.root-servers.net.
. 518085 IN NS l.root-servers.net.
. 518085 IN NS c.root-servers.net.
. 518085 IN NS e.root-servers.net.
. 518085 IN NS d.root-servers.net.
. 518085 IN NS h.root-servers.net.
. 518085 IN NS k.root-servers.net.
. 518085 IN NS a.root-servers.net.
. 518085 IN NS i.root-servers.net.
. 518085 IN NS f.root-servers.net.
. 518085 IN NS b.root-servers.net.
. 518085 IN NS m.root-servers.net.
. 518085 IN NS j.root-servers.net.
;; Received 508 bytes from 192.168.0.119#53(192.168.0.119) in 9 ms
. 86400 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2015110201 1800 900 604800 86400
;; Received 105 bytes from 198.41.0.4#53(198.41.0.4) in 159 ms