host、dig、nslookup 查询DNS命令

只谈情不闲聊 提交于 2019-12-30 04:08:09

【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>

  1. host 命令:

    一般格式:
    host 域名
    host -a 域名

    常用选项:
    -a:相当于"-v -t any"。
    -t type:指定要查询的记录类型。默认查询A、AAAA、MX记录。
    -v:详细方式输出。

    [root@BJ-IDC-NTP-002 ~]# host baidu.com
    baidu.com has address 220.181.57.217
    baidu.com has address 111.13.101.208
    baidu.com has address 123.125.114.144
    baidu.com has address 180.149.132.47
    baidu.com mail is handled by 20 mx1.baidu.com.
    baidu.com mail is handled by 20 jpmx.baidu.com.
    baidu.com mail is handled by 20 mx50.baidu.com.
    baidu.com mail is handled by 10 mx.n.shifen.com.
    
    [root@BJ-IDC-NTP-002 ~]# host -a baidu.com
    Trying "baidu.com"
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48061
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 15, AUTHORITY: 5, ADDITIONAL: 1
    
    ;; QUESTION SECTION:
    ;baidu.com.			IN	ANY
    
    ;; ANSWER SECTION:
    baidu.com.		600	IN	A	220.181.57.217
    baidu.com.		600	IN	A	111.13.101.208
    baidu.com.		600	IN	A	123.125.114.144
    baidu.com.		600	IN	A	180.149.132.47
    baidu.com.		7200	IN	MX	20 mx1.baidu.com.
    baidu.com.		7200	IN	MX	20 jpmx.baidu.com.
    baidu.com.		7200	IN	MX	20 mx50.baidu.com.
    baidu.com.		7200	IN	MX	10 mx.n.shifen.com.
    baidu.com.		7200	IN	TXT	"v=spf1 include:spf1.baidu.com include:spf2.baidu.com include:spf3.baidu.com a mx ptr -all"
    baidu.com.		7200	IN	SOA	dns.baidu.com. sa.baidu.com. 2012127113 300 300 2592000 7200
    baidu.com.		86400	IN	NS	ns2.baidu.com.
    baidu.com.		86400	IN	NS	ns4.baidu.com.
    baidu.com.		86400	IN	NS	ns7.baidu.com.
    baidu.com.		86400	IN	NS	dns.baidu.com.
    baidu.com.		86400	IN	NS	ns3.baidu.com.
    
    ;; AUTHORITY SECTION:
    baidu.com.		86400	IN	NS	ns2.baidu.com.
    baidu.com.		86400	IN	NS	ns7.baidu.com.
    baidu.com.		86400	IN	NS	dns.baidu.com.
    baidu.com.		86400	IN	NS	ns3.baidu.com.
    baidu.com.		86400	IN	NS	ns4.baidu.com.
    
    ;; ADDITIONAL SECTION:
    ns2.baidu.com.		165598	IN	A	61.135.165.235
    
    Received 498 bytes from 10.10.61.67#53 in 345 ms
  2. dig 命令:

    一般格式:
    dig [@global-server] [domain] [q-type] [q-class] {q-opt} {d-opt}

    参数说明:
    @global-server:默认是以/etc/resolv.conf作为DNS查询的主机,这里可以填入其它DNS主机IP。
    domain:要查询的域名。
    q-type:查询记录的类型,例如a、any、mx、ns、soa、hinfo、axfr、txt等,默认查询a。
    q-class:查询的类别,相当于nslookup中的set class。默认值为in(Internet)。
    q-opt:查询选项,可以有好几种方式,比如:-f file为通过批处理文件解析多个地址;-p port指定另一个端口(缺省的DNS端口为53),等等。
    d-opt:dig特有的选项。使用时要在参数前加上一个“+”号。

    d-opt常用选项:
    +vc:使用TCP协议查询。
    +time=###:设置超时时间。
    +trace:从根域开始跟踪查询结果。

    最基本的使用方式就是
    dig www.baidu.com
    即查询域名的A记录,查询的dns服务器将采用系统配置的服务器,即/etc/resovle.conf 中的。
    如果要查询其他类型的记录,比如MX,CNAME,NS,PTR等,只需将类型加在命令后面即可
    dig www.baidu.com mx
    dig www.baidu.com ns
    此外,如果你是一个系统管理员,部署好了一台dns服务器之后想对它进行解析测试,就必须要显式指定待测试的dns服务器地址了,例如
    dig @202.106.0.20 www.baidu.com a
    默认情况下dig将采用udp协议进行查询,如果要采用tcp方式,可以加上 +tcp参数
    dig www.baidu.com a +tcp
    另外一个重要的功能是+trace参数,使用这个参数之后将显示从根域逐级查询的过程
    dig www.oolec.com a +trace
    [root@BJ-IDC-NTP-002 ~]# dig +trace www.163.com
    
    ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.3 <<>> +trace www.163.com
    ;; global options: +cmd
    .			3600	IN	NS	a.root-servers.net.
    .			3600	IN	NS	f.root-servers.net.
    .			3600	IN	NS	i.root-servers.net.
    .			3600	IN	NS	l.root-servers.net.
    .			3600	IN	NS	g.root-servers.net.
    .			3600	IN	NS	d.root-servers.net.
    .			3600	IN	NS	h.root-servers.net.
    ;; Received 425 bytes from 10.10.61.67#53(10.10.61.67) in 10 ms
    
    com.			172800	IN	NS	a.gtld-servers.net.
    com.			172800	IN	NS	b.gtld-servers.net.
    com.			172800	IN	NS	c.gtld-servers.net.
    com.			172800	IN	NS	d.gtld-servers.net.
    com.			172800	IN	NS	e.gtld-servers.net.
    com.			172800	IN	NS	f.gtld-servers.net.
    com.			172800	IN	NS	g.gtld-servers.net.
    com.			172800	IN	NS	h.gtld-servers.net.
    com.			172800	IN	NS	i.gtld-servers.net.
    com.			172800	IN	NS	j.gtld-servers.net.
    com.			172800	IN	NS	k.gtld-servers.net.
    com.			172800	IN	NS	l.gtld-servers.net.
    com.			172800	IN	NS	m.gtld-servers.net.
    ;; Received 489 bytes from 199.7.83.42#53(199.7.83.42) in 302 ms
    
    163.com.		172800	IN	NS	ns2.nease.net.
    163.com.		172800	IN	NS	ns3.nease.net.
    163.com.		172800	IN	NS	ns4.nease.net.
    163.com.		172800	IN	NS	ns5.nease.net.
    163.com.		172800	IN	NS	ns6.nease.net.
    163.com.		172800	IN	NS	ns7.nease.net.
    163.com.		172800	IN	NS	ns1.nease.net.
    163.com.		172800	IN	NS	ns8.nease.net.
    ;; Received 342 bytes from 192.43.172.30#53(192.43.172.30) in 990 ms
    
    www.163.com.		600	IN	CNAME	www.163.com.lxdns.com.
    ;; Received 61 bytes from 123.58.173.177#53(123.58.173.177) in 33 ms
    [root@BJ-IDC-NTP-002 ~]# tcpdump -nn -i eth3 port 53
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on eth3, link-type EN10MB (Ethernet), capture size 65535 bytes
    09:50:37.567967 IP 10.10.60.4.49757 > 10.10.61.67.53: 41895 NS? . (17)
    09:50:37.568286 IP 10.10.61.67.53 > 10.10.60.4.49757: 41895 7/0/13 NS a.root-servers.net., NS f.root-servers.net., NS i.root-servers.net., NS l.root-servers.net., NS g.root-servers.net., NS d.root-servers.net., NS h.root-servers.net. (425)
    09:50:37.575238 IP 10.10.60.4.47316 > 10.10.61.67.53: 52447+ A? a.root-servers.net. (36)
    09:50:37.575273 IP 10.10.60.4.47316 > 10.10.61.67.53: 42669+ AAAA? a.root-servers.net. (36)
    09:50:37.575512 IP 10.10.61.67.53 > 10.10.60.4.47316: 52447 1/0/0 A 198.41.0.4 (52)
    09:50:37.575525 IP 10.10.61.67.53 > 10.10.60.4.47316: 42669 1/0/0 AAAA 2001:503:ba3e::2:30 (64)
    09:50:37.575919 IP 10.10.60.4.44125 > 10.10.61.67.53: 59744+ A? f.root-servers.net. (36)
    09:50:37.575958 IP 10.10.60.4.44125 > 10.10.61.67.53: 41762+ AAAA? f.root-servers.net. (36)
    09:50:37.576171 IP 10.10.61.67.53 > 10.10.60.4.44125: 59744 1/0/0 A 192.5.5.241 (52)
    09:50:37.576180 IP 10.10.61.67.53 > 10.10.60.4.44125: 41762 1/0/0 AAAA 2001:500:2f::f (64)
    09:50:37.576351 IP 10.10.60.4.60363 > 10.10.61.67.53: 2387+ A? i.root-servers.net. (36)
    09:50:37.576392 IP 10.10.60.4.60363 > 10.10.61.67.53: 4491+ AAAA? i.root-servers.net. (36)
    09:50:37.576622 IP 10.10.61.67.53 > 10.10.60.4.60363: 2387 1/0/0 A 192.36.148.17 (52)
    09:50:37.576631 IP 10.10.61.67.53 > 10.10.60.4.60363: 4491 1/0/0 AAAA 2001:7fe::53 (64)
    09:50:37.576796 IP 10.10.60.4.60558 > 10.10.61.67.53: 36181+ A? l.root-servers.net. (36)
    09:50:37.576848 IP 10.10.60.4.60558 > 10.10.61.67.53: 24103+ AAAA? l.root-servers.net. (36)
    09:50:37.577020 IP 10.10.61.67.53 > 10.10.60.4.60558: 36181 1/0/0 A 199.7.83.42 (52)
    09:50:37.577075 IP 10.10.61.67.53 > 10.10.60.4.60558: 24103 1/0/0 AAAA 2001:500:3::42 (64)
    09:50:37.577249 IP 10.10.60.4.35241 > 10.10.61.67.53: 26562+ A? g.root-servers.net. (36)
    09:50:37.577291 IP 10.10.60.4.35241 > 10.10.61.67.53: 16228+ AAAA? g.root-servers.net. (36)
    09:50:37.577478 IP 10.10.61.67.53 > 10.10.60.4.35241: 26562 1/0/0 A 192.112.36.4 (52)
    09:50:37.577489 IP 10.10.61.67.53 > 10.10.60.4.35241: 16228 0/1/0 (96)
    09:50:37.577635 IP 10.10.60.4.57711 > 10.10.61.67.53: 21957+ A? d.root-servers.net. (36)
    09:50:37.577672 IP 10.10.60.4.57711 > 10.10.61.67.53: 3885+ AAAA? d.root-servers.net. (36)
    09:50:37.577884 IP 10.10.61.67.53 > 10.10.60.4.57711: 21957 1/0/0 A 199.7.91.13 (52)
    09:50:37.577893 IP 10.10.61.67.53 > 10.10.60.4.57711: 3885 1/0/0 AAAA 2001:500:2d::d (64)
    09:50:37.578148 IP 10.10.60.4.38740 > 10.10.61.67.53: 22329+ A? h.root-servers.net. (36)
    09:50:37.578187 IP 10.10.60.4.38740 > 10.10.61.67.53: 28236+ AAAA? h.root-servers.net. (36)
    09:50:37.578383 IP 10.10.61.67.53 > 10.10.60.4.38740: 22329 1/0/0 A 128.63.2.53 (52)
    09:50:37.578392 IP 10.10.61.67.53 > 10.10.60.4.38740: 28236 1/0/0 AAAA 2001:500:1::803f:235 (64)
    09:50:38.579304 IP 10.10.60.4.36346 > 199.7.83.42.53: 1699 A? www.163.com. (29)
    09:50:38.876219 IP 199.7.83.42.53 > 10.10.60.4.36346: 1699- 0/13/14 (489)
    09:50:38.876846 IP 10.10.60.4.51363 > 10.10.61.67.53: 57792+ A? a.gtld-servers.net. (36)
    09:50:38.876869 IP 10.10.60.4.51363 > 10.10.61.67.53: 51529+ AAAA? a.gtld-servers.net. (36)
    09:50:38.877119 IP 10.10.61.67.53 > 10.10.60.4.51363: 57792 1/0/0 A 192.5.6.30 (52)
    09:50:38.877239 IP 10.10.61.67.53 > 10.10.60.4.51363: 51529 1/0/0 AAAA 2001:503:a83e::2:30 (64)
    09:50:38.877430 IP 10.10.60.4.53250 > 10.10.61.67.53: 12102+ A? b.gtld-servers.net. (36)
    09:50:38.877465 IP 10.10.60.4.53250 > 10.10.61.67.53: 9547+ AAAA? b.gtld-servers.net. (36)
    09:50:38.877667 IP 10.10.61.67.53 > 10.10.60.4.53250: 12102 1/0/0 A 192.33.14.30 (52)
    09:50:38.877676 IP 10.10.61.67.53 > 10.10.60.4.53250: 9547 1/0/0 AAAA 2001:503:231d::2:30 (64)
    09:50:38.877880 IP 10.10.60.4.58851 > 10.10.61.67.53: 56078+ A? c.gtld-servers.net. (36)
    09:50:38.877917 IP 10.10.60.4.58851 > 10.10.61.67.53: 57561+ AAAA? c.gtld-servers.net. (36)
    09:50:38.878097 IP 10.10.61.67.53 > 10.10.60.4.58851: 56078 1/0/0 A 192.26.92.30 (52)
    09:50:38.878167 IP 10.10.61.67.53 > 10.10.60.4.58851: 57561 0/1/0 (103)
    09:50:38.878295 IP 10.10.60.4.33583 > 10.10.61.67.53: 49747+ A? d.gtld-servers.net. (36)
    09:50:38.878329 IP 10.10.60.4.33583 > 10.10.61.67.53: 45012+ AAAA? d.gtld-servers.net. (36)
    09:50:38.878531 IP 10.10.61.67.53 > 10.10.60.4.33583: 49747 1/0/0 A 192.31.80.30 (52)
    09:50:38.878538 IP 10.10.61.67.53 > 10.10.60.4.33583: 45012 0/1/0 (103)
    09:50:38.878670 IP 10.10.60.4.41959 > 10.10.61.67.53: 34242+ A? e.gtld-servers.net. (36)
    09:50:38.878702 IP 10.10.60.4.41959 > 10.10.61.67.53: 23479+ AAAA? e.gtld-servers.net. (36)
    09:50:38.878900 IP 10.10.61.67.53 > 10.10.60.4.41959: 34242 1/0/0 A 192.12.94.30 (52)
    09:50:38.878908 IP 10.10.61.67.53 > 10.10.60.4.41959: 23479 0/1/0 (103)
    09:50:38.879071 IP 10.10.60.4.33215 > 10.10.61.67.53: 45387+ A? f.gtld-servers.net. (36)
    09:50:38.879099 IP 10.10.60.4.33215 > 10.10.61.67.53: 57318+ AAAA? f.gtld-servers.net. (36)
    09:50:38.879308 IP 10.10.61.67.53 > 10.10.60.4.33215: 45387 1/0/0 A 192.35.51.30 (52)
    09:50:38.879315 IP 10.10.61.67.53 > 10.10.60.4.33215: 57318 0/1/0 (103)
    09:50:38.879444 IP 10.10.60.4.38813 > 10.10.61.67.53: 48761+ A? g.gtld-servers.net. (36)
    09:50:38.879475 IP 10.10.60.4.38813 > 10.10.61.67.53: 19+ AAAA? g.gtld-servers.net. (36)
    09:50:38.879672 IP 10.10.61.67.53 > 10.10.60.4.38813: 48761 1/0/0 A 192.42.93.30 (52)
    09:50:38.879680 IP 10.10.61.67.53 > 10.10.60.4.38813: 19 0/1/0 (103)
    09:50:38.879808 IP 10.10.60.4.33963 > 10.10.61.67.53: 39872+ A? h.gtld-servers.net. (36)
    09:50:38.879850 IP 10.10.60.4.33963 > 10.10.61.67.53: 30324+ AAAA? h.gtld-servers.net. (36)
    09:50:38.880038 IP 10.10.61.67.53 > 10.10.60.4.33963: 39872 1/0/0 A 192.54.112.30 (52)
    09:50:38.880044 IP 10.10.61.67.53 > 10.10.60.4.33963: 30324 0/1/0 (103)
    09:50:38.880178 IP 10.10.60.4.39078 > 10.10.61.67.53: 29289+ A? i.gtld-servers.net. (36)
    09:50:38.880209 IP 10.10.60.4.39078 > 10.10.61.67.53: 53348+ AAAA? i.gtld-servers.net. (36)
    09:50:38.880404 IP 10.10.61.67.53 > 10.10.60.4.39078: 29289 1/0/0 A 192.43.172.30 (52)
    09:50:38.880411 IP 10.10.61.67.53 > 10.10.60.4.39078: 53348 0/1/0 (103)
    09:50:38.880537 IP 10.10.60.4.38126 > 10.10.61.67.53: 5968+ A? j.gtld-servers.net. (36)
    09:50:38.880567 IP 10.10.60.4.38126 > 10.10.61.67.53: 38465+ AAAA? j.gtld-servers.net. (36)
    09:50:38.880761 IP 10.10.61.67.53 > 10.10.60.4.38126: 5968 1/0/0 A 192.48.79.30 (52)
    09:50:38.880768 IP 10.10.61.67.53 > 10.10.60.4.38126: 38465 0/1/0 (103)
    09:50:38.880914 IP 10.10.60.4.53177 > 10.10.61.67.53: 31139+ A? k.gtld-servers.net. (36)
    09:50:38.880944 IP 10.10.60.4.53177 > 10.10.61.67.53: 48907+ AAAA? k.gtld-servers.net. (36)
    09:50:38.881147 IP 10.10.61.67.53 > 10.10.60.4.53177: 31139 1/0/0 A 192.52.178.30 (52)
    09:50:38.881161 IP 10.10.61.67.53 > 10.10.60.4.53177: 48907 0/1/0 (103)
    09:50:38.881364 IP 10.10.60.4.39997 > 10.10.61.67.53: 44295+ A? l.gtld-servers.net. (36)
    09:50:38.881388 IP 10.10.60.4.39997 > 10.10.61.67.53: 39436+ AAAA? l.gtld-servers.net. (36)
    09:50:38.881600 IP 10.10.61.67.53 > 10.10.60.4.39997: 44295 1/0/0 A 192.41.162.30 (52)
    09:50:38.881608 IP 10.10.61.67.53 > 10.10.60.4.39997: 39436 0/1/0 (103)
    09:50:38.881752 IP 10.10.60.4.59946 > 10.10.61.67.53: 44031+ A? m.gtld-servers.net. (36)
    09:50:38.881781 IP 10.10.60.4.59946 > 10.10.61.67.53: 40185+ AAAA? m.gtld-servers.net. (36)
    09:50:38.881974 IP 10.10.61.67.53 > 10.10.60.4.59946: 44031 1/0/0 A 192.55.83.30 (52)
    09:50:38.881981 IP 10.10.61.67.53 > 10.10.60.4.59946: 40185 0/1/0 (103)
    09:50:38.882387 IP 10.10.60.4.50157 > 192.43.172.30.53: 62366 A? www.163.com. (29)
    09:50:38.942594 IP 192.43.172.30.53 > 10.10.60.4.50157: 62366- 0/8/10 (342)
    09:50:38.943011 IP 10.10.60.4.41813 > 10.10.61.67.53: 55357+ A? ns2.nease.net. (31)
    09:50:38.943031 IP 10.10.60.4.41813 > 10.10.61.67.53: 25481+ AAAA? ns2.nease.net. (31)
    09:50:38.943297 IP 10.10.61.67.50491 > 10.10.60.4.53: 42716+ A? ns2.nease.net. (31)
    09:50:38.943326 IP 10.10.61.67.51666 > 10.10.60.4.53: 8946+ AAAA? ns2.nease.net. (31)
    09:50:38.944273 IP 10.10.60.4.64646 > 192.12.94.30.53: 26064% [1au] AAAA? ns2.nease.net. (42)
    09:50:38.944386 IP 10.10.60.4.45676 > 192.12.94.30.53: 43851% [1au] A? ns2.nease.net. (42)
    09:50:39.272453 IP 192.12.94.30.53 > 10.10.60.4.64646: 26064- 0/12/11 (827)
    09:50:39.273087 IP 10.10.60.4.16745 > 123.58.173.178.53: 19605% [1au] AAAA? ns2.nease.net. (42)
    09:50:39.279642 IP 192.12.94.30.53 > 10.10.60.4.45676: 43851- 0/12/11 (827)
    09:50:39.279994 IP 10.10.60.4.56357 > 123.58.173.178.53: 50970% [1au] A? ns2.nease.net. (42)
    09:50:39.305204 IP 123.58.173.178.53 > 10.10.60.4.16745: 19605*- 0/1/1 (88)
    09:50:39.305528 IP 10.10.60.4.4829 > 192.43.172.30.53: 2831% [1au] DS? nease.net. (38)
    09:50:39.311720 IP 123.58.173.178.53 > 10.10.60.4.56357: 50970*- 1/8/10 A 123.58.173.178 (342)
    09:50:39.382899 IP 192.43.172.30.53 > 10.10.60.4.4829: 2831*- 0/6/1 (759)
    09:50:39.383667 IP 10.10.60.4.56286 > 149.20.64.4.53: 62178% [1au] Type32769? ns2.nease.net.dlv.isc.org. (54)
    09:50:39.383730 IP 10.10.60.4.15797 > 149.20.64.4.53: 22467% [1au] Type32769? nease.net.dlv.isc.org. (50)
    09:50:39.554695 IP 149.20.64.4.53 > 10.10.60.4.15797: 22467 NXDomain*- 0/6/1 (731)
    09:50:39.555389 IP 10.10.60.4.53 > 10.10.61.67.51666: 8946 0/1/0 (77)
    09:50:39.555688 IP 10.10.61.67.53 > 10.10.60.4.41813: 25481 0/1/0 (77)
    09:50:39.565043 IP 149.20.64.4.53 > 10.10.60.4.56286: 62178 NXDomain*- 0/6/1 (735)
    09:50:39.565695 IP 10.10.60.4.53 > 10.10.61.67.50491: 42716 1/8/9 A 123.58.173.178 (331)
    09:50:39.565980 IP 10.10.61.67.53 > 10.10.60.4.41813: 55357 1/8/9 A 123.58.173.178 (331)
    09:50:39.566243 IP 10.10.60.4.39246 > 10.10.61.67.53: 1436+ A? ns3.nease.net. (31)
    09:50:39.566288 IP 10.10.60.4.39246 > 10.10.61.67.53: 32190+ AAAA? ns3.nease.net. (31)
    09:50:39.566493 IP 10.10.61.67.53 > 10.10.60.4.39246: 1436 1/0/0 A 220.181.28.4 (47)
    09:50:39.566562 IP 10.10.61.67.51285 > 10.10.60.4.53: 5553+ AAAA? ns3.nease.net. (31)
    09:50:39.566976 IP 10.10.60.4.7400 > 61.135.255.140.53: 13841% [1au] AAAA? ns3.nease.net. (42)
    09:50:39.570382 IP 61.135.255.140.53 > 10.10.60.4.7400: 13841*- 0/1/1 (88)
    09:50:39.570634 IP 10.10.60.4.53 > 10.10.61.67.51285: 5553 0/1/0 (77)
    09:50:39.570852 IP 10.10.61.67.53 > 10.10.60.4.39246: 32190 0/1/0 (77)
    09:50:39.571000 IP 10.10.60.4.47578 > 10.10.61.67.53: 30806+ A? ns4.nease.net. (31)
    09:50:39.571039 IP 10.10.60.4.47578 > 10.10.61.67.53: 21750+ AAAA? ns4.nease.net. (31)
    09:50:39.571231 IP 10.10.61.67.53 > 10.10.60.4.47578: 30806 1/0/0 A 61.135.255.140 (47)
    09:50:39.571256 IP 10.10.61.67.51300 > 10.10.60.4.53: 41025+ AAAA? ns4.nease.net. (31)
    09:50:39.571584 IP 10.10.60.4.42884 > 123.58.173.177.53: 52533% [1au] AAAA? ns4.nease.net. (42)
    09:50:39.599753 IP 123.58.173.177.53 > 10.10.60.4.42884: 52533*- 0/1/1 (84)
    09:50:39.600073 IP 10.10.60.4.53 > 10.10.61.67.51300: 41025 0/1/0 (73)
    09:50:39.600303 IP 10.10.61.67.53 > 10.10.60.4.47578: 21750 0/1/0 (73)
    09:50:39.600461 IP 10.10.60.4.46300 > 10.10.61.67.53: 56990+ A? ns5.nease.net. (31)
    09:50:39.600509 IP 10.10.60.4.46300 > 10.10.61.67.53: 64847+ AAAA? ns5.nease.net. (31)
    09:50:39.600702 IP 10.10.61.67.53 > 10.10.60.4.46300: 56990 1/0/0 A 121.195.179.18 (47)
    09:50:39.600721 IP 10.10.61.67.52637 > 10.10.60.4.53: 52015+ AAAA? ns5.nease.net. (31)
    09:50:39.600981 IP 10.10.60.4.41999 > 121.195.179.19.53: 18159% [1au] AAAA? ns5.nease.net. (42)
    09:50:39.603831 IP 121.195.179.19.53 > 10.10.60.4.41999: 18159*- 0/1/1 (88)
    09:50:39.604083 IP 10.10.60.4.53 > 10.10.61.67.52637: 52015 0/1/0 (77)
    09:50:39.604321 IP 10.10.61.67.53 > 10.10.60.4.46300: 64847 0/1/0 (77)
    09:50:39.604467 IP 10.10.60.4.48995 > 10.10.61.67.53: 55100+ A? ns6.nease.net. (31)
    09:50:39.604501 IP 10.10.60.4.48995 > 10.10.61.67.53: 25649+ AAAA? ns6.nease.net. (31)
    09:50:39.604683 IP 10.10.61.67.53 > 10.10.60.4.48995: 55100 1/0/0 A 121.195.179.19 (47)
    09:50:39.604711 IP 10.10.61.67.51383 > 10.10.60.4.53: 53094+ AAAA? ns6.nease.net. (31)
    09:50:39.604974 IP 10.10.60.4.1286 > 54.86.137.107.53: 21477% [1au] AAAA? ns6.nease.net. (42)
    09:50:39.854011 IP 54.86.137.107.53 > 10.10.60.4.1286: 21477*- 0/1/1 (88)
    09:50:39.854494 IP 10.10.60.4.53 > 10.10.61.67.51383: 53094 0/1/0 (77)
    09:50:39.854801 IP 10.10.61.67.53 > 10.10.60.4.48995: 25649 0/1/0 (77)
    09:50:39.855230 IP 10.10.60.4.50814 > 10.10.61.67.53: 37555+ A? ns7.nease.net. (31)
    09:50:39.855275 IP 10.10.60.4.50814 > 10.10.61.67.53: 58694+ AAAA? ns7.nease.net. (31)
    09:50:39.855512 IP 10.10.61.67.53 > 10.10.60.4.50814: 37555 2/0/0 A 111.13.84.11, A 111.13.84.10 (63)
    09:50:39.855524 IP 10.10.61.67.52691 > 10.10.60.4.53: 56609+ AAAA? ns7.nease.net. (31)
    09:50:39.855850 IP 10.10.60.4.25778 > 111.13.84.11.53: 26183% [1au] AAAA? ns7.nease.net. (42)
    09:50:39.860807 IP 111.13.84.11.53 > 10.10.60.4.25778: 26183*- 0/1/1 (88)
    09:50:39.861117 IP 10.10.60.4.53 > 10.10.61.67.52691: 56609 0/1/0 (77)
    09:50:39.861353 IP 10.10.61.67.53 > 10.10.60.4.50814: 58694 0/1/0 (77)
    09:50:39.861521 IP 10.10.60.4.44932 > 10.10.61.67.53: 15281+ A? ns1.nease.net. (31)
    09:50:39.861555 IP 10.10.60.4.44932 > 10.10.61.67.53: 33059+ AAAA? ns1.nease.net. (31)
    09:50:39.861759 IP 10.10.61.67.53 > 10.10.60.4.44932: 15281 1/0/0 A 123.58.173.177 (47)
    09:50:39.861795 IP 10.10.61.67.51640 > 10.10.60.4.53: 63511+ AAAA? ns1.nease.net. (31)
    09:50:39.862105 IP 10.10.60.4.33438 > 220.181.28.4.53: 61120% [1au] AAAA? ns1.nease.net. (42)
    09:50:39.867909 IP 220.181.28.4.53 > 10.10.60.4.33438: 61120*- 0/1/1 (88)
    09:50:39.868287 IP 10.10.60.4.53 > 10.10.61.67.51640: 63511 0/1/0 (77)
    09:50:39.868527 IP 10.10.61.67.53 > 10.10.60.4.44932: 33059 0/1/0 (77)
    09:50:39.868669 IP 10.10.60.4.58678 > 10.10.61.67.53: 2484+ A? ns8.nease.net. (31)
    09:50:39.868702 IP 10.10.60.4.58678 > 10.10.61.67.53: 5196+ AAAA? ns8.nease.net. (31)
    09:50:39.868922 IP 10.10.61.67.53 > 10.10.60.4.58678: 2484 2/0/0 A 54.178.188.118, A 54.86.137.107 (63)
    09:50:39.868934 IP 10.10.61.67.52245 > 10.10.60.4.53: 10335+ AAAA? ns8.nease.net. (31)
    09:50:39.869226 IP 10.10.60.4.34754 > 121.195.179.18.53: 11657% [1au] AAAA? ns8.nease.net. (42)
    09:50:39.871782 IP 121.195.179.18.53 > 10.10.60.4.34754: 11657*- 0/1/1 (88)
    09:50:39.872039 IP 10.10.60.4.53 > 10.10.61.67.52245: 10335 0/1/0 (77)
    09:50:39.872338 IP 10.10.61.67.53 > 10.10.60.4.58678: 5196 0/1/0 (77)
    09:50:39.872777 IP 10.10.60.4.49068 > 123.58.173.177.53: 13523 A? www.163.com. (29)
    09:50:39.905788 IP 123.58.173.177.53 > 10.10.60.4.49068: 13523*- 1/0/0 CNAME www.163.com.lxdns.com. (61)
    ^C
    166 packets captured
    167 packets received by filter
    0 packets dropped by kernel
  3. nslookup

    nslookup命令使用频率比dig要高,可能是因为windows上没有dig命令吧。

    一般格式:
    nslookup [-option] [name | -] [server]

    参数说明:
    option:表示一些选项。这些选项可以通过set命令设置修改。
    name:表示查询的域名。
    server:可以指定DNS主机IP。

    set命令说明:
    set all:打印当前的选项值。
    set calss=value:设置查询的类型,一般情况下为Internet。
    set debug:设置调试模式。
    set d2:设置详细调试模式。
    set domin=name:设置默认的域名。
    set search:
    set port=value:设置DNS端口。
    set querytype=value:改变查询的信息的类型。默认的类型为A纪录。
    set type=value:和set querytype一样。
    set recurse:设置查询类型为递归;若为set norecurse,查询类型为跌代;缺省为前者。
    set retry=number:设置重试的次数。
    set timeout=number:设置等待应答的限制时间(单位为秒),超出即为超时,如果还可以重试,就会将长超时值加倍,重新查询。
    set vc:通过tcp方式查询。
    set fail:

    具体说明可以查看man手册。

    [root@BJ-IDC-NTP-002 ~]# nslookup www.baidu.com 8.8.8.8
    Server:		8.8.8.8
    Address:	8.8.8.8#53
    
    Non-authoritative answer:
    www.baidu.com	canonical name = www.a.shifen.com.
    Name:	www.a.shifen.com
    Address: 119.75.217.109
    Name:	www.a.shifen.com
    Address: 119.75.218.70
    [root@BJ-IDC-NTP-002 ~]# nslookup -query=mx 163.com 8.8.8.8
    Server:		8.8.8.8
    Address:	8.8.8.8#53
    
    Non-authoritative answer:
    163.com	mail exchanger = 50 163mx00.mxmail.netease.com.
    163.com	mail exchanger = 10 163mx01.mxmail.netease.com.
    163.com	mail exchanger = 10 163mx02.mxmail.netease.com.
    163.com	mail exchanger = 10 163mx03.mxmail.netease.com.
    
    Authoritative answers can be found from:
    [root@BJ-IDC-NTP-002 ~]# nslookup
    > www.163.com
    Server:		10.10.61.67
    Address:	10.10.61.67#53
    
    Non-authoritative answer:
    www.163.com	canonical name = www.163.com.lxdns.com.
    www.163.com.lxdns.com	canonical name = 163.xdwscache.ourglb0.com.
    Name:	163.xdwscache.ourglb0.com
    Address: 124.202.166.57
    Name:	163.xdwscache.ourglb0.com
    Address: 60.207.246.98
    > set type=MX
    > 163.com
    Server:		10.10.61.67
    Address:	10.10.61.67#53
    
    Non-authoritative answer:
    163.com	mail exchanger = 10 163mx02.mxmail.netease.com.
    163.com	mail exchanger = 10 163mx03.mxmail.netease.com.
    163.com	mail exchanger = 50 163mx00.mxmail.netease.com.
    163.com	mail exchanger = 10 163mx01.mxmail.netease.com.
    
    Authoritative answers can be found from:
    163.com	nameserver = ns3.nease.net.
    163.com	nameserver = ns4.nease.net.
    163.com	nameserver = ns8.nease.net.
    163.com	nameserver = ns1.nease.net.
    163.com	nameserver = ns7.nease.net.
    163.com	nameserver = ns5.nease.net.
    163.com	nameserver = ns6.nease.net.
    163.com	nameserver = ns2.nease.net.
    ns2.nease.net	internet address = 123.58.173.178
    ns3.nease.net	internet address = 220.181.28.4
    ns4.nease.net	internet address = 61.135.255.140
    ns5.nease.net	internet address = 121.195.179.18
    ns6.nease.net	internet address = 121.195.179.19
    ns7.nease.net	internet address = 111.13.84.10
    ns7.nease.net	internet address = 111.13.84.11
    ns1.nease.net	internet address = 123.58.173.177
    ns8.nease.net	internet address = 54.86.137.107
    ns8.nease.net	internet address = 54.178.188.118

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!