ubuntu traceroute

The traceroute tool is part of the inetutils collection of network programs. It needs to be manually installed, but aside from that, the Linux implementation is the same as any other platform.

Essentially, traceroute is used to track packets to a specific host, which can be useful for verifying and troubleshooting routing paths.

Ubuntu ships with some preinstalled tools as well that you can use to perform a traceroute. If I were to oversimplify it, tracepath is a somewhat limited version of traceroute, while mtr provides traceroute as well as additional functionalities.

Install and Use traceroute

First of all, update your package index and install the latest traceroute version with

sudo apt update && sudo apt install inetutils-traceroute

Let’s track the route of the packets to Google as an example.

traceroute google.com

We can see that traceroute automatically resolves google.com to and defaults to a max of 64 hops.

The packets first go from the device to the gateway ( The next three values indicate the Round-Trip Time (RTT) in milliseconds.

Traceroute sends three ICMP packets to test each hop. The time taken for each packet to get to a host and get back an ICMP reply is the RTT.

The 9th hop is just asterisks. This can mean a couple of things. If the traceroute had gotten stuck at this point, this would mean the packets were dropped (likely due to a firewall). You could use the -T flag to send TCP packets and try to bypass the firewall.

The second possibility is that the node was not configured to reply to ICMP packets. This is likely what happened in our case. The device simply passed the traffic along without replying, which led to a successful traceroute.

Use tracepath

Traceroute only shows the initial path of the packets to the host. It doesn’t show the return route. Most internet traffic is asymmetrical, meaning packets may take a different reverse route.

The RTT is calculated as an average of the forward and reverse time. If the reverse traffic followed a different route that had very high latency, it could easily be misinterpreted as the initial route causing high latency.

The tracepath tool can be useful for checking which hops were asymmetrical. The one downside is that tracepath can only send UDP traffic.

tracepath google.com

Perform a traceroute with mtr

mtr combines traceroute and ping into a single program. As traceroute by itself is a single shot tool, its output can inaccurately report a good connection even if it’s mostly unstable. mtr ensures this doesn’t happen by constantly updating the data and letting you monitor the connection over time.

mtr google.com
mtr google ubuntu
Anup Thapa

Senior Writer

Anup Thapa is a Linux enthusiast with an extensive background in computer hardware and networking. His goal is to effectively communicate technical concepts in a simplified form understandable by new Linux users. To this end, he mainly writes beginner-friendly tutorials and troubleshooting guides. Outside of work, he enjoys reading up on a range of topics, traveling, working out, and MOBAs.