traceroute command in Linux prints the route that a packet takes to reach the host. This command is useful when you want to know about the route and about all the hops that a packet takes. Below image depicts how traceroute command is used to reach the Google(126.96.36.199) host from the local machine and it also prints detail about all the hops that it visits in between.
The first column corresponds to the hop count. The second column represents the address of that hop and after that, you see three space-separated time in milliseconds. traceroute command sends three packets to the hop and each of the time refers to the time taken by the packet to reach the hop.
traceroute [options] host_Address [pathlength]
- -4 Option: Use ip version 4 i.e. use IPv4
$ traceroute -4 10 google.com
- -6 Option: Use ip version 6 i.e. use IPv6
$ traceroute -6 10 google.com
- -F Option: Do not fragment packet.
$ traceroute -F google.com
- -f first_ttl Option: Start from the first_ttl hop (instead from 1).
$ traceroute -f 10 google.com
- -g gate Option: Route the packet through gate.
$ traceroute -g 192.168.43.45 google.com
- -m max_ttl Option: Set the max number of hops for the packet to reach the destination.Default value is 30.
$traceroute -m 5 google.com
- -n Option: Do not resolve IP addresses to their domain names.
$traceroute -n google.com
- -p port Option: Set the destination port to use. Default is 33434.
$traceroute -p 20292 google.com
- -q nqueries Option: Set the number of probes per each hop. Default is 3.
$traceroute -q 1 google.com
- packetlen Option: The full packet length. Default len is 60 byte packets.
$traceroute google.com 100
- –help: Display help messages and exit.