Open In App

traceroute command in Linux with Examples

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

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 google.com

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

    Syntax:

    $ traceroute -6 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


Last Updated : 08 Dec, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads