traceroute command in Linux with Examples

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(172.217.26.206) 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.

Syntax:

traceroute [options]  host_Address [pathlength]

Options:



  • -4 Option: Use ip version 4 i.e. use IPv4

    Syntax:

    $ traceroute -4 10 google.com

  • -6 Option: Use ip version 6 i.e. use IPv6

    Syntax:

    $ traceroute -6 10 google.com

  • -F Option: Do not fragment packet.

    Syntax:

    $ traceroute -F google.com

  • -f first_ttl Option: Start from the first_ttl hop (instead from 1).

    Syntax:

    $ traceroute -f 10 google.com

  • -g gate Option: Route the packet through gate.

    Syntax:

    $ 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.

    Syntax:

    $traceroute  -m 5 google.com

  • -n Option: Do not resolve IP addresses to their domain names.

    Syntax:

    $traceroute -n google.com

  • -p port Option: Set the destination port to use. Default is 33434.

    Syntax:

    $traceroute  -p 20292 google.com

  • -q nqueries Option: Set the number of probes per each hop. Default is 3.

    Syntax:

    $traceroute -q 1 google.com

  • packetlen Option: The full packet length. Default len is 60 byte packets.

    Syntax:

    $traceroute  google.com 100

  • –help: Display help messages and exit.

    Syntax:

    $traceroute --help



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.