dnsping

通过给DNS服务器发送指定的数据包,像PING一样返回结果

 dnsping -c 10 -s 114.114.114.114 www.51cto.com 
dnsping DNS: 114.114.114.114:53, hostname: www.51cto.com, rdatatype: A
70 bytes from 114.114.114.114: seq=0   time=26.055 ms
70 bytes from 114.114.114.114: seq=1   time=24.745 ms
70 bytes from 114.114.114.114: seq=2   time=24.468 ms
70 bytes from 114.114.114.114: seq=3   time=25.033 ms
70 bytes from 114.114.114.114: seq=4   time=24.615 ms
70 bytes from 114.114.114.114: seq=5   time=24.844 ms
70 bytes from 114.114.114.114: seq=6   time=27.036 ms
70 bytes from 114.114.114.114: seq=7   time=25.232 ms
70 bytes from 114.114.114.114: seq=8   time=25.613 ms
70 bytes from 114.114.114.114: seq=9   time=25.343 ms

--- 114.114.114.114 dnsping statistics ---
10 requests transmitted, 10 responses received, 0% lost
min=24.468 ms, avg=25.298 ms, max=27.036 ms, stddev=0.777 ms

通过114公共DNS解析51cto官网,解析时间平均为25ms

测试内部的DNS,因为缓存的关系,会更快

dnsping -c 10 -s 192.168.x.x www.51cto.com
dnsping DNS: 192.168.x.x:53, hostname: www.51cto.com, rdatatype: A
71 bytes from 192.168.x.x: seq=0   time=84.492 ms
71 bytes from 192.168.x.x: seq=1   time=3.628 ms
71 bytes from 192.168.x.x: seq=2   time=3.340 ms
71 bytes from 192.168.x.x: seq=3   time=3.204 ms
71 bytes from 192.168.x.x: seq=4   time=3.350 ms
71 bytes from 192.168.x.x: seq=5   time=3.198 ms
71 bytes from 192.168.x.x: seq=6   time=3.164 ms
71 bytes from 192.168.x.x: seq=7   time=3.209 ms
71 bytes from 192.168.x.x: seq=8   time=3.059 ms
71 bytes from 192.168.x.x: seq=9   time=3.051 ms

--- 192.168.x.x dnsping statistics ---
10 requests transmitted, 10 responses received, 0% lost
min=3.051 ms, avg=11.369 ms, max=84.492 ms, stddev=25.693 ms

地址要自豪的隐藏,不过可以看出除了第一次要去上联取解析时间较久外,后面因为缓存的关系解析速度是很快的。

dnstraceroute

像traceroute路由探测一样,用来确定你的DNS请求经过的路径到达目的地

这里开启--expert选项可以输出专业提示,例如有可能DNS流畅劫持。很不幸看看我的结果,这次我用了阿里云的公共DNS

dnstraceroute --expert -C -t A -s 223.5.5.5  www.51cto.com
dnstraceroute DNS: 223.5.5.5:53, hostname: www.51cto.com, rdatatype: A

9      61.51.113.81 (61.51.113.81) 3.487 ms
10     192.168.9.22 (192.168.9.22) 174.075 ms
11     61.49.143.214 (61.49.143.214) 5.115 ms
12     192.168.9.22 (192.168.9.22) 168.890 ms
13     140.205.26.210 (140.205.26.210) 42.070 ms
14     192.168.9.22 (192.168.9.22) 132.504 ms
15     192.168.9.22 (192.168.9.22) 131.364 ms
16     192.168.9.22 (192.168.9.22) 130.170 ms
17     192.168.9.22 (192.168.9.22) 129.046 ms
18     192.168.9.22 (192.168.9.22) 128.409 ms
19     192.168.9.22 (192.168.9.22) 127.440 ms
20     192.168.9.22 (192.168.9.22) 126.075 ms
21     192.168.9.22 (192.168.9.22) 124.876 ms
22     192.168.9.22 (192.168.9.22) 123.502 ms
23     192.168.9.22 (192.168.9.22) 122.405 ms
24     192.168.9.22 (192.168.9.22) 121.296 ms
25     192.168.9.22 (192.168.9.22) 120.340 ms
26     192.168.9.22 (192.168.9.22) 121.284 ms
27     192.168.9.22 (192.168.9.22) 120.235 ms
28     192.168.9.22 (192.168.9.22) 119.002 ms
29     192.168.9.22 (192.168.9.22) 117.941 ms
30     192.168.9.22 (192.168.9.22) 116.735 ms

=== Expert Hints ===
 [*] public DNS server is next to a private IP address (possible hijacking)

前面8跳我进行了隐藏,后面的,我就不多说了。

dnseval

用于同时比较多个DNS服务器的响应时间,非常实用

dnseval -t A -f /root/dnsdiag/public-servers.txt -c10 www.51cto.com 
server              avg(ms)     min(ms)     max(ms)     stddev(ms)  lost(%)  ttl        flags
-----------------------------------------------------------------------------------------
114.114.114.114     25.257      24.925      27.023      0.631       %0       38         QR -- -- RD RA -- --
223.5.5.5           42.854      40.213      56.995      5.080       %0       15         QR -- -- RD RA -- --
223.6.6.6           43.564      39.979      48.332      2.775       %0       15         QR -- -- RD RA -- --
123.123.123.124     11.678      6.330       26.417      6.254       %0       60         QR -- -- RD RA -- --
123.125.81.6        4.015       3.234       6.977       1.121       %0       223        QR -- -- RD RA -- --
180.76.76.76        10.505      5.159       39.302      10.410      %0       80         QR -- -- RD RA -- --

感谢51CTO,我又拿它做测试了


最后附带官方地址,下载、安装请自行参考。
官方地址