Operations 10 min read

Master Traceroute: A Step‑by‑Step Guide to Network Path Diagnosis

This comprehensive guide explains how to use the traceroute (or tracert on Windows) command across Linux, macOS, and Windows, covering installation, basic syntax, advanced options, output analysis, common use cases, and troubleshooting tips for network diagnostics.

Raymond Ops
Raymond Ops
Raymond Ops
Master Traceroute: A Step‑by‑Step Guide to Network Path Diagnosis

How to Use the Traceroute Command

Traceroute (or tracert on Windows) is a powerful network diagnostic tool that shows each hop between your computer and a target address, along with round‑trip times.

Step 1: Open a Terminal or Command Prompt

On Linux/macOS: open the terminal application.

On Windows: open cmd or PowerShell.

Step 2: Syntax

The basic syntax is: traceroute [options] <target> On Windows the command is:

tracert [options] <target>
<target>

can be a domain name (e.g., example.com) or an IP address (e.g., 8.8.8.8).

Step 3: Run a Basic Traceroute

Linux/macOS: traceroute example.com Windows: tracert example.com This displays a list of intermediate nodes (hops) and the time each packet takes to reach them.

Step 4: Analyze the Output

Each line typically contains:

Hop number : the sequence of the router in the path.

Router IP or hostname : the address of the hop.

RTT : three round‑trip time values for the hop.

Example output:

1  192.168.1.1   1.123 ms  0.567 ms  0.456 ms
2  10.0.0.1      10.456 ms 9.876 ms 8.123 ms
3  93.184.216.34 30.567 ms 29.876 ms 28.123 ms
4  example.com   50.345 ms 48.567 ms 49.234 ms

If you see * * *, the packet was blocked or experienced high latency at that hop.

Step 5: Advanced Options

-m <max_hops>

: set the maximum number of hops (default 30). Example:

traceroute -m 20 example.com
-q <queries>

: set the number of probe packets per hop (default 3). Example:

traceroute -q 5 example.com
-I

: use ICMP packets instead of UDP. Example:

traceroute -I example.com
-T

: use TCP packets instead of UDP. Example:

traceroute -T example.com
-p <port>

: set the destination port for UDP packets (Linux/macOS only). Example: traceroute -p 8080 example.com Windows equivalents: -h <max_hops>: set maximum hops (e.g., tracert -h 15 example.com). -w <timeout>: set timeout in milliseconds (e.g., tracert -w 500 example.com). -d: disable hostname resolution, show only IP addresses (e.g., tracert -d example.com).

Step 6: Common Use Cases

Diagnosing network problems : identify where packets are delayed or lost. Example: traceroute example.com Performance analysis : measure latency at each hop to spot bottlenecks.

Bypassing firewalls : use -T (TCP) or -I (ICMP) to avoid filters that block UDP.

Testing specific ports (Linux/macOS):

traceroute -p 443 example.com

Step 7: Troubleshooting

If you see * * *, the router may be blocking traceroute packets or experiencing high latency. Try using -I (ICMP) or -T (TCP) to test other protocols.

If the command is not found, install it:

sudo apt install traceroute   # Debian/Ubuntu
sudo yum install traceroute   # Red Hat/CentOS

Tips

Combine with ping to test the stability of a specific hop: ping <hop_ip>.

Use mtr on Linux for real‑time combined traceroute and ping statistics: mtr example.com.

On Windows, pathping provides both traceroute and packet‑loss analysis: pathping example.com.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

tracerouteLinuxcommand-lineWindowsNetwork Diagnostics
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.