Traceroute:发送的所有探测包路径是否相同?

Traceroute: Is the path same for all the probe packets sent?

Traceroute 是一个跟踪从 A 到 B 的路径的应用程序。(A 是您的位置,B 是您要跟踪的服务器)。

基本算法如下:

send UDP with TTL = 1
Server A1 received, and return ICMP packet to A because TTL is expired.
--> know first machine between. For example A1.

send UDP with TTL = 2
Server A1 received, and send this UDP to server A2.
Server A2 received, and return ICMP packet to A because TTL is expired
--> know second machine between. In this example is A2.

Do it until to B. we can track down: A -> A1 -> A2 -> ... ->B

我有一个疑问让我怀疑这个算法是否正确工作。

由于路由表经常更新,在跟踪路由期间,例如 TTL=3,探测数据包遵循路径 A1->A2->A3->A4。

现在,当我们发送一个TTL=4的探测数据包时,是否保证能通过A1、A2、A3、A4,然后到达A5?

如果不是呢?最终输出是否表示有效路径?

希望有人能阐明这个问题。非常感谢!

Now, when we send a probe packet with TTL=4, is it guaranteed to pass through A1, A2, A3, and A4 and then onto A5?

不,不能保证,但在大多数实际情况下很可能。如果 TTL=4 数据包没有沿着与之前数据包相同的路径传播,您最终会得到不能准确反映实际网络拓扑的结果:

您可以通过使用 Paris Traceroute, which is a traceroute implementation that fiddles with various IP & ICMP header fields (article) 增加所有数据包沿同一路径传输的机会来减少发生这种情况的机会。