Dig for Windows.

Windows默认环境下并没有预置Unix或类Unix系统内功能强大的DNS查询工具dig,但是我们可以手动添加并使用.
官网链接 http://www.bind9.net/download

Step 1:来到官网,这里我们选择日本镜像节点[国内那个挂了…]下载9.9.8正式版bind包.
ftp://ftp.iij.ad.jp/pub/network/isc/bind9/9.9.8/
根据系统类型选择32或64位版本.
ftp://ftp.iij.ad.jp/pub/network/isc/bind9/9.9.8/BIND9.9.8.x86.zip
ftp://ftp.iij.ad.jp/pub/network/isc/bind9/9.9.8/BIND9.9.8.x64.zip

Step 2:下载完成后解压,如果系统未安装Microsoft Visual C++ 2012 Redistribution运行环境则先根据系统版本运行安装压缩包内的vcredist_x86.exe或vcredist_x64.exe

Step 3:准备完毕后将压缩包内8个dll文件和dig.exe拷贝至路径C:\Windows\System32下.
capt_20160119capt_20160119_1

Step 4:好啦,打开cmd验证一下~

C:\Users\Fox-jimmy>dig -v
DiG 9.9.8

C:\Users\Fox-jimmy>dig

; <<>> DiG 9.9.8 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55587
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;.                              IN      NS

;; ANSWER SECTION:
.                       272847  IN      NS      j.root-servers.net.
.                       272847  IN      NS      h.root-servers.net.
.                       272847  IN      NS      a.root-servers.net.
.                       272847  IN      NS      k.root-servers.net.
.                       272847  IN      NS      f.root-servers.net.
.                       272847  IN      NS      m.root-servers.net.
.                       272847  IN      NS      e.root-servers.net.
.                       272847  IN      NS      g.root-servers.net.
.                       272847  IN      NS      i.root-servers.net.
.                       272847  IN      NS      c.root-servers.net.
.                       272847  IN      NS      b.root-servers.net.
.                       272847  IN      NS      l.root-servers.net.
.                       272847  IN      NS      d.root-servers.net.

;; Query time: 3 msec
;; SERVER: 210.22.84.3#53(210.22.84.3)
;; WHEN: Tue Jan 19 19:13:45 ?D1ú±ê×?ê±?? 2016
;; MSG SIZE  rcvd: 228

帮助信息

C:\Users\Fox-jimmy>dig -h
Usage:  dig [@global-server] [domain] [q-type] [q-class] {q-opt}
            {global-d-opt} host [@local-server] {local-d-opt}
            [ host [@local-server] {local-d-opt} [...]]
