dig command

指定查询类型

@IP地址,表示制定向某一个DNS服务器地址进行查询

dig -t A baidu.com @192.168.0.1
dig -t NS 163.com
dig -t mx 163.com

使用非递归查询,而不是返回最终结果

dig +norecurse -t A www.baidu.com @dns.baidu.com

追踪解析过程

dig +trace -t A www.baidu.com @223.5.5.5
  • .(根) 返回 .com
  • .com 返回 baidu.com
  • baidu.com 返回 www.baidu.com

命令执行查询过程如下:

dig +trace -t A www.baidu.com @223.5.5.5

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> +trace -t A www.baidu.com @223.5.5.5
;; global options: +cmd
. 151821 IN NS h.root-servers.net.
. 151821 IN NS i.root-servers.net.
. 151821 IN NS e.root-servers.net.
. 151821 IN NS a.root-servers.net.
. 151821 IN NS j.root-servers.net.
. 151821 IN NS g.root-servers.net.
. 151821 IN NS k.root-servers.net.
. 151821 IN NS l.root-servers.net.
. 151821 IN NS f.root-servers.net.
. 151821 IN NS c.root-servers.net.
. 151821 IN NS m.root-servers.net.
. 151821 IN NS d.root-servers.net.
. 151821 IN NS b.root-servers.net.
;; Received 228 bytes from 223.5.5.5#53(223.5.5.5) in 6892 ms

com. 172800 IN NS b.gtld-servers.net.
com. 172800 IN NS m.gtld-servers.net.
com. 172800 IN NS i.gtld-servers.net.
com. 172800 IN NS g.gtld-servers.net.
com. 172800 IN NS k.gtld-servers.net.
com. 172800 IN NS e.gtld-servers.net.
com. 172800 IN NS l.gtld-servers.net.
com. 172800 IN NS a.gtld-servers.net.
com. 172800 IN NS j.gtld-servers.net.
com. 172800 IN NS c.gtld-servers.net.
com. 172800 IN NS d.gtld-servers.net.
com. 172800 IN NS h.gtld-servers.net.
com. 172800 IN NS f.gtld-servers.net.
;; Received 491 bytes from 192.112.36.4#53(192.112.36.4) in 5959 ms

baidu.com. 172800 IN NS dns.baidu.com.
baidu.com. 172800 IN NS ns2.baidu.com.
baidu.com. 172800 IN NS ns3.baidu.com.
baidu.com. 172800 IN NS ns4.baidu.com.
baidu.com. 172800 IN NS ns7.baidu.com.
;; Received 201 bytes from 192.52.178.30#53(192.52.178.30) in 3137 ms

www.baidu.com. 1200 IN CNAME www.a.shifen.com.
a.shifen.com. 1200 IN NS ns3.a.shifen.com.
a.shifen.com. 1200 IN NS ns5.a.shifen.com.
a.shifen.com. 1200 IN NS ns2.a.shifen.com.
a.shifen.com. 1200 IN NS ns1.a.shifen.com.
a.shifen.com. 1200 IN NS ns4.a.shifen.com.
;; Received 228 bytes from 220.181.37.10#53(220.181.37.10) in 3 ms

相关文章: