Does traceroute use the same path

networkingroutertraceroute

I was a little bit confused about the use of traceroute.

According to this

The traceroute command is used to see how packets are getting routed. It works by sending packets with increasing TTL values, starting with 1. So the first router gets the packet, and it decrements the TTL value by one, thus dropping the packet. The router sends back an ICMP Time Exceeded message back to us. And then the next packet gets a TTL of 2, so it makes it past the first router, but when it gets to the second router the TTL is 0 and it returns another ICMP Time Exceeded message. Traceroute works this way because as it sends and drops packets it is build a list of routers that the packets traverse, until it finally gets to its destination and gets an ICMP Echo Reply message.
(source: https://linuxjourney.com/lesson/traceroute)

According to this, how can we be sure that traceroute use the same path at each ICMP packet sending? Can't a packet be routed somewhere else during the second, third, fourth call, and so on?

Thanks.

Best Answer

We can't be sure, it can change.

Each packet can have a different path, there is no guarantee here, it is a tool to help debugging, and not always a perfect truth.

A packet can also take one path there, but a completely different path back.

So what traceroute does tell you is at which router the packet "failed" with each step of increased TTL. To try and verify you run the trace multiple times (some implementations might already do this for you)

There could also be specific rules in place, which makes different types of packets take different paths. For example a trace might work perfectly fine, while TCP and/or UDP ports are blocked somewhere.

Related Topic