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: A70 bytes from 114.114.114.114: seq=0 time=26.055 ms70 bytes from 114.114.114.114: seq=1 time=24.745 ms70 bytes from 114.114.114.114: seq=2 time=24.468 ms70 bytes from 114.114.114.114: seq=3 time=25.033 ms70 bytes from 114.114.114.114: seq=4 time=24.615 ms70 bytes from 114.114.114.114: seq=5 time=24.844 ms70 bytes from 114.114.114.114: seq=6 time=27.036 ms70 bytes from 114.114.114.114: seq=7 time=25.232 ms70 bytes from 114.114.114.114: seq=8 time=25.613 ms70 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% lostmin=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.comdnsping DNS: 192.168.x.x:53, hostname: www.51cto.com, rdatatype: A71 bytes from 192.168.x.x: seq=0 time=84.492 ms71 bytes from 192.168.x.x: seq=1 time=3.628 ms71 bytes from 192.168.x.x: seq=2 time=3.340 ms71 bytes from 192.168.x.x: seq=3 time=3.204 ms71 bytes from 192.168.x.x: seq=4 time=3.350 ms71 bytes from 192.168.x.x: seq=5 time=3.198 ms71 bytes from 192.168.x.x: seq=6 time=3.164 ms71 bytes from 192.168.x.x: seq=7 time=3.209 ms71 bytes from 192.168.x.x: seq=8 time=3.059 ms71 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% lostmin=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.comdnstraceroute DNS: 223.5.5.5:53, hostname: www.51cto.com, rdatatype: A9 61.51.113.81 (61.51.113.81) 3.487 ms10 192.168.9.22 (192.168.9.22) 174.075 ms11 61.49.143.214 (61.49.143.214) 5.115 ms12 192.168.9.22 (192.168.9.22) 168.890 ms13 140.205.26.210 (140.205.26.210) 42.070 ms14 192.168.9.22 (192.168.9.22) 132.504 ms15 192.168.9.22 (192.168.9.22) 131.364 ms16 192.168.9.22 (192.168.9.22) 130.170 ms17 192.168.9.22 (192.168.9.22) 129.046 ms18 192.168.9.22 (192.168.9.22) 128.409 ms19 192.168.9.22 (192.168.9.22) 127.440 ms20 192.168.9.22 (192.168.9.22) 126.075 ms21 192.168.9.22 (192.168.9.22) 124.876 ms22 192.168.9.22 (192.168.9.22) 123.502 ms23 192.168.9.22 (192.168.9.22) 122.405 ms24 192.168.9.22 (192.168.9.22) 121.296 ms25 192.168.9.22 (192.168.9.22) 120.340 ms26 192.168.9.22 (192.168.9.22) 121.284 ms27 192.168.9.22 (192.168.9.22) 120.235 ms28 192.168.9.22 (192.168.9.22) 119.002 ms29 192.168.9.22 (192.168.9.22) 117.941 ms30 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,我又拿它做测试了

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