Search code examples
networkingpingtcpicmptraceroute

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


Traceroute is an application to trace the path from A to B. (A is your location and B is the server you want to trace).

The basic algorithm is as follows:

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

I have a doubt that makes me skeptical as to whether this algorithm works correctly.

Since routing tables are updated frequently, during a traceroute, say for TTL=3, the probe packet follows the path A1->A2->A3->A4.

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?

If not? Does the final output represent a valid path?

Hope someone can shed some light on this issue. Thanks a lot in advance!


Solution

  • 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?

    No, it's not guaranteed, but it is likely in most real-world cases. In cases in which the TTL=4 packet doesn't travel along the same path as the previous packets, you'd end up with a result that doesn't accurately reflect the actual network topology:

    enter image description here

    You can reduce the chance of this happening by using Paris Traceroute, which is a traceroute implementation that fiddles with various IP & ICMP header fields (article) to increase the chances for all packets to travel along the same path.