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?