How to Install Traceroute and Run on Ubuntu 20.04

How to Install Traceroute and Run on Ubuntu 20.04. In this post, we will introduce Traceroute, its working then show you how to run it on Ubuntu 20.04.

When you connect with a website, the data you acquire tends to travel across several devices and channels. It notably includes routers. Have you ever wondered how this movement happens?

The answer is the tool we probably have in our system, called Traceroute. This tool traces the path between your computer and a target destination to provide valuable insights. Have a read and learn about this tool in detail.

So, let’s start the article blog How to Install Traceroute and Run on Ubuntu 20.04.

What is Traceroute?

Traceroute is a network diagnostic tool that tracks real time pathways taken by a packet on an IP network from source to destination. After, it reports the IP addresses of all the routers it pinged in between. This tool also records each hop’s time to make packets during its route to the destination.

Usually, Traceroute uses Internet Control Message Protocol (ICMP) echo packets with variable time to live (TTL) values. Then, it calculates the response time of this hop. Also, Traceroute queries these hops several times to guarantee accuracy. This way, the measurement of that particular hop becomes appropriate. Moreover, Traceroute also uses ICMP messages and TTL fields to function in the IP address header. Operating systems, like Windows and Linux, include these tools as a utility.

Therefore, Traceroute is beneficial for determining the response delays and routing loops in a network pathway across packet switched nodes. With the help of Traceroute, you can locate any point of failure you witness while routing to a specific location.

How Does Traceroute Work?

Well, traceroute uses the field in Internet Protocol (IP) packet headers that do not deal with path or route tracing. Each IP packets have mandatory Time to Live (TTL) values. These values serve as a self destruct mechanism to prevent undesirable packages from circulating across the Internet unnecessarily. Before sending it further down the line, every router in the path must decrement the TTL value by one. Once these values become zero, the routing process comes screeching halt. The last router that processes the packet has to send a “Time to Live exceeded” message, as it is inappropriate for normal data packets.

However, this frustrating error message plays a crucial role in the working of the Traceroute. Actually, traceroute manipulates the TTL field to trigger TTL exceeded messages from each hop along a given path.

  • First, the user invokes the traceroute command and specifies a target host. If the host is defined as a domain name, Traceroute tends to resolve it.
  • Traceroute then sends a data packet to its target. It sets the TTL value to one before sending the packet. The first router in the path decreases its value to 1, which triggers the TTL exceeded messages. It sends back to the host on which the Traceroute program is running.
  • Now Traceroute increases the TTL value to two. The first router again decreases its value to one. However, since it will no longer reduce to zero immediately after heading out of the gate, the packet takes one more hop. When the TTL value hits zero, another TTL exceeded message is generated and sent to the Traceroute.
  • The process repeats with Traceroute increasing its value to one every time until it reaches the destination. The upper limit of packets is 30 hops by default. However, when the command runs, you can specify different values.
  • After the process ends, the Traceroute prints every hops in the path, including the time each hop takes to reach the destination and return. This process is called Round Trip Time.

Traceroute automatically sends three packets to each hop in the path. The same packet will vary related to implementations. It can also change with different flags. However, every class will use the same methodologies.

How to Install and Run Traceroute on Ubuntu 20.04

Install Traceroute

By default, the Traceroute package is available in the Ubuntu default repository. You can install it by running the following command:

					apt install traceroute

After installing Traceroute, you can check its version using the following command:

					traceroute --version

You should get the following output:

					Modern traceroute for Linux, version 2.1.0
Copyright (c) 2016  Dmitry Butskoy,   License: GPL v2 or any later

To get a list of all options that you can use with the Traceroute command, run the following command:

					traceroute --help

You should see the following screen:

How to Run Traceroute On Ubuntu

The basic syntax to use the Traceroute command is shown below:

					traceroute [options] host-address [length]

For example, to see the complete route of the website, run the following command:


