The traceroute command traces the route that an IP packet follows to a remote system. You use the traceroute command to uncover any routing misconfiguration and routing path failures. If a particular system is unreachable, you can use traceroute to see what path the packet follows to the remote system and where possible failures might be occurring.
The traceroute command also displays the round trip time for each gateway along the path to the target system. This information can be useful for analyzing where network traffic is slow between the two systems.
For more details about the traceroute command, see the traceroute(1M) man page.
This section contains the following topics:
You can use the traceroute command to trace both the IPv4 and IPv6 routes to a specific system. From a protocol perspective, the traceroute command uses the same algorithm as the ping command. Use the –A command-line option to override this behavior. Also, you can trace each individual route to every address of a multihomed host by using the –a command-line option.
Use the traceroute command as follows to discover the route to a remote system:
% traceroute destination-hostname
The following output from the traceroute command shows the seven–hop path that a packet follows from the local system nearhost to the remote system farhost. The output also shows the time that it takes a packet to traverse each hop.
% traceroute farhost traceroute to farhost (198.51.100.39/27), 30 hops max, 40 byte packets 1 frbldg7c-86 (198.51.100.1/27) 1.516 ms 1.283 ms 1.362 ms 2 bldg1a-001 (198.51.100.2/27) 2.277 ms 1.773 ms 2.186 ms 3 bldg4-bldg1 (198.51.100.66/27) 1.978 ms 1.986 ms 13.996 ms 4 bldg6-bldg4 (198.51.100.132/27) 2.655 ms 3.042 ms 2.344 ms 5 farhost (198.51.100.39/27) 3.430 ms 3.312 ms 3.451 ms
Use the traceroute command with –a option on the local system to trace all routes:
% traceroute -a host-name
The following example displays all possible routes to a dual-stack host:
% traceroute -a v6host traceroute: Warning: Multiple interfaces found; using 2001:db8:4a3a:1:56:a0:a8 @ net0:2 traceroute to v6host (2001:db8:4a3b:5:102:a00:fe79:19b0),30 hops max, 60 byte packets 1 v6-rout86 (2001:db8:4a3b:1:56:a00:fe1f:59a1) 35.534 ms 56.998 ms * 2 2001:db8::255:0:c0a8:717 32.659 ms 39.444 ms * 3 farhost (2001:db8:4a3b:2:103:a00:fe9a:ce7b) 401.518 ms 7.143 ms * 4 distant (2001:db8:4a3b:3:100:a00:fe7c:cf35) 113.034 ms 7.949 ms * 5 v6host (2001:db8:4a3b:5:102:a00:fe79:19b0) 66.111 ms * 36.965 ms * traceroute to v6host (192.0.2.75),30 hops max,40 byte packets 1 v6-rout86 (198.51.100.1/27) 4.360 ms 3.452 ms 3.479 ms 2 flrmpj17u (198.51.100.131/27) 4.062 ms 3.848 ms 3.505 ms 3 farhost (203.0.113.23) 4.773 ms * 4.294 ms 4 distant (192.0.2.104) 5.128 ms 5.362 ms * 5 v6host (192.0.2.85) 7.298 ms 5.444 ms *