traceroute 是一种电脑网络工具。它可显示数据包在 IP 网络经过的路由器的 IP 地址。

程序是利用增加存活时间(TTL)值来实现其功能的。每当数据包经过一个路由器,其存活时间就会减 1。当其存活时间是 0 时,主机便取消数据包,并发送一个ICMP TTL数据包给原数据包的发出者。

traceroute 使用互联网控制信息协议(ICMP)实现,ICMP 依靠IP来完成它的任务,它是IP的主要部分。它与传输协议(如TCP和UDP)显著不同:它一般不用于在两点间传输数据。由于协议不同所以本地 http 代理对 traceroute 无效。

现代 Linux 系统称为 tracepath,Windows 系统称为 tracert,Windows NT 系统有结合 ping 和 traceroute 的 pathping 工具。

使用

Linux

可以使用 tracepath/traceroute 工具来测试,traceroute 可使用 apt 来安装,默认最多检测30个路由节点,超过的话就直接结束:

root@niekun-bandwagon:~# tracepath github.com
 1?: [LOCALHOST]                                         pmtu 1500
 1:  no reply
 2:  173.254.196.25.static.quadranet.com                   0.980ms
 3:  lax1-fatpipe-1.it7.net                                0.395ms
 4:  69.12.69.1                                            0.539ms asymm  3
 5:  ae12.er4.lax112.us.zip.zayo.com                       0.515ms asymm  4
 6:  ae14.cr2.lax112.us.zip.zayo.com                      26.123ms asymm 11
 7:  ae2.cs1.sjc2.us.eth.zayo.com                         26.180ms asymm 11
 8:  ae3.cs1.sea1.us.eth.zayo.com                         30.307ms asymm 10
 9:  ae1.mcs1.sea1.us.eth.zayo.com                        26.299ms asymm  8
traceroute to github.com (192.30.255.112), 30 hops max, 60 byte packets
 1  * * *
 2  173.254.196.25.static.quadranet.com (173.254.196.25)  1.172 ms  1.172 ms  1.161 ms
 3  lax1-fatpipe-1.it7.net (69.12.70.234)  0.220 ms lax1-fatpipe-1.it7.net (69.12.70.232)  0.341 ms lax1-fatpipe-1.it7.net (69.12.70.234)  0.193 ms
 4  ae12.er4.lax112.us.zip.zayo.com (64.124.85.221)  0.397 ms  0.422 ms 69.12.69.1 (69.12.69.1)  0.268 ms
 5  ae14.cr2.lax112.us.zip.zayo.com (64.125.30.74)  25.828 ms ae12.er4.lax112.us.zip.zayo.com (64.124.85.221)  0.364 ms  0.345 ms
 6  ae2.cs1.sjc2.us.eth.zayo.com (64.125.28.144)  35.091 ms ae14.cr2.lax112.us.zip.zayo.com (64.125.30.74)  26.043 ms  26.009 ms
 7  ae2.cs1.sjc2.us.eth.zayo.com (64.125.28.144)  34.909 ms  34.889 ms  34.832 ms
 8  ae1.mcs1.sea1.us.eth.zayo.com (64.125.28.133)  28.864 ms  26.124 ms  26.112 ms
 9  ae1.mcs1.sea1.us.eth.zayo.com (64.125.28.133)  28.448 ms  28.416 ms 64.125.188.97.IPYX-243981-001-ZYO.zip.zayo.com (64.125.188.97)  30.797 ms
10  * 64.125.188.97.IPYX-243981-001-ZYO.zip.zayo.com (64.125.188.97)  30.949 ms *

windows

可以使用 tracert/pathping 工具来测试,pathping 多显示了个本地 IP,默认最多检测30个路由节点,超过的话就直接结束:

PS C:\Users\Marco Nie> tracert niekun.net

Tracing route to niekun.net [104.24.97.72]
over a maximum of 30 hops:

  1     5 ms     1 ms     1 ms  OrayBox.lan [27.168.1.1]
  2    67 ms   111 ms    81 ms  192.168.1.1
  3     3 ms     3 ms     4 ms  100.64.16.1
  4     4 ms     3 ms     4 ms  10.226.25.13
  5     9 ms     *        *     219.145.223.105
  6    33 ms    32 ms    33 ms  202.97.65.41
  7     *        *        *     Request timed out.
  8     *       42 ms   131 ms  202.97.12.50
  9   341 ms   197 ms   201 ms  202.97.41.50
 10   237 ms   232 ms   224 ms  202.97.92.45
 11   242 ms   252 ms   238 ms  218.30.54.214
 12   197 ms   195 ms   196 ms  104.24.97.72

Trace complete.
PS C:\Users\Marco Nie> pathping niekun.net

Tracing route to niekun.net [104.24.97.72]
over a maximum of 30 hops:
  0  Marco-vostro-14.lan [27.168.1.209]
  1  OrayBox.lan [27.168.1.1]
  2  192.168.1.1
  3  100.64.16.1
  4  10.226.25.13
  5  219.145.223.105
  6  202.97.65.41
  7  202.97.34.74
  8     *     202.97.12.50
  9  202.97.41.50
 10  202.97.92.45
 11  218.30.54.214
 12  104.24.97.72

Computing statistics for 300 seconds...

标签:无

你的评论