What is Traceroute

Traceroute is a Linux network troubleshooting tool used by system administrators to identify the route a data packet takes between a computer and a certain host, server, or website. Traceroute simply sends packets across the network path, which clearly reveals every hop throughout the journey, which helps administrators locate network issues, track latency, and learn how the data moves across the internet.

The traceroute command is available on most operating systems, including Ubuntu, Debian, and other Linux distributions. It is one of the most widely used diagnostic tools.

What’s interesting about traceroute is that it’s quite different from the ping command. The ping command only checks if a connection to a destination exists and measures the round-trip. Traceroute, on the other hand, shows every hop between a router or device, measures response delays, and performance issues.

Traceroute is especially useful when working with an internet service provider (ISP) or diagnosing slow or unstable connections.

See Also: How to Use MTR on Linux

How Traceroute Works

When you run Traceroute, the tool sends three packets or three probes toward the host, using Time to Live (TTL) values. Whenever a TTL expires, the router returns an ICMP message, which allows the utility to record the IP address, response time, and hop number for any particular hop. This process continues until the final destination host responds or the maximum number of predefined hops has been reached.

When you’re looking at the output, a single line represents a single hop. There are three measurements showing the round-trip time for each of the probes. By default, there are 30 hops max.

As packets pass through several devices, traceroute works by revealing how IP packets travel from the first router, through the first hop, and across different paths before reaching the host.

Note: Some Debian systems provide inetutils-traceroute as an alternative implementation.

How to Install Traceroute on Debian

Installing the traceroute package on a Debian-based Linux system only takes a few moments. The utility is available through the default package repositories, which means you don’t need an external source to get it downloaded. This makes the installation very quick.

Update your package list with ‘apt update‘ first:

apt update

Then run ‘sudo apt install traceroute -y‘ to install. Press Enter.

sudo apt install traceroute -y
sudo apt install traceroute

When ready, verify the installation by checking the version with ‘traceroute –version‘.

traceroute --version
traceroute --version

If the installation was successful, your computer is ready to run traceroute against any host, domain, website, server, or IP address.

Once installed, the utility can help you identify network issues, analyze route changes, measure latency, and troubleshoot connection problems across the internet. The output provides detailed information about each hop, making it easier to pinpoint routing problems between your system and the destination.

Best Traceroute Practical Examples

Once Traceroute is installed on your Debian server, you can use it to analyze the behavior, troubleshoot connectivity problems, and measure network performance.

We’ve prepared examples of some of the most commonly used commands:

Trace the Route to a Website

The simplest way to use Traceroute is by tracing the path to a website or domain. Here’s the basic syntax:

traceroute servermania.com

This command displays every hop between your computer and the remote host. The traceroute results include the hop number, IP address, hostname when available, and three measurements showing the round-trip time for each probe. This makes it easy to determine where response delays begin or whether traffic follows unexpected, different paths.

traceroute servermania.com

Note: Asterisks in results indicate a hop did not respond. Each number represents one hop.

Trace a Route to an IP Address

You can also trace traffic directly to an IP address instead of a domain name via the following command:

traceroute 8.8.8.8

Note: 8.8.8.8 is Google’s DNS.

traceroute 8.8.8.8

This example skips DNS lookups and traces the route directly to Google’s public DNS server. It is useful when verifying connection problems or confirming whether data reaches the destination host without any potential DNS-related issues.

See Also: How to Test Server Network Speed on Linux

Limit the Max Number of Hops

Sometimes you only want to inspect the first few hops in your local network or nearby infrastructure:

traceroute -m 10 servermania.com

The -m option sets the maximum number of hops Traceroute will examine. Instead of the default 30 hops max, this example stops after ten hops. This is useful when checking the first router, first hop, or nearby routing devices without tracing the entire path.

traceroute -m 10 servermania.com

See Also: How to Measure Network Throughput on Linux

Traceroute Command List

The traceroute command supports a variety of options for network troubleshooting. The examples below cover the most commonly used commands on Debian and other Linux distributions:

Command:Description:
traceroute <host>Performs a standard trace to a host, domain, website, or IP address and displays the route from your computer to the destination.
traceroute -n <host>Disables DNS lookups and displays only numerical IP address values. Using the -n option speeds up traceroute results.
traceroute -I <host>Sends ICMP packets instead of the default UDP packets. Useful when routers or firewalls block standard Traceroute traffic.
traceroute -T <host>Uses TCP SYN packets instead of UDP. This option helps trace routes through networks that filter UDP traffic.
traceroute -m <number> <host>The -m parameter allows you to set the maximum number of hops to trace before stopping.
traceroute -f <number> <host>Starts tracing from a specified hop instead of beginning with the first hop.
traceroute -q <number> <host>Changes the number of three probes sent per hop. For example, -q 1 sends only one probe.
traceroute -w <seconds> <host>Specifies how long Traceroute waits for a reply before timing out.
traceroute -p <port> <host>Uses a specific destination UDP or TCP port during the trace. Useful for testing firewall rules.
traceroute -s <ip-address> <host>Specifies the source IP address for outgoing probes on systems with multiple network interfaces.
traceroute -i <interface> <host>Sends probes through a specific network interface instead of the default one.
traceroute -A <host>Displays Autonomous System (AS) numbers for each responding router when available.
traceroute -F <host>Sets the Don’t Fragment (DF) bit on outgoing packets, helping diagnose MTU-related network issues.
traceroute -U <host>Uses UDP explicitly, even if another protocol is the default on your system.
traceroute –helpDisplays all available command-line options supported by the installed traceroute package.
man tracerouteOpens the complete Traceroute manual with detailed explanations and examples for every available option.

When reviewing the output, pay attention to increasing response time, repeated timeouts, or unexpected routing changes. These patterns often indicate latency, congestion, firewall restrictions, or other network issues affecting the connection between your computer and the destination host.

See Also: How to Perform Traceroute in Linux

Traceroute: Frequently Asked Questions

Is Traceroute the same as the tracert command?

No. The tracert command is the Windows equivalent of Traceroute, while Linux uses the traceroute utility. So, both tools perform the same function but are executed from a command prompt or terminal using different commands.

What does each hop in Traceroute mean?

Each hop represents a router or network device that your traffic passes through before reaching the destination. The time shown indicates how long each hop takes, helping you identify where delays occur as data makes its way across the network.

Why does Traceroute display asterisks (*)?

Asterisks usually mean a router did not respond before the timeout expired. This does not always indicate an error, since many routers intentionally ignore Traceroute probes for security reasons.

Can Traceroute help troubleshoot connection problems?

Yes. Traceroute helps determine where a connection slows down or fails, making it easier to connect routing problems with a specific network segment or device.

Is Traceroute safe to use on a production server’s local network?

Yes. Traceroute sends a small number of probe packets and does not modify your system or network configuration. It is a standard diagnostic utility used by administrators to troubleshoot connectivity while maintaining normal security practices.