Linux traceroute Command — Discovering Network Paths and Troubleshooting Routing¶
tracerouteis a Linux networking utility used to discover the path that network packets take from a source to a destination. It identifies every router (hop) along the route and measures the time required to reach each hop.tracerouteis one of the most valuable tools for diagnosing routing issues, network latency, packet loss, ISP problems, cloud connectivity, VPN routing, and Internet reachability. Every Linux administrator, DevOps engineer, Cloud Architect, Platform Engineer, Site Reliability Engineer (SRE), and Network Engineer should master thetraceroutecommand.
Learning Path¶
Course Progress
What You'll Learn¶
After completing this lesson, you'll be able to:
- Understand
traceroute - Learn how packet forwarding works
- Understand Time To Live (TTL)
- Discover hop-by-hop network paths
- Measure network latency
- Troubleshoot routing problems
- Analyse enterprise and cloud connectivity
Prerequisites¶
Complete:
Basic understanding of:
- IP Routing
- Routers
- Internet Control Message Protocol (ICMP)
- TTL
Why Learn traceroute?¶
Imagine users report:
- Website Not Reachable
- VPN Not Working
- High Network Latency
- Cloud Connectivity Problems
- Slow Internet Access
Ping only tells you:
It does not tell you:
- Where packets stop
- Which router is slow
- Which network is failing
That's where:
becomes invaluable.
What is traceroute?¶
traceroute discovers:
It also measures:
- Hop Count
- Round Trip Time (RTT)
- Network Delay
How Does traceroute Work?¶
traceroute relies on:
Each packet contains a TTL value.
Every router:
When TTL reaches:
The router discards the packet and returns an:
message.
By gradually increasing the TTL value, traceroute discovers every hop along the path.
Packet Flow¶
Example:
traceroute identifies each router individually.
Basic Syntax¶
Example:
Install traceroute¶
Ubuntu/Debian
RHEL/CentOS
Trace by Hostname¶
Example output:
Trace by IP Address¶
Numeric Output¶
Disable Domain Name System (DNS) lookups.
Benefits:
- Faster Execution
- Easier Troubleshooting
Limit Maximum Hops¶
Limits tracing to ten hops.
Change Initial TTL¶
Starts tracing from hop 5.
Useful for troubleshooting long network paths.
Change Number of Probes¶
Default:
Example:
Sends five probes per hop.
Set Wait Time¶
Waits two seconds for each reply.
Use ICMP Instead of UDP¶
Some Linux implementations default to User Datagram Protocol (UDP) probes.
To use ICMP:
Useful when UDP traffic is filtered.
Use TCP Probes¶
Some firewalls block UDP and ICMP.
Use Transmission Control Protocol (TCP) probes:
This can provide more accurate results in restrictive environments.
Understanding Output¶
Example:
Columns:
- Hop Number
- Router Address
- Response Time
What Does * * * Mean?¶
Example:
Possible reasons:
- Firewall Blocking ICMP
- Router Configured Not to Respond
- Packet Loss
- Network Congestion
It does not always indicate that traffic cannot continue beyond that hop.
Measuring Latency¶
Example:
Large increases in latency may indicate:
- Congestion
- Long-Distance Links
- Overloaded Routers
Routing Problem Example¶
Packets stop at:
traceroute helps identify where the path fails.
Enterprise Example¶
User cannot reach:
Administrator runs:
Finds:
Problem identified quickly.
VPN Troubleshooting¶
Use:
to verify whether traffic enters the VPN tunnel correctly.
Cloud Perspective¶
Cloud engineers use traceroute to troubleshoot:
- Hybrid Connectivity
- VPN
- Cloud Interconnect
- Load Balancers
- Internet Gateways
- Regional Connectivity
Kubernetes Perspective¶
Use traceroute from:
- Worker Nodes
- Bastion Hosts
- Pods (where available)
to verify:
- Service Reachability
- External Connectivity
- Ingress Paths
- Hybrid Cloud Networking
Some minimal container images may not include traceroute by default.
Linux Perspective¶
Trace a destination.
Numeric output.
Use ICMP.
Use TCP.
traceroute Workflow¶
Each hop returns its response time.
Common traceroute Commands¶
| Command | Purpose |
|---|---|
traceroute host | Trace route to host |
traceroute IP | Trace route to IP address |
traceroute -n | Numeric output |
traceroute -I | Use ICMP probes |
traceroute -T | Use TCP probes |
traceroute -m | Maximum hops |
traceroute -q | Number of probes |
traceroute -w | Wait timeout |
Hands-on Lab¶
Task 1¶
Trace route to Google DNS.
Task 2¶
Trace using a hostname.
Task 3¶
Disable DNS lookups.
Task 4¶
Trace using ICMP.
Task 5¶
Trace using TCP.
Task 6¶
Limit to 10 hops.
Task 7¶
Trace the route to a cloud virtual machine or internal server and compare the path with an Internet destination.
Task 8¶
Create a troubleshooting checklist using:
pingtracerouteip routesstcpdump
Production Troubleshooting¶
Problem:
Step 1
↓
Reachable?
↓
No
↓
Run:
↓
Identify:
- Last Reachable Router
- High Latency Hop
- Routing Loop
- Packet Drop
↓
Investigate:
- Router
- Firewall
- ISP
- VPN
traceroute vs ping¶
| ping | traceroute |
|---|---|
| Tests Reachability | Discovers Network Path |
| Measures RTT | Measures RTT Per Hop |
| No Routing Information | Displays Every Hop |
| Simple Connectivity Test | Advanced Routing Diagnostics |
Common Mistakes¶
❌ Assuming * * * always indicates failure.
✅ Some routers intentionally ignore traceroute probes.
❌ Forgetting DNS resolution delays.
✅ Use -n for numeric output.
❌ Using only UDP probes.
✅ Try ICMP or TCP if traffic is filtered.
❌ Ignoring latency spikes.
✅ Compare response times across hops.
❌ Relying only on traceroute.
✅ Combine with ping, tcpdump, and routing information.
Best Practices¶
- Use numeric output during troubleshooting.
- Compare traceroute results from multiple locations.
- Combine traceroute with
pingandtcpdump. - Investigate sudden latency increases.
- Document normal routing paths for production systems.
- Verify firewall policies when traceroute fails.
- Test both IPv4 and IPv6 connectivity where applicable.
Interview Questions¶
Beginner¶
- What is
traceroute? - What is TTL?
- How does
traceroutediscover routers? - What does
* * *mean in traceroute output?
Intermediate¶
- Compare
pingandtraceroute. - Why would you use TCP probes instead of UDP?
- How do you troubleshoot high latency using
traceroute? - Why does each hop return an ICMP Time Exceeded message?
Architect Level¶
- Explain how you would troubleshoot a hybrid cloud routing problem using
traceroute. - Design a network troubleshooting workflow using
ping,traceroute, andtcpdump. - How would you investigate intermittent routing failures between two data centres?
Summary¶
In this lesson, you learned:
- The
traceroutecommand - Time To Live (TTL)
- Hop-by-Hop Path Discovery
- Network Latency Analysis
- Routing Troubleshooting
- ICMP Responses
- Enterprise Connectivity Diagnostics
traceroute is one of the most valuable network troubleshooting tools available on Linux. By revealing every hop between a source and destination, it helps engineers identify routing problems, measure latency, locate network bottlenecks, and troubleshoot connectivity across enterprise, cloud, VPN, and Internet environments.
Key Takeaways¶
traceroutediscovers the path packets take across a network.- It works by increasing the TTL value of probe packets.
- Each router returns an ICMP Time Exceeded message when the TTL expires.
- Use
-nfor faster numeric output. - Use
-Ifor ICMP probes and-Tfor TCP probes when needed. traceroutecomplementspingby showing where connectivity problems occur.
What's Next?¶
dig (Domain Information Groper)
In the next lesson, you'll learn about dig (Domain Information Groper).
You'll explore:
- What
digis - DNS Queries
- DNS Record Types
- Authoritative vs Recursive DNS
- Reverse DNS Lookups
- DNS Troubleshooting
- Production DNS Diagnostics
By the end of the lesson, you'll be able to query DNS servers, inspect DNS records, troubleshoot name resolution issues, and diagnose DNS-related problems in enterprise, cloud, and Kubernetes environments.