traceroute
Overview
The traceroute
command prints the route packets trace to a network host. It shows the path and measuring transit delays of packets.
Syntax
traceroute [options] host [packetlen]
Common Options
Option | Description |
---|---|
-4 |
IPv4 only |
-6 |
IPv6 only |
-f first_ttl |
Start from hop |
-m max_ttl |
Maximum hops |
-n |
Don’t resolve names |
-p port |
Destination port |
-w waittime |
Wait time for response |
-q nqueries |
Number of probes |
-I |
Use ICMP probes |
-T |
Use TCP probes |
-U |
Use UDP probes |
Key Use Cases
- Route discovery
- Network troubleshooting
- Latency analysis
- Path verification
- Network mapping
Examples with Explanations
Example 1: Basic Usage
traceroute google.com
Trace route to Google
Example 2: No DNS
traceroute -n 8.8.8.8
Numeric output only
Example 3: TCP Mode
traceroute -T -p 80 website.com
TCP traceroute to port 80
Understanding Output
Example output:
1 192.168.1.1 1.123 ms 0.893 ms 0.932 ms
2 10.0.0.1 5.342 ms 5.876 ms 5.123 ms
Components: - Hop number - Router address - Response times (3 probes)
Common Usage Patterns
Basic trace:
traceroute hostname
Maximum hops:
traceroute -m 15 hostname
Fast trace:
traceroute -n -q 1 hostname
Performance Analysis
- Path length
- Response times
- Packet loss
- Route stability
- Network bottlenecks
Additional Resources
Best Practices
- Use appropriate protocol
- Consider timeouts
- Document results
- Regular testing
- Compare paths
Troubleshooting
- Timeouts
- Path changes
- High latency
- Packet loss
- Route loops
Protocol Options
- UDP (default)
- ICMP
- TCP
- Custom ports
- Packet sizes