traceroute ‐ #networking #troubleshooting - five4nets/Linux-Knowledgebase GitHub Wiki

Sure! Here's a complete Markdown tutorial for using the traceroute command on Linux:

🌐 Linux traceroute Command Tutorial

The traceroute command is a network diagnostic tool used to trace the path that packets take from your computer to a destination host. It helps identify network bottlenecks and connectivity issues.


📦 Installation

traceroute may not be installed by default. To install it:

Ubuntu/Debian:

sudo apt install traceroute

Red Hat/CentOS/Fedora:

sudo dnf install traceroute

Arch Linux:

sudo pacman -S traceroute

🧰 Basic Syntax

traceroute [options] destination
  • destination: Hostname or IP address
  • options: Modify behavior (e.g., max hops, timeout)

🔧 Common Options

Option Description
-n Do not resolve hostnames
-m Set max number of hops (default: 30)
-w Set timeout per probe (in seconds)
-q Number of queries per hop (default: 3)
-f Set initial TTL (Time To Live)
-p Set destination port
-I Use ICMP ECHO instead of UDP
-T Use TCP SYN packets
-4 / -6 Force IPv4 or IPv6

🧪 Examples

1. Basic Traceroute

traceroute google.com

2. Use IPv4 Only

traceroute -4 example.com

3. Use ICMP Instead of UDP

traceroute -I example.com

4. Limit to 10 Hops

traceroute -m 10 example.com

5. Increase Timeout to 5 Seconds

traceroute -w 5 example.com

6. Send 5 Probes Per Hop

traceroute -q 5 example.com

7. Start from TTL 5

traceroute -f 5 example.com

8. Disable DNS Resolution

traceroute -n example.com

📖 Sample Output

traceroute to google.com (142.250.72.14), 30 hops max
 1  192.168.1.1 (192.168.1.1)  1.123 ms  1.045 ms  1.012 ms
 2  10.0.0.1 (10.0.0.1)        5.234 ms  5.198 ms  5.176 ms
 3  * * *
 4  142.250.72.14             20.456 ms  20.401 ms  20.389 ms
  • * * * indicates a timeout or blocked ICMP response.

📚 References


🧠 Pro Tips

  • Use traceroute -T to mimic TCP traffic (useful for firewall testing).
  • Combine with ping to compare reachability vs. path latency.
  • Use -n for faster results when DNS resolution is unnecessary.

Happy tracing! 🛰️


Let me know if you'd like this saved as a file or adapted for a specific use case like firewall debugging or IPv6 testing!