0

dig命令


dig是linux下一个很强大的工具,能看域名解析,反解析,A记录,等等的信息,跟windows的nslookup相似,但是功能远远的超过nslookup。

使用方法 dig 域名

debian:~# dig google.com

; <<>> DiG 9.3.4-P1.1 <<>> google.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 368
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;google.com. IN A

;; ANSWER SECTION:
google.com. 215 IN A 72.14.207.99
google.com. 215 IN A 209.85.171.99
google.com. 215 IN A 64.233.187.99

;; AUTHORITY SECTION:
google.com. 61378 IN NS ns2.google.com.
google.com. 61378 IN NS ns3.google.com.
google.com. 61378 IN NS ns1.google.com.
google.com. 61378 IN NS ns4.google.com.

;; ADDITIONAL SECTION:
ns1.google.com. 61379 IN A 216.239.32.10
ns2.google.com. 61378 IN A 216.239.34.10
ns3.google.com. 61378 IN A 216.239.36.10
ns4.google.com. 61378 IN A 216.239.38.10

;; Query time: 120 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Thu Oct 9 05:13:14 2008
;; MSG SIZE rcvd: 212

 

 

查询反响解析

ping一下google.com 得到

debian:~# ping www.google.com
PING www-china.l.google.com (64.233.189.147) 56(84) bytes of data.

dig一下google.com

debian:~#  dig -x 64.233.189.147 +trace

; <<>> DiG 9.3.4 <<>> -x 64.233.189.147 +trace
;; global options: printcmd
. 289511 IN NS C.ROOT-SERVERS.NET.
. 289511 IN NS I.ROOT-SERVERS.NET.
. 289511 IN NS G.ROOT-SERVERS.NET.
. 289511 IN NS E.ROOT-SERVERS.NET.
. 289511 IN NS K.ROOT-SERVERS.NET.
. 289511 IN NS F.ROOT-SERVERS.NET.
. 289511 IN NS M.ROOT-SERVERS.NET.
. 289511 IN NS L.ROOT-SERVERS.NET.
. 289511 IN NS H.ROOT-SERVERS.NET.
. 289511 IN NS J.ROOT-SERVERS.NET.
. 289511 IN NS A.ROOT-SERVERS.NET.
. 289511 IN NS D.ROOT-SERVERS.NET.
. 289511 IN NS B.ROOT-SERVERS.NET.
;; Received 500 bytes from 218.104.128.106#53(218.104.128.106) in 3 ms

64.in-addr.arpa. 86400 IN NS CHIA.ARIN.NET.
64.in-addr.arpa. 86400 IN NS HENNA.ARIN.NET.
64.in-addr.arpa. 86400 IN NS INDIGO.ARIN.NET.
64.in-addr.arpa. 86400 IN NS DILL.ARIN.NET.
64.in-addr.arpa. 86400 IN NS Z.ARIN.NET.
64.in-addr.arpa. 86400 IN NS EPAZOTE.ARIN.NET.
64.in-addr.arpa. 86400 IN NS Y.ARIN.NET.
64.in-addr.arpa. 86400 IN NS BASIL.ARIN.NET.
;; Received 206 bytes from 192.33.4.12#53(C.ROOT-SERVERS.NET) in 202 ms

189.233.64.in-addr.arpa. 86400 IN NS ns1.google.com.
189.233.64.in-addr.arpa. 86400 IN NS ns2.google.com.
189.233.64.in-addr.arpa. 86400 IN NS ns3.google.com.
189.233.64.in-addr.arpa. 86400 IN NS ns4.google.com.
;; Received 127 bytes from 192.5.6.32#53(CHIA.ARIN.NET) in 337 ms

147.189.233.64.in-addr.arpa. 86400 IN PTR hk-in-f147.google.com.
189.233.64.in-addr.arpa. 86400 IN NS ns2.google.com.
189.233.64.in-addr.arpa. 86400 IN NS ns1.google.com.
189.233.64.in-addr.arpa. 86400 IN NS ns3.google.com.
189.233.64.in-addr.arpa. 86400 IN NS ns4.google.com.
;; Received 216 bytes from 216.239.32.10#53(ns1.google.com) in 66 ms
 

