The traceroute program goes a bit further than the ping program because it tells you what routers it used on the way to the destination machine.
The TCP/IP protocol uses the notion of Time to Live (TTL). This TTL is decreased by one as it moves through a router. As soon as the TTL reaches zero, the packet is destroyed. This stops TCP/IP packets from flooding a network when there is a routing loop. In a routing loop, your packet traverses the same router over and over again because of router misconfiguration. This is not common, but we have seen it on quite a few occasions on the Internet.
The traceroute program takes advantage of the TTL by initially specifying a TTL of 1. As your packet hits the first router, its TTL is decreased to zero and your client receives an ICMP packet informing you that your packet has been destroyed. To find the next router to your destination, traceroute sends a packet out to your server, with a TTL of 2. This time the packet goes one router further until the TTL is zero and you are notified that your packet has been destroyed. This happens until your packet eventually reaches your target machine.
The traceroute program helps you diagnose where a connectivity problem exists on the way to a server. This is useful as it can help you rule out whether the problem is local to your administrative domain or is someone else's problem. See Listing 15-16 for an example.
Was this article helpful?