The traceroute command on a Cisco device can be used to identify the path used by a packet to reach its target. It identifies all the routers in the path from the source host to destination host and it can be useful when troubleshooting network problems. Using this command you can figure out which router in the path to an unreachable target should be examined more closely as the probable cause of the network’s failure.
Consider the following example network:
In the picture above you can see that we have a network of four routers. The network is working correctly. Consider what happens when we issue the traceroute command on R1 to the IP address of the router’s R4 Gi0/0 interface (172.16.0.2):
R1#traceroute 172.16.0.2 Type escape sequence to abort. Tracing the route to 172.16.0.2 1 10.0.0.1 0 msec 0 msec 0 msec 2 192.168.5.2 0 msec 0 msec 0 msec 3 172.16.0.2 0 msec 0 msec 0 msec
You can see that the traceroute command has listed the IP addresses of all of the routers in the path to the destination. Now let’s assume that the router R3 goes down. Consider the command output now:
R1#traceroute 172.16.0.2 Type escape sequence to abort. Tracing the route to 172.16.0.2 1 10.0.0.1 0 msec 0 msec 0 msec 2 10.0.0.1 !H * !H 3 * *
Notice how there is no response from R3 (192.168.5.2). Using this information, we can assume that there is a problem with R3 and investigate the matter. The !H in the output indicates that the host is unreachable. Other character that can appear in the traceroute command output are:
- number of miliseconds – the round-trip time in milliseconds.
- * – the probe has timed out.
- A – administratively prohibited (for example, with an access-list).
- Q – source quench (the destination is too busy).
- I – user interrupted test.
- U – port is unreachable.
- N – the network is unreachable.
- P – the protocol is unreachable.
- T – timeout.
- ? – unknown packet type.