Using Traceroute for Linux Network Troubleshooting

The traceroute command in Linux is an essential diagnostic utility used to map the journey packets take from a local system to a remote destination host. This article covers how traceroute functions, why it is vital for identifying latency and connection failures, the interpretation of its output, and the most common command-line options used during network troubleshooting.

What is the Traceroute Command?

traceroute tracks the route that data packets travel across an Internet Protocol (IP) network. When communication between a Linux host and a destination server fails or experiences severe degradation, traceroute identifies the exact path traversed, displaying every intermediary router (or "hop") along with the round-trip transit time for each.

How Traceroute Works

The utility operates by manipulating the Time-to-Live (TTL) field in the IP header of network packets:

  1. Initial Probe: traceroute sends packets with a TTL value set to 1. The first router that encounters the packet decrements the TTL to 0, drops the packet, and returns an ICMP Time Exceeded message back to the sender. This identifies the first hop.
  2. Incrementing TTL: The tool systematically increases the TTL value by 1 for each subsequent set of packets (TTL = 2, TTL = 3, etc.), mapping each consecutive router along the route.
  3. Completion: The process continues until the packets reach the destination host or exceed the maximum hop limit (default is typically 30 hops).

By default, the Linux implementation of traceroute sends UDP packets to high-numbered, unassigned ports, though it can also be configured to use ICMP or TCP probes.

Primary Use Cases in Network Troubleshooting

Network administrators rely on traceroute to diagnose several specific failure modes:

Basic Syntax and Common Options

The general syntax is straightforward:

traceroute [options] <destination_host_or_ip>

Key options for troubleshooting include:

Understanding the Output

A standard traceroute output displays a row for each hop containing:

If a hop displays asterisks (* * *), it means the router did not reply with an ICMP Time Exceeded message within the timeout period. This is often benign, resulting from routers configured to ignore low-priority ICMP generation, provided that subsequent hops continue to respond normally. However, if asterisks persist continuously until the trace times out, traffic is being dropped entirely at that point in the route.