Tracerouting the Network

As shown in the preceding section, ping is useful for figuring out whether you can reach one host from another host; however, to find out the path that packets take through intermediate hops from source to destination, you can use the traceroute command.

For example, in Figure 8-2, the network is running the OSPF routing protocol. OSPF calculates a path from router1 to router7 (highlighted on the topology map). If you issue a ping command from router1, the ping fails. But to try to find out exactly where the failure is (the destination router or an immediate hop), you issue the traceroute command.

user@router1> traceroute router7
traceroute to router7 (192.168.24.1), 30 hops max, 40 byte packets
 1  router2 (192.168.26.1)  0.869 ms 0.638 ms 0.536 ms
 2  router3 (192.168.27.1)  24.968 ms 0.727 ms 0.363 ms
 3  *
 4  *
^C

The traceroute command works by sending an ICMP packet from the source to the destination node with an initial hop count of one. At each hop, the packet is processed, the hop count decremented, and if the hop count is now zero, the intermediate hop sends a response back to the source letting it know that it was received but the hop count expired. This information forms the first line of the output (from router2 in this case). Then an ICMP packet with a hop count of 2 is sent out, and makes its way to the second device, and so on until either the destination is reached, a reply to a packet is not received (*), or the hop count (30, in this case) ...

Get Junos® OS For Dummies®, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.