Traceroute Command on Linux with Examples

Traceroute Command on Linux

The traceroute command is a powerful network diagnostic tool in Linux that maps the journey of packets from the source computer to the destination host. It’s particularly useful for identifying the path and measuring the transit delays of packets across an IP network. This guide aims to provide a comprehensive understanding of the traceroute command, its options, and practical examples to leverage its full potential.

Introduction to Traceroute

The traceroute command is a network utility that traces the route an IP packet takes from the source host to the destination host. It works by sending packets with increasing Time-To-Live (TTL) values and monitoring the responses. By analyzing these responses, traceroute can map the network path and measure the transit time for each hop.

Understanding How Traceroute Works

The traceroute command operates by sending packets with TTL values starting from 1 and incrementing them for each probe. When a router receives a packet, it checks the TTL field. If the TTL field is 1, the router discards the packet and sends an ICMP error packet containing its IP address. This process allows traceroute to incrementally fetch the IP of all the routers between the source and the destination.

Syntax and Options

The basic syntax for the traceroute command is:

traceroute [options] host_Address [pathlength]
  • host_Address: The hostname or IP address of the target system you’re tracing the route to.

Some commonly used options include:

  • -4: Use IP version 4 (IPv4) to trace the route.
  • -6: Use IP version 6 (IPv6) to trace the route.
  • -F: Do not fragment the packet.
  • -f first_ttl: Start from the specified TTL value instead of 1.
  • -g gateway: Route the packet through the specified gateway.
  • -m max_ttl: Set the maximum number of hops for the packet to reach the destination. The default value is 30.
  • -n: Do not resolve IP addresses to their domain names.
  • -p port: Set the destination port to use. The default is 33434.
  • -q nqueries: Set the number of probes per hop. The default is 3.
  • --help: Display help messages and exit.

Practical Examples

Basic Tracing:


This command traces the route to, showing each hop and the time taken to reach it.

Using IPv4:

traceroute -4

This variant uses IPv4 to trace the route, which can be useful in certain network configurations.

Specifying Maximum Hops:

traceroute -m 20

Limits the trace to 20 hops, useful for focusing on a specific segment of the network path.

Changing Probe Packets:

traceroute -q 1

Sends only one probe packet per hop, speeding up the tracing process.

Skipping Initial Hops:

traceroute -f 5

Starts tracing from the 5th hop, useful when the initial part of the path is well-known or irrelevant.

Using TCP SYN Probes:

traceroute -T -p 80

Traces the route using TCP SYN packets to port 80, which can bypass certain types of network filters.

Advanced Usage

  • Combining Options: Advanced users can combine multiple options to tailor the trace to specific needs. For example, to trace using TCP SYN packets, skipping the first 2 hops, and limiting to 15 hops:
traceroute -T -f 3 -m 15
  • Analyzing Output: The output includes the hop number, IP address (or hostname if -n is not used), and the round-trip time for each probe. Asterisks (*) indicate lost packets or hops that didn’t respond within the timeout period.

Troubleshooting Tips

  • Slow Response Times: If you notice slow response times at a specific hop, it could indicate a bottleneck or congestion in the network. Consider rerouting traffic or contacting the network administrator responsible for that segment.
  • Packet Loss: Packet loss can occur due to network congestion, faulty hardware, or configuration issues. If you consistently see packet loss at a specific hop, investigate the cause and take appropriate action.
  • Firewall Issues: Some firewalls may block ICMP packets, causing traceroute to fail or provide inaccurate results. In such cases, try using TCP SYN probes (-T option) or consult the network administrator to resolve the issue.


The traceroute command is an indispensable tool for network diagnostics, offering insights into the path and performance of network traffic. By mastering its options and understanding its output, advanced users can diagnose complex network issues, identify bottlenecks, and optimize network performance. With the knowledge gained from this guide, you’re now well-equipped to leverage the traceroute command to its full potential and tackle various network-related challenges.


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button