Where:  domain    is in the Domain Name System
        q-class  is one of (in,hs,ch,...) [default: in]
        q-type   is one of (a,any,mx,ns,soa,hinfo,axfr,txt,...) [default:a]
                 (Use ixfr=version for type ixfr)
        q-opt    is one of:
                 -4                  (use IPv4 query transport only)
                 -6                  (use IPv6 query transport only)
                 -b address[#port]   (bind to source address/port)
                 -c class            (specify query class)
                 -f filename         (batch mode)
                 -i                  (use IP6.INT for IPv6 reverse lookups)
                 -k keyfile          (specify tsig key file)
                 -m                  (enable memory usage debugging)
                 -p port             (specify port number)
                 -q name             (specify query name)
                 -t type             (specify query type)
                 -x dot-notation     (shortcut for reverse lookups)
                 -y [hmac:]name:key  (specify named base64 tsig key)
        d-opt    is of the form +keyword[=value], where keyword is:
                 +[no]aaonly         (Set AA flag in query (+[no]aaflag))
                 +[no]additional     (Control display of additional section)
                 +[no]adflag         (Set AD flag in query (default on))
                 +[no]all            (Set or clear all display flags)
                 +[no]answer         (Control display of answer section)
                 +[no]authority      (Control display of authority section)
                 +[no]besteffort     (Try to parse even illegal messages)
                 +bufsize=###        (Set EDNS0 Max UDP packet size)
                 +[no]cdflag         (Set checking disabled flag in query)
                 +[no]cl             (Control display of class in records)
                 +[no]cmd            (Control display of command line)
                 +[no]comments       (Control display of comment lines)
                 +[no]defname        (Use search list (+[no]search))
                 +[no]dnssec         (Request DNSSEC records)
                 +domain=###         (Set default domainname)
                 +[no]edns[=###]     (Set EDNS version) [0]
                 +[no]fail           (Don't try next server on SERVFAIL)
                 +[no]identify       (ID responders in short answers)
                 +[no]ignore         (Don't revert to TCP for TC responses.)
                 +[no]keepopen       (Keep the TCP socket open between queries)
                 +[no]multiline      (Print records in an expanded format)
                 +ndots=###          (Set search NDOTS value)
                 +[no]nsid           (Request Name Server ID)
                 +[no]nssearch       (Search all authoritative nameservers)
                 +[no]onesoa         (AXFR prints only one soa record)
                 +[no]qr             (Print question before sending)
                 +[no]question       (Control display of question section)
                 +[no]recurse        (Recursive mode)
                 +retry=###          (Set number of UDP retries) [2]
                 +[no]rrcomments     (Control display of per-record comments)
                 +[no]search         (Set whether to use searchlist)
                 +[no]short          (Display nothing except short
                                      form of answer)
                 +[no]showsearch     (Search with intermediate results)
                 +[no]split=##       (Split hex/base64 fields into chunks)
                 +[no]stats          (Control display of statistics)
                 +[no]tcp            (TCP mode (+[no]vc))
                 +time=###           (Set query timeout) [5]
                 +[no]trace          (Trace delegation down from root [+dnssec])
                 +tries=###          (Set number of UDP attempts) [3]
                 +[no]ttlid          (Control display of ttls in records)
                 +[no]vc             (TCP mode (+[no]tcp))
        global d-opts and servers (before host name) affect all queries.
        local d-opts and servers (after host name) affect only that lookup.
        -h                           (print help and exit)
        -v                           (print version and exit)

常用用法

C:\Users\Fox-jimmy>dig google.com +trace

; <<>> DiG 9.9.8 <<>> google.com +trace
;; global options: +cmd
.                       272487  IN      NS      j.root-servers.net.
.                       272487  IN      NS      b.root-servers.net.
.                       272487  IN      NS      c.root-servers.net.
.                       272487  IN      NS      m.root-servers.net.
.                       272487  IN      NS      k.root-servers.net.
.                       272487  IN      NS      d.root-servers.net.
.                       272487  IN      NS      f.root-servers.net.
.                       272487  IN      NS      e.root-servers.net.
.                       272487  IN      NS      g.root-servers.net.
.                       272487  IN      NS      l.root-servers.net.
.                       272487  IN      NS      h.root-servers.net.
.                       272487  IN      NS      i.root-servers.net.
.                       272487  IN      NS      a.root-servers.net.
;; Received 228 bytes from 210.22.84.3#53(210.22.84.3) in 3 ms

com.                    172800  IN      NS      m.gtld-servers.net.
com.                    172800  IN      NS      l.gtld-servers.net.
com.                    172800  IN      NS      k.gtld-servers.net.
com.                    172800  IN      NS      j.gtld-servers.net.
com.                    172800  IN      NS      i.gtld-servers.net.
com.                    172800  IN      NS      h.gtld-servers.net.
com.                    172800  IN      NS      g.gtld-servers.net.
com.                    172800  IN      NS      f.gtld-servers.net.
com.                    172800  IN      NS      e.gtld-servers.net.
com.                    172800  IN      NS      d.gtld-servers.net.
com.                    172800  IN      NS      c.gtld-servers.net.
com.                    172800  IN      NS      b.gtld-servers.net.
com.                    172800  IN      NS      a.gtld-servers.net.
com.                    86400   IN      DS      30909 8 2 E2D3C916F6DEEAC73294E8268FB5885044A833FC5459588F4A9184CF C41A5766
com.                    86400   IN      RRSIG   DS 8 1 86400 20160129050000 20160119040000 54549 . C0XHAVGkK/BTXEU8abyrZ4ajUitTMC+O4tSf6U1ZE7KUbf5uQeHocaQU KKyVSh2hyj1X0wjYrZOcDozO9qZa//rZ424n/OvMiHuha0M2b2lLMuDR rjDpmygOXaxZC0aCc6M9MFJ/yKjdNfnC/GZMSvjY9w52h6aC4f1FsBwd vWs=
;; Received 734 bytes from 192.58.128.30#53(j.root-servers.net) in 130 ms

google.com.             172800  IN      NS      ns2.google.com.
google.com.             172800  IN      NS      ns1.google.com.
google.com.             172800  IN      NS      ns3.google.com.
google.com.             172800  IN      NS      ns4.google.com.
CK0POJMG874LJREF7EFN8430QVIT8BSM.com. 86400 IN NSEC3 1 1 0 - CK0Q1GIN43N1ARRC9OSM6QPQR81H5M9A NS SOA RRSIG DNSKEY NSEC3PARAM
CK0POJMG874LJREF7EFN8430QVIT8BSM.com. 86400 IN RRSIG NSEC3 8 2 86400 20160123055332 20160116044332 28259 com. TKWeCp1jcQELvXtHxY3FiweI1isLMRJ5zK8nOHG6Ip9WEUv1OOzqe9fn 5jTd7WOVtJpUZYdsT5IOzANN0MJQdg8n/hlK/SuBMzw+3nIyVauUlOLc daueoxJgNVGTrOGMipDJoypRJKsQcrKhEf+XrZozVOHDgxSOeZVvZzN4 vZw=
S84AE3BIT99DKIHQH27TRC0584HV5KOH.com. 86400 IN NSEC3 1 1 0 - S84HQQBBMVORSCH4GNB3G868OHH33GUR NS DS RRSIG
S84AE3BIT99DKIHQH27TRC0584HV5KOH.com. 86400 IN RRSIG NSEC3 8 2 86400 20160125055338 20160118044338 28259 com. Bay1TyEYHjgX55bMgdmeDie8CADsgj5ZHZ5qmMt2GA7C0MQvuNbLAFqS 4p3nLYkQgNUeAXB/ThMXaP/hvlTq/DVIUUbrdSfWhVQEZEU86NPbtxmG 8oOdhfTliqb6e5iWsI5s96nvNOhUOrX4g2uZQO0iQV5XAawGgWCsv9AM D/w=
;; Received 660 bytes from 192.26.92.30#53(c.gtld-servers.net) in 267 ms

google.com.             300     IN      A       216.58.197.110
;; Received 44 bytes from 216.239.38.10#53(ns4.google.com) in 275 ms
C:\Users\Fox-jimmy>dig google.com +short
216.58.221.110
C:\Users\Fox-jimmy>dig +nocmd @8.8.8.8 google.com any +noall +answer
google.com.             299     IN      A       216.58.221.142
google.com.             299     IN      AAAA    2404:6800:4005:80b::200e
google.com.             3599    IN      TXT     "v=spf1 include:_spf.google.com ~all"
google.com.             21599   IN      CAA     0 issue "symantec.com"
google.com.             599     IN      MX      40 alt3.aspmx.l.google.com.
google.com.             21599   IN      NS      ns2.google.com.
google.com.             599     IN      MX      20 alt1.aspmx.l.google.com.
google.com.             59      IN      SOA     ns2.google.com. dns-admin.google.com. 112456431 900 900 1800 60
google.com.             21599   IN      NS      ns3.google.com.
google.com.             599     IN      MX      10 aspmx.l.google.com.
google.com.             599     IN      MX      30 alt2.aspmx.l.google.com.
google.com.             599     IN      MX      50 alt4.aspmx.l.google.com.
google.com.             21599   IN      NS      ns4.google.com.
google.com.             21599   IN      NS      ns1.google.com.

C:\Users\Fox-jimmy>dig +nocmd @8.8.8.8 google.com any +multiline +noall +answer
google.com.             299 IN A 216.58.221.46
google.com.             299 IN AAAA 2404:6800:4005:808::200e
google.com.             21599 IN CAA 0 issue "symantec.com"
google.com.             21599 IN NS ns2.google.com.
google.com.             599 IN MX 40 alt3.aspmx.l.google.com.
google.com.             599 IN MX 20 alt1.aspmx.l.google.com.
google.com.             21599 IN NS ns4.google.com.
google.com.             21599 IN NS ns3.google.com.
google.com.             599 IN MX 50 alt4.aspmx.l.google.com.
google.com.             59 IN SOA ns2.google.com. dns-admin.google.com. (
                                112456431  ; serial
                                900        ; refresh (15 minutes)
                                900        ; retry (15 minutes)
                                1800       ; expire (30 minutes)
                                60         ; minimum (1 minute)
                                )
google.com.             599 IN MX 30 alt2.aspmx.l.google.com.
google.com.             599 IN MX 10 aspmx.l.google.com.
google.com.             21599 IN NS ns1.google.com.
google.com.             3599 IN TXT "v=spf1 include:_spf.google.com ~all"

发表评论

您的电子邮箱地址不会被公开。

:wink: :twisted: :roll: :oops: :mrgreen: :lol: :idea: :evil: :cry: :-| :-x :-o :-P :-D :) :( 8-O 8)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据