ns1-4就是负责解析这个IP的dns服务器

 

查看google的授权DNS服务器

debian:~# dig google.com +nssearch
SOA ns1.google.com. dns-admin.google.com. 2008101403 7200 1800 1209600 300 from server ns1.google.com in 66 ms.
SOA ns1.google.com. dns-admin.google.com. 2008101403 7200 1800 1209600 300 from server ns4.google.com in 328 ms.
SOA ns1.google.com. dns-admin.google.com. 2008101403 7200 1800 1209600 300 from server ns2.google.com in 336 ms.
SOA ns1.google.com. dns-admin.google.com. 2008101403 7200 1800 1209600 300 from server ns3.google.com in 322 ms.

 

再看看解析google.com的全过程

debian:~# dig google.com +trace
; <<>> DiG 9.3.4 <<>> google.com +trace
;; global options: printcmd
. 289232 IN NS E.ROOT-SERVERS.NET.
. 289232 IN NS M.ROOT-SERVERS.NET.
. 289232 IN NS D.ROOT-SERVERS.NET.
. 289232 IN NS C.ROOT-SERVERS.NET.
. 289232 IN NS L.ROOT-SERVERS.NET.
. 289232 IN NS B.ROOT-SERVERS.NET.
. 289232 IN NS H.ROOT-SERVERS.NET.
. 289232 IN NS A.ROOT-SERVERS.NET.
. 289232 IN NS G.ROOT-SERVERS.NET.
. 289232 IN NS J.ROOT-SERVERS.NET.
. 289232 IN NS K.ROOT-SERVERS.NET.
. 289232 IN NS F.ROOT-SERVERS.NET.
. 289232 IN NS I.ROOT-SERVERS.NET.
;; Received 500 bytes from 218.104.128.106#53(218.104.128.106) in 3 ms

com. 172800 IN NS C.GTLD-SERVERS.NET.
com. 172800 IN NS M.GTLD-SERVERS.NET.
com. 172800 IN NS A.GTLD-SERVERS.NET.
com. 172800 IN NS D.GTLD-SERVERS.NET.
com. 172800 IN NS F.GTLD-SERVERS.NET.
com. 172800 IN NS L.GTLD-SERVERS.NET.
com. 172800 IN NS K.GTLD-SERVERS.NET.
com. 172800 IN NS G.GTLD-SERVERS.NET.
com. 172800 IN NS B.GTLD-SERVERS.NET.
com. 172800 IN NS H.GTLD-SERVERS.NET.
com. 172800 IN NS E.GTLD-SERVERS.NET.
com. 172800 IN NS I.GTLD-SERVERS.NET.
com. 172800 IN NS J.GTLD-SERVERS.NET.
;; Received 500 bytes from 192.203.230.10#53(E.ROOT-SERVERS.NET) in 199 ms

google.com. 172800 IN NS ns1.google.com.
google.com. 172800 IN NS ns2.google.com.
google.com. 172800 IN NS ns3.google.com.
google.com. 172800 IN NS ns4.google.com.
;; Received 164 bytes from 192.26.92.30#53(C.GTLD-SERVERS.NET) in 286 ms

google.com. 300 IN A 64.233.187.99
google.com. 300 IN A 209.85.171.99
google.com. 300 IN A 72.14.207.99
google.com. 345600 IN NS ns2.google.com.
google.com. 345600 IN NS ns3.google.com.
google.com. 345600 IN NS ns4.google.com.
google.com. 345600 IN NS ns1.google.com.
;; Received 212 bytes from 216.239.32.10#53(ns1.google.com) in 66 ms

 

 

咋样,很好很强大吧~

我猜~这些文章你可能也感兴趣

暂时没有留言..

给我留言:

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word