How to do a traceroute on Linux
  • 17 May 2023
  • 1 Minute to read
  • Dark
    Light

How to do a traceroute on Linux

  • Dark
    Light

Article summary

Most Linux distributions will have the 'traceroute' tool installed by default. 

If it's not installed, you can run the following commands to install it.

On CentOS / RedHat based Distros

sudo yum install traceroute -y

On Debian / Ubuntu based distros

sudo apt update && sudo apt install traceroute -y


Running Traceroute

You can simply run the traceroute command with the IP address or hostname of the target straight afterwards, like the below example:

$ traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  172.23.160.1 (172.23.160.1)  0.311 ms  0.296 ms  0.293 ms
 2  192.168.1.1 (192.168.1.1)  0.650 ms  1.215 ms  1.210 ms
 3  100.98.0.1 (100.98.0.1)  12.441 ms  12.527 ms  12.408 ms
 4  180.150.0.235 (180.150.0.235)  8.847 ms  8.842 ms  8.825 ms
 5  be50-3999.cfl3.nextdc-s2.syd.aussiebb.net (180.150.2.96)  8.822 ms  8.701 ms  8.693 ms
 6  10.241.12.121 (10.241.12.121)  5.196 ms 10.241.12.111 (10.241.12.111)  4.303 ms 10.241.12.121 (10.241.12.121)  4.310 ms
 7  google.equinix-sy3.syd.aussiebb.net (119.18.32.91)  4.323 ms  3.932 ms  3.928 ms
 8  * * *
 9  dns.google (8.8.8.8)  4.511 ms  4.209 ms 209.85.253.180 (209.85.253.180)  9.136 ms


If you don't want it to resolve the hostnames of each hop (this can speed up the traceroute or your DNS is not working, you may want to add this flag to allow the trace to work as well) then simply add the -n (no dns) flag to the traceroute like so:

$ traceroute -n 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  172.23.160.1  0.240 ms  0.238 ms  0.175 ms
 2  192.168.1.1  0.872 ms  0.993 ms  0.924 ms
 3  100.98.0.1  4.550 ms  4.446 ms  4.425 ms
 4  180.150.0.235  3.732 ms  3.769 ms  4.434 ms
 5  180.150.2.96  5.320 ms  5.387 ms  5.310 ms
 6  10.241.12.121  5.444 ms  5.390 ms 10.241.12.111  5.311 ms
 7  119.18.32.91  5.439 ms  4.844 ms  4.788 ms
 8  * * *
 9  8.8.8.8  3.568 ms 209.85.253.176  5.587 ms 8.8.8.8  3.472 ms




Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence