Tuesday, June 2, 2026Today's Paper

Omni Apps

Trace Route on Unix: A Deep Dive (Linux/Debian/Ubuntu)
June 2, 2026 · 13 min read

Trace Route on Unix: A Deep Dive (Linux/Debian/Ubuntu)

Master trace route on Unix systems like Linux, Debian, and Ubuntu. Learn how this essential tool maps network paths and diagnoses connectivity issues.

June 2, 2026 · 13 min read
LinuxNetworkingTroubleshooting

Understanding how data travels across the internet is crucial for any network administrator, developer, or even a curious user facing connectivity problems. The traceroute command, a staple on Unix-like systems including Linux, Debian, and Ubuntu, provides a clear, step-by-step map of the journey packets take from your machine to a destination.

This guide will demystify the trace route on Unix, explaining its purpose, how to use it effectively, and what the output actually means. Whether you're trying to pinpoint a slow connection or understand network latency, mastering traceroute is an invaluable skill. We'll cover the common use cases, advanced options, and how it compares to its Windows counterpart.

What is Trace Route and Why Use It?

At its core, a trace route is a network diagnostic utility that records the path and measures the transit time of packets across an Internet Protocol network. Think of it as a digital GPS for your internet traffic. When you send a request to a website or a server, your data doesn't go directly from your computer to the destination. Instead, it hops through a series of intermediate routers, each acting as a waypoint.

The traceroute program on Unix systems (often simply called traceroute or tracepath on some Linux distributions) meticulously logs each of these routers (or 'hops') along the path. For each hop, it reports the round-trip time it took for a packet to reach that router and for the acknowledgment to return. This information is incredibly valuable for:

  • Diagnosing Connectivity Issues: If you can't reach a website or service, traceroute can help identify where the connection is failing. Is it at your local network, your ISP, or somewhere further along the internet backbone?
  • Identifying Network Latency: High ping times or slow loading websites can often be attributed to slow hops along the route. traceroute can pinpoint these bottlenecks, allowing you to understand where the delay is occurring.
  • Understanding Network Topology: It provides a visual representation of the network path, helping you understand the complex interconnections of the internet.
  • Performance Tuning: For developers and system administrators, identifying latency points can inform decisions about server placement, content delivery networks (CDNs), and overall network optimization.

While the concept is similar to tracert on Windows, the underlying implementation and some command-line options differ, making a Unix-specific understanding important for users of Linux, Debian, Ubuntu, and other Unix-like operating systems.

How to Use Trace Route on Unix (Linux, Debian, Ubuntu)

The traceroute command is typically pre-installed on most Linux distributions, including Debian and Ubuntu. If, for some reason, it's not available, you can usually install it using your distribution's package manager. For Debian/Ubuntu, you'd use:

sudo apt update
sudo apt install traceroute

For other Linux distributions, you might use yum or dnf (e.g., sudo yum install traceroute).

The basic syntax is straightforward:

traceroute [options] hostname_or_IP_address

Let's break down a common scenario. Suppose you want to trace the route to google.com:

traceroute google.com

Alternatively, you can use an IP address:

traceroute 8.8.8.8

When you run this command, traceroute sends out a series of UDP packets (or sometimes ICMP echo requests, depending on the implementation and options) towards the target. Each packet is sent with a progressively increasing Time To Live (TTL) value. The TTL is like a hop limit. The first set of packets has a TTL of 1. When a router receives a packet with a TTL of 1, it decrements the TTL to 0, discards the packet, and sends back an ICMP "Time Exceeded" message to the source.

traceroute uses these ICMP messages to identify each hop. It starts with TTL=1, then TTL=2, and so on, until it reaches the destination or a maximum hop count is reached. For each hop, it sends multiple probes (usually three) to get an average latency and to check for packet loss between hops.

Understanding the Output

The output of traceroute can look intimidating at first, but it's quite structured. Here's a typical example:

