traceroute在排查网路问题很有用,它不仅能够获得本地到目标主机的所有网关路径,还能得知在哪一网关延时较长。
traceroute实现原理很简单,就是利用增加存活时间(TTL)值来实现其功能的。每当数据包经过一个路由器,其存活时间就会减1。当其存活时间是0时,主机便取消数据包,并传送一个ICMP TTL数据包给原数据包的发出者。
traceroute使用:
traceroute[参数][主机]
traceroute参数
mckee@mckee-pc ~ $ traceroute www.phpddt.com
traceroute to www.phpddt.com (42.121.145.230), 64 hops max
1 192.168.1.1 3.020ms 2.988ms 2.985ms
2 222.64.72.1 7.912ms 4.578ms 6.929ms
3 124.74.37.249 4.968ms 6.149ms 8.057ms
4 124.74.215.25 11.770ms 7.179ms 8.031ms
5 * * *
6 * * *
7 180.163.38.30 17.071ms 7.793ms 8.161ms
8 42.120.241.30 9.982ms 10.891ms 9.320ms
9 140.205.24.17 9.402ms 12.160ms 12.802ms
10 42.120.247.70 36.269ms 10.030ms 11.860ms
11 42.120.247.106 12.880ms 10.969ms 12.403ms
12 42.120.244.218 12.802ms 12.450ms 12.777ms
13 * * *
14 * * *
15 42.121.145.230 62.176ms 49.375ms 97.886ms