Linux traceroute: Trace Packet Routes Across the Network
The traceroute command in Linux returns the addresses of machines and other network devices through which packets pass to reach a specific destination. This path is known as address route.
Traceroute also has its own executable to operate on IPv6, called traceroute6.
Traceroute uses the time to live (TTL – Time To Live) of IP packets to force an ICMP TIME EXCEEDED response from each device the packet passes through to obtain the necessary information.
Time to live determines the maximum number of devices a packet can traverse before being discarded. This parameter is necessary to prevent packets from wandering the network forever if their destination is not found.
This command can investigate where connectivity with the ping command is failing, and when this happens, most of the time it may be a problem with the routes, or some ICMP packet filter.
The default TTL is 30 hosts.
The most common options are:
- -n: This option disables name resolution;
- -w sec: This option changes the default ICMP packet return wait time from 5 seconds;
- -f ttl: This option changes the default initial time to live value of a packet;
- -m max: Changes the default maximum number of devices that will be tested by traceroute.
Example:
$ traceroute www.kernel.orgtraceroute to www.kernel.org (204.152.189.116), 30 hops max, 40 byte packets 1 10.128.0.1 6.832 ms 8.702 ms 11.401 ms 2 10.11.0.254 13.013 ms 6.261 ms 6.993 ms 3 INF001010.enl-int.redeinfovias.net.br (200.150.1.10) 72.771 ms 71.875 ms 70.068 ms(...)13 r7-2.r8.pao1.isc.org (192.5.4.225) 236.927 ms 234.988 ms 232.748 ms14 r8-pao1.r3.sfo2.isc.org (192.5.4.233) 225.628 ms 214.758 ms 214.469 ms15 zeus-pub.kernel.org (204.152.189.116) 216.677 ms 219.898 ms 221.776 ms
Learn much more about Linux in our online course. You can enroll here. If you already have an account, or want to create one, just log in or create your user here.
Like it? Share
That was just one piece. The course teaches the whole path — from your first command to exam day.