traceroute to google.com (142.251.46.14), 30 hops max, 60 byte packets
 1  _gateway (192.168.1.1)  0.877 ms  0.765 ms  0.711 ms
 2  10.0.0.1 (10.0.0.1)  10.123 ms  11.456 ms  12.001 ms
 3  ISP-ROUTER-1.net (203.0.113.1)  25.678 ms  26.901 ms  27.112 ms
 4  ANOTHER-ISP-ROUTER.net (198.51.100.5)  35.111 ms  34.888 ms  36.002 ms
 5  PEERING-POINT-A.net (192.0.2.10)  40.555 ms  41.001 ms  39.999 ms
 6  google-router-1.net (172.217.10.1)  45.111 ms  46.222 ms  45.888 ms
 7  google-router-2.net (172.217.10.2)  47.001 ms  48.111 ms  47.555 ms
 8  google-server.google.com (142.251.46.14)  49.000 ms  48.555 ms  49.222 ms

Let's break down each part:

  • First Line: traceroute to google.com (142.251.46.14), 30 hops max, 60 byte packets

    • This shows the target hostname and its resolved IP address.
    • 30 hops max: The maximum number of hops traceroute will attempt before giving up.
    • 60 byte packets: The size of the packets being sent.
  • Subsequent Lines (Each Hop):

    • 1 _gateway (192.168.1.1): This is the first hop. _gateway is the hostname resolved for the IP address 192.168.1.1. If a hostname can't be resolved, only the IP address will be shown.
    • 0.877 ms 0.765 ms 0.711 ms: These are the round-trip times (RTTs) for the three probes sent to this hop. The unit is milliseconds (ms).
  • Asterisks (*): If you see asterisks instead of RTTs for a hop, it means that no ICMP "Time Exceeded" message was received from that router within the timeout period. This can happen for several reasons:

    • The router is configured not to send ICMP messages.
    • The router is overloaded and cannot respond in time.
    • There's packet loss between your machine and that router, or between that router and you.
    • A firewall is blocking the ICMP responses.
  • High Latency: If you notice a significant jump in RTTs between two consecutive hops, and the latency remains high for subsequent hops, it indicates a bottleneck or congestion at that point in the network path.

  • Sudden Drop in Latency: Conversely, a sudden drop in latency after a high-latency hop might indicate that the problematic router was a transit point and the next hop is a more direct route.

  • End of the Line: The last hop is your destination. Once traceroute receives an ICMP "Port Unreachable" message from the destination (which is what happens when the UDP packet's destination port is not open), it knows it has reached the target.

Common traceroute Options and Variants

traceroute on Unix offers several options to customize its behavior and gather more specific information.

Changing Packet Type (-I, -T, -U)

By default, traceroute often uses UDP packets. However, you can specify different protocols:

  • -I or --icmp: Uses ICMP echo requests (like ping). This is often what tracert on Windows uses. This can be more reliable for diagnosing issues as many firewalls allow ICMP.
    
    

traceroute -I google.com

*   `-T` or `--tcp`: Uses TCP SYN packets. This is useful for tracing routes to specific ports, which can bypass firewalls that block UDP or ICMP.
    ```bash
traceroute -T -p 80 google.com
(Traces using TCP SYN to port 80)
  • -U or --udp: Explicitly uses UDP packets (often the default).

Specifying Port (-p)

When using TCP or UDP probes, you can specify the destination port:

traceroute -p 443 google.com

This is useful for troubleshooting connectivity to services that run on specific ports (e.g., 80 for HTTP, 443 for HTTPS).

Setting Hop Count (-m)

You can limit the maximum number of hops to probe:

traceroute -m 15 google.com

This is helpful if you suspect the route is very long or you want to stop tracing after a certain point.

Setting Timeout (-w)

This option sets the time (in seconds) to wait for a response to an outgoing probe:

traceroute -w 2 google.com

If you're on a slow or congested network, increasing the timeout might be necessary.

Verbose Output (-v)

Enables verbose output, showing more details about the probes and responses:

traceroute -v google.com

Don't Resolve Hostnames (-n)

This prevents traceroute from attempting to resolve IP addresses to hostnames, speeding up the process significantly and sometimes avoiding issues with DNS lookups:

traceroute -n google.com

Using tracepath

Many modern Linux systems, especially those using systemd, also include tracepath. tracepath is a simpler utility that doesn't require root privileges to run and also doesn't require a traceroute program installed. It aims to discover the path MTU (Maximum Transmission Unit) as well.

Its basic usage is similar:

tracepath google.com

While tracepath is convenient, traceroute often provides more options and historical context.

Common Scenarios and Troubleshooting with Trace Route

Let's look at practical examples of using traceroute to diagnose network problems.

Scenario 1: Website is Unreachable

If you can't access a particular website, the first step is to traceroute to its domain or IP address.

traceroute example.com
  • If the trace stops at your gateway or a router within your local network: The problem is likely with your home/office router or your local network configuration. Reboot your router, check physical connections, or consult your network administrator.
  • If the trace stops at your ISP's equipment: The issue is probably with your Internet Service Provider. You might want to contact their support.
  • If the trace goes through many hops but then shows asterisks or high latency before the destination: This indicates a problem further out on the internet. It could be congestion, a router failure, or a routing issue that is outside your direct control. You can try using the -I option to see if ICMP is being blocked, which might be the cause of asterisks.
  • If the trace reaches the destination but is slow: Examine the RTTs for each hop. If a specific hop consistently shows high latency, that's your bottleneck. If latency increases dramatically at a certain point and stays high, that's your culprit.

Scenario 2: Slow Internet Speed

While traceroute isn't a direct speed test, high latency identified by traceroute can contribute to perceived slow speeds. If you run traceroute to a common server (like a major website or a public DNS server like 8.8.8.8) and see consistently high RTTs (e.g., over 100ms) for most hops, it suggests a general network performance issue rather than a problem with a single site.

Scenario 3: Intermittent Connectivity

If you experience random disconnects or intermittent unreachability, traceroute might show inconsistent results. Running it multiple times over a period can reveal if a specific hop is intermittently failing or showing high latency. This often points to network congestion or unstable links.

Trace Route for Linux Distributions (Debian, Ubuntu, etc.)

As mentioned, traceroute is a standard utility across most Unix-like systems. For Debian and Ubuntu users specifically, installing and using it is identical to the general Linux instructions.

# On Debian/Ubuntu
sudo apt update
sudo apt install traceroute

Then, simply run:

traceroute [target]

If you are using a minimal Linux installation or a distribution that favors newer tools, you might encounter tracepath. For example, on some newer Ubuntu versions, tracepath might be the default tool found when you type traceroute if the traceroute package isn't explicitly installed.

# If traceroute is not installed, try tracepath
tracepath google.com

Both tools serve the primary purpose of mapping network routes, but traceroute generally offers more granular control and historical usage. For most users, understanding traceroute is sufficient.

Advanced Concepts and Considerations

  • Firewalls: Many routers and network devices are configured to drop ICMP packets or not send "Time Exceeded" messages. This can lead to asterisks in traceroute output, even if the path is functional. Using TCP SYN probes (-T) can sometimes circumvent these restrictions and provide a more complete picture.
  • Load Balancing: Some networks use load balancing, meaning that different probes sent to the same hop might take different paths or go through different routers. This can explain why the RTTs for the three probes to a single hop might vary significantly.
  • AS Numbers (Autonomous System Numbers): Advanced traceroute implementations or companion tools can display AS numbers for each hop. This helps identify which network providers are responsible for different segments of the route, providing a more comprehensive understanding of internet topology.
  • mtr (My Traceroute): For real-time, continuous tracing, mtr is an excellent tool. It combines the functionality of ping and traceroute into a single, interactive command. It continuously updates hop status, latency, and packet loss, making it invaluable for monitoring unstable connections.
    
    

Install mtr

sudo apt install mtr # For Debian/Ubuntu

Run mtr

mtr google.com


*   **Privacy and Security:** Be aware that `traceroute` probes can be logged by intermediate routers and network administrators. While generally used for legitimate <a class="kw-link" href="/tcp-tracer">network diagnostics</a>, avoid using it for sensitive information or to probe networks you do not have explicit permission to test.

## Trace Route Program Summary

The `traceroute` command is an indispensable network diagnostic utility for anyone working with or troubleshooting Unix-like systems, including Linux, Debian, and Ubuntu. By revealing the hop-by-hop path packets take across the internet, it empowers users to identify bottlenecks, diagnose connectivity failures, and understand network performance.

Mastering its basic syntax, understanding its output, and knowing how to leverage its various options can transform <a class="kw-link" href="/ip-traceroute-command">network troubleshooting</a> from a guessing game into a systematic process. Whether you're a seasoned administrator or just starting out, incorporating `traceroute` into your toolkit will significantly enhance your ability to navigate and resolve network issues.

## Frequently Asked Questions (FAQ)

**Q: Why does `traceroute` sometimes show asterisks (`*`)?

A: Asterisks indicate that no response was received from a particular hop within the timeout period. This can be due to firewalls blocking ICMP responses, routers being overloaded, or packet loss. It doesn't always mean the route is broken, but it does mean you can't get latency information for that specific hop.

**Q: Is `traceroute` the same as `tracert` on Windows?

A: The functionality is the same – both map network routes. However, `traceroute` on Unix typically uses UDP probes by default, while `tracert` on Windows uses ICMP echo requests. Command-line options also differ.

**Q: Do I need root privileges to run `traceroute`?

A: In many Linux systems, `traceroute` requires root privileges to send raw IP packets. However, some modern implementations might allow non-root users to run it, or you can use `sudo` to execute it. `tracepath` usually does not require root privileges.

**Q: How do I tell if a problem is with my ISP or the internet in general?

A: If the `traceroute` stops at your ISP's equipment (e.g., the first few hops after your gateway belong to your ISP), the issue is likely with your ISP. If the trace goes many hops through various networks and then fails or becomes very slow closer to the destination, it suggests a broader internet issue or a problem further down the line.

**Q: What is the difference between `traceroute` and `ping`?

A: `ping` checks if a host is reachable and measures the round-trip time to that *single* host. `traceroute` maps the *entire path* to a host, showing the latency to *each intermediate router* along the way. They are complementary tools.
Related articles
SOA Lookup: Your Guide to DNS Authority Records
SOA Lookup: Your Guide to DNS Authority Records
Unlock the secrets of DNS authority with our comprehensive SOA lookup guide. Learn how to find and interpret Start of Authority records for any domain.
Jun 2, 2026 · 14 min read
Read →
How to Get IP of DNS Name: A Complete Guide
How to Get IP of DNS Name: A Complete Guide
Wondering how to get the IP of a DNS name? Our comprehensive guide explains the process, tools, and why you need this information. Learn to resolve names to IPs easily.
Jun 2, 2026 · 16 min read
Read →
How to Get DNS Records: A Comprehensive Guide
How to Get DNS Records: A Comprehensive Guide
Learn how to get DNS records for any domain. Our guide covers various methods to view, find, and download all DNS records efficiently.
Jun 2, 2026 · 13 min read
Read →
What is Ping Rate? Your Guide to Fast Internet Speed
What is Ping Rate? Your Guide to Fast Internet Speed
Uncover the secrets of your ping rate! Learn what a good ping speed is, how it affects your online experience, and how to achieve a fast ping rate for gaming and browsing.
Jun 2, 2026 · 13 min read
Read →
IP6 Reverse Lookup: Unlocking IPv6 Address Insights
IP6 Reverse Lookup: Unlocking IPv6 Address Insights
Master IP6 reverse lookup! Learn how IPv6 reverse DNS works, why it's crucial, and how to perform lookups efficiently for network analysis and security.
Jun 1, 2026 · 15 min read
Read →
You May Also Like