2

I was studying Computer Networking book of Kurose and Ross and under Traceroute subsection I've read following:

More specifically, suppose there are N - 1 routers between the source and the destination. Then the source will send N special packets into the network, with each packet addressed to the ultimate destination. These N special packets are marked 1 through N, with the first packet marked 1 and the last packet marked N. When the nth router receives the nth packet marked n, the router does not forward the packet toward its destination, but instead sends a message back to the source.

I'd thought route of a packet is determined depending on the traffic and other factors while it travels from source to destination. So, I thought number of routers that a packet passes through may change from time to time.

But from the quote, I understand that number of routers between source and destination is known before a packet travels from source to destination. If that is the case, how this number is known by the source? If not, can someone explain this routing phenomena to me?

eesweng
  • 23
  • 3
  • 3
    The number of routers is NOT know before hand. See how the TTL is used by traceroute here: https://en.wikipedia.org/wiki/Traceroute – HBruijn Aug 16 '19 at 15:54

1 Answers1

3

You are right in your original line of thinking. The number of hops is not known before hand and can indeed change. You are taking the quote a bit too literally, i.e incorrectly understanding that there is literally a packet marked N that the nth router receives and also somehow knows itself as the nth router. Not your fault, as the quote is confusing.

In a traceroute ICMP packets are sent out with a TTL (time to live) field that times out on the first, then second, then ... nth hop. At each hop when a time out occurs, a ICMP Time Exceeded message is sent back to the origin (you). By gathering the progressive timeout messages you can generate the path to the target network. The nth router, which is your target, does not timeout and sends back a ICMP echo reply (when echos are used as the traceroute message medium).

Bringing it back to your quote and taken not quite so literally, the nth packet will be the last message sent out by you, which ultimately reaches the target, after you have generated the path up to that point - for the n-1 routers - by sending messages with progressively longer TTLs.

Hope that helps.

fthinker
  • 316
  • 1
  • 3
  • 9