Dig 工具全称为域名信息搜索器(Domain Information Groper),能够显示详细的DNS查询过程,是一个非常强大的DNS故障诊断工具。一般Linux和Unix系统都已内置了该功能,但是在Windows环境中只有nslookup工具,下面我来介绍一下如何在Windows环境下安装Dig工具。
下载Dig工具安装包Bind
进入以下FTP镜像站点,下载最新版的bind安装包:
ftp://ftp.nominum.com/pub/isc/bind9/
根据自己系统下载对应的安装包
32位系统下载:BIND9.11.2.x86.zip
64位系统下载:BIND9.11.2.x64.zip
本文以win7 64位系统为例:
解压 BIND9.11.2.x64.zip,双击 vcredist_x64.exe (如果是 32 位,则文件名为 vcredist_x86.exe)安装 Microsoft Visual C++ 2012 Redistribution。
将 dig.exe 也复制至 C:\Windows\System32\ 目录下
最后再将解压后所有的 dll 文件复制至 C:\Windows\System32\ 目录下。如下图所示:
安装完成,使用命令“dig -version”命令查看验证dig工具版本
Dig工具的简单实用
我们可以直接实用”dig 域名“的方式直接进行DNS查询 eg: dig www.geekeden.net
默认情况下,dig进行DNS查询的DNS服务器为电脑本机设置的DNS,如下图示(我本机DNS设置为192.168.88.1):
可以在C:\Windows\System32\drivers\etc\目录下添加一个名为 resolv.conf 的文件,来修改dig查询的服务器。
新建一个txt文本文件,将以下两行复制到txt文本文件中:
nameserver114.114.114.114
nameserver 8.8.8.8
保存txt文件名称为resolv,并将其拓展名改为conf。此时dig的查询DNS就该成了114.114.114.114
使用"dig domain a +trace"命令,查看该详细的DNS查询过程
C:\Users\Administrator>dig www.geekeden.net a +trace
; <<>> DiG 9.11.2 <<>> www.geekeden.net a +trace
;; global options: +cmd
. 418373 IN NS j.root-servers.net.
. 418373 IN NS i.root-servers.net.
. 418373 IN NS c.root-servers.net.
. 418373 IN NS f.root-servers.net.
. 418373 IN NS d.root-servers.net.
. 418373 IN NS a.root-servers.net.
. 418373 IN NS h.root-servers.net.
. 418373 IN NS m.root-servers.net.
. 418373 IN NS b.root-servers.net.
. 418373 IN NS l.root-servers.net.
. 418373 IN NS e.root-servers.net.
. 418373 IN NS k.root-servers.net.
. 418373 IN NS g.root-servers.net.
. 518398 IN RRSIG NS 8 0 518400 20170910050000 201
70828040000 15768 . JeeYDB3PtC7VL/h7YEnBSPfdf/0JZPpc9fiOCGJizDyaBuoutXB4jbjj 6Ay
E0uBQyM3EhjgFhAtS3aAnqNk5Oh9Na7L7dlzLO9+nFHEGeYmJ67dn fNTdaFMMKM9c0976IuxSAg1R1/
XMTVuXydhbUsmJ9FnTbcuwX9eZLy6J IfSA6FcCr6e0XTy4+dfgOJQ96LPyCduHejcfgvKM9zcAB7vvR
7RGGF2W V/Y8xvbZ8NHaiKm4vc25Ws3BZBPPsQp5FUn13orBWOwHWEp9YYoP+ivb P6vJtPEcbUmNUt0
OHBU9kddAkQLWAGFI9h2fHV1SW6pvJYcXgItj0CIg hZlvYQ==
;; Received 1097 bytes from 114.114.114.114#53(114.114.114.114) in 85 ms
net. 172800 IN NS e.gtld-servers.net.
net. 172800 IN NS f.gtld-servers.net.
net. 172800 IN NS m.gtld-servers.net.
net. 172800 IN NS i.gtld-servers.net.
net. 172800 IN NS j.gtld-servers.net.
net. 172800 IN NS b.gtld-servers.net.
net. 172800 IN NS a.gtld-servers.net.
net. 172800 IN NS c.gtld-servers.net.
net. 172800 IN NS k.gtld-servers.net.
net. 172800 IN NS h.gtld-servers.net.
net. 172800 IN NS l.gtld-servers.net.
net. 172800 IN NS g.gtld-servers.net.
net. 172800 IN NS d.gtld-servers.net.
net. 86400 IN DS 35886 8 2 7862B27F5F516EBE196804
44D4CE5E762981931842C465F00236401D 8BD973EE
net. 86400 IN RRSIG DS 8 1 86400 20170910050000 2017
0828040000 15768 . HVJYrTdcnXItAjsnQcaqGyGWQIQZADrN0QGu1Il9l13ivRX4YSB8uh11 WI3E
SQ2K/p958IT9x9YLKWgNDI2B9tohtudt1m9DF2J+99XQFmDpS2io dcpQhUE+4DQNgnIP4Yf/KdkoD+a
jWcNuH9aB15YXd+FlEe5rDPcfNFoy gqnmCvIzkmSov7ZXff/WZwLg3sXe4UZi1ZzcWVkNYQBZgbWkgh
bvd+dJ 82PpelYDRWuqtQ0R9M9pKRob7bOG4ztutoU0yhG6Z/f+zZWT4niqVZ9+ 318CYIdPIzMhu/Nl
SfFOCsKzprcDc+ONgLI3flSpthzkTDmErGte7OKN qgXbvw==
;; Received 1173 bytes from 198.41.0.4#53(a.root-servers.net) in 64 ms
geekeden.net. 172800 IN NS ns13.domaincontrol.com.
geekeden.net. 172800 IN NS ns14.domaincontrol.com.
A1RT98BS5QGC9NFI51S9HCI47ULJG6JH.net. 86400 IN NSEC3 1 1 0 - A1RUUFFJKCT2Q54P78F
8EJGJ8JBK7I8B NS SOA RRSIG DNSKEY NSEC3PARAM
A1RT98BS5QGC9NFI51S9HCI47ULJG6JH.net. 86400 IN RRSIG NSEC3 8 2 86400 20170902051
148 20170826040148 57899 net. gbP3l7TwhZFfdWLW2N8rpIyExllbjb4loGwGaEG3StDUOoKgcZ
Z/fnUS gd3V+5PeHXosHrzvjFsJy4zdIDMzibN+TK33OpQHN5l2iLXDzbZh8w7P umZRuWZy6Vqp1NJB
it6w21SB0LglKJVV1lqRV8NjFWynjSUpPfp+KfH7 YQM=
GSP53AEBTJ5D8AQS3150GCSFUS0VNNVL.net. 86400 IN NSEC3 1 1 0 - GSPDAIMIF0NGHBI72P3
VL0QCD49V4L1R NS DS RRSIG
GSP53AEBTJ5D8AQS3150GCSFUS0VNNVL.net. 86400 IN RRSIG NSEC3 8 2 86400 20170901050
959 20170825035959 57899 net. nJCGE/XKI9xUR/I8QkZZU5BdhfFyQDM2N0gQhR+8JxFfY+aX1I
TcF/Da LgEYA66c3Bvrpv7LfJXScE1OK1G9w2Shs03M+CgnH837H6S2ARgSDr0R fIUurwUNPozcArBf
OxTT+HSn66mFn96xwC0k8f7QDVw7SQqDHmLj02qF ORs=
;; Received 673 bytes from 192.52.178.30#53(k.gtld-servers.net) in 102 ms
www.geekeden.net. 3600 IN CNAME geekeden.net.
geekeden.net. 600 IN A 148.66.136.214
geekeden.net. 3600 IN NS ns13.domaincontrol.com.
geekeden.net. 3600 IN NS ns14.domaincontrol.com.
;; Received 130 bytes from 216.69.185.7#53(ns13.domaincontrol.com) in 62 ms
C:\Users\Administrator>
本文原始链接:http://www.geekeden.net/windows/64.html
更多原创内容请访问极客乐园网站:www.geekeden.net
转载于:https://blog.51cto.com/geekeden/1960289