You will get the following output:

					traceroute to (, 30 hops max, 60 byte packets
 1  _gateway (  4.277 ms  6.348 ms  6.623 ms
 2  * * *
 3 (  57.956 ms (  57.639 ms (  57.253 ms
 4 (  62.807 ms  62.562 ms  74.712 ms
 5 (  74.695 ms (  74.677 ms (  74.932 ms
 6 (  74.644 ms (  66.717 ms  66.880 ms
 7  * * *
 8  * * *
 9  * * *
10  * * *
11 (  358.876 ms (  158.028 ms *
12 (  460.099 ms (  460.071 ms (  460.000 ms
13 (  55.560 ms (  62.419 ms (  63.228 ms


The above output shows the following information:

  • The IP address of the specified website.
  • Number of Hops: Shows the time the traceroute will try to reach the destination.
  • Number of packets per Hop.
  • The size of packets you are sending.

If you want to trace the path without resolving each hop IP address, run the following command:

					traceroute -d

You should see the following output:

					traceroute to (, 30 hops max, 60 byte packets
 1  _gateway (  2.273 ms  2.351 ms  2.614 ms
 2  * * *
 3 (  219.958 ms (  219.937 ms (  220.183 ms
 4 (  219.695 ms  218.895 ms  219.239 ms
 5 (  219.832 ms  226.633 ms  226.927 ms
 6 (  226.350 ms  1308.578 ms (  1308.795 ms
 7  * * *
 8  * * *
 9 (  1340.838 ms * (  1343.542 ms

Define Number of Probes

By default, the Traceroute command will passed 16 probes simultaneously. You can customize the number of probes to 5 using the N option:

					traceroute -N 5

You should see the following output:

					traceroute to (, 30 hops max, 60 byte packets
 1  _gateway (  3.134 ms  3.155 ms  3.197 ms
 2  * * *
 3 (  38.496 ms (  38.168 ms (  39.190 ms
 4 (  38.831 ms  39.980 ms  39.777 ms
 5 (  40.838 ms (  40.614 ms  39.666 ms
 6 (  479.916 ms (  439.863 ms (  538.679 ms


Limit the Number of Hops

By default, the Traceroute command will check the website for only 30 hops. You can set this value to 5 using the -m option:

					traceroute -m 5

You should see the following output:

					traceroute to (, 5 hops max, 60 byte packets
 1  _gateway (  2.750 ms  2.635 ms  2.815 ms
 2  * * *
 3 (  67.194 ms (  67.162 ms (  67.129 ms
 4 (  66.739 ms  66.708 ms  67.037 ms
 5 (  67.006 ms (  66.976 ms  67.181 ms


Limit the Number of Probes

By default, the Traceroute command shows three probes at every Hop. You can change this value to 2 using the -q option:

					traceroute -q 2

Hide Device Names

The Traceroute command also allows us to hide the device name to make it easier to see the data. You can do it using the -n option

					traceroute -n

You should see the following output:

					traceroute to (, 30 hops max, 60 byte packets
 1  38.755 ms  36.079 ms  36.220 ms
 2  * * *
 3  124.227 ms  124.058 ms  129.031 ms
 4  128.385 ms  128.718 ms  128.699 ms
 5  134.329 ms  133.886 ms  133.622 ms
 6  138.274 ms  102.884 ms  103.156 ms
 7  * * *
 8  * * *
 9  102.100 ms *  98.206 ms
10  * * *
11  99.058 ms  72.280 ms  72.388 ms
12  70.010 ms  84.832 ms  84.752 ms
13  81.108 ms  63.196 ms  72.126 ms


Define Initial TTL Value

You can set the initial value of TTL to skip some hops. If we set it to five, the first test will attempt to get to hop five and skip hops one through four.

To set the initial TTL value to 15, run the following command:

					traceroute -f 15

You should see the following output:

					traceroute to (, 30 hops max, 60 byte packets
15 (  198.816 ms  192.093 ms (  192.010 ms


Increase Hope Response Rate

You can use the -w option to increase the response rate that each Hop must wait to show the result.

					traceroute -w 6.5

You should see the following output:

					traceroute to (, 30 hops max, 60 byte packets
 1  _gateway (  7.418 ms  4.893 ms  5.042 ms
 2  * * *
 3 (  56.568 ms (  56.410 ms (  56.626 ms
 4 (  56.026 ms  56.357 ms  55.991 ms
 5 (  56.461 ms (  56.442 ms  56.286 ms
 6 (  56.406 ms (  45.208 ms (  45.694 ms
 7  * * *


Set Pause Time Between Probes

The default time is 0ms. However, you can use the -z option to define your own time:

					traceroute -z 0.5

Define Specific Interface for Traceroute

You can use the -i option to specify the interface through which traceroute should send packets. By default, the interface is selected according to the routing table.

					traceroute -i eth0

Thank you for reading How to Install Traceroute and Run on Ubuntu 20.04. It is time to conclude.

How to Install Traceroute and Run on Ubuntu 20.04 Conclusion

In this post, we showed you how to install and run Traceroute on Ubuntu 20.04. The Traceroute command is very a useful tool for system or network admins to diagnose the network related problems. The Traceroute command shows you which part of the path is the problem to identify the website issue. You can also use Traceroute to see the amount of latency at each stop.

Have a look at more Ubuntu content in our blog over here

Avatar for Hitesh Jethva
Hitesh Jethva

I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x