Sub topic 8
Tracing the path with tracert and traceroute
This chapter assumes you can run ping and read its replies, and that you know what an IP address, a router, and a default gateway are. Ping tells you whether a destination answers. A trace tells you which routers sit between you and that destination.
What a trace does
Every IP packet carries a Time to Live (TTL) value. Each router that forwards the packet subtracts 1. When the value reaches 0, the router drops the packet and sends back an ICMP Time Exceeded message. That message carries the router's own address.
Traceroute uses this on purpose. It sends probes with TTL 1, then 2, then 3, and so on. Each router along the path expires one probe and reveals itself. When a probe finally reaches the destination, the trace is complete.
Running it on Windows
tracert example.com
tracert -d -h 20 example.com-dskips reverse DNS lookups, so each line appears faster.-h 20limits the trace to 20 hops. The default is 30.
Running it on Linux and macOS
traceroute example.com
traceroute -n example.com
sudo traceroute -I example.comLinux and macOS send UDP probes by default. Windows sends ICMP echo requests. The -I option makes traceroute use ICMP echo like Windows does. On Linux this usually needs root. -n skips name lookups.
Reading the output
A typical Windows trace looks like this:
1 <1 ms <1 ms <1 ms 192.168.1.1
2 9 ms 8 ms 9 ms 10.20.0.1
3 * * * Request timed out.
4 22 ms 21 ms 23 ms 203.0.113.5
5 24 ms 25 ms 24 ms 93.184.216.34Each line is one hop. The three time columns are the round-trip times of three probes. The last column is the address of the router that answered. Hop 1 is normally your default gateway, which you can confirm with ipconfig.
The table lists the patterns you will see most often.
| Pattern | Likely meaning |
|---|---|
| Times rise steadily | Normal. Each hop is farther away. |
| One slow hop, later hops fast | That router is slow to answer probes aimed at itself. Traffic through it is fine. |
| Latency jumps and stays high | The delay starts at or just before that hop. A long link, such as an ocean crossing, is a common cause. |
| `*` on one hop, later hops answer | That router does not send Time Exceeded replies, or rate limits them. The path still works. |
| `*` on every hop from some point on | The path may break there, or a firewall may block the probes. |
| `Destination net unreachable` | A router has no route to the destination. The router that reports it is where to look. |
Locating a problem
- Find the last hop that answered normally.
- Look at the hop after it. The problem begins there or on the link between the two.
- Check whether later hops still respond. If they do, the silent hop is probably filtering, not failing.
Where the trace stops tells you whose problem it is. If it stops at hop 1, check your own gateway and local network. If it stops inside your provider's range, report it to the provider. If it dies at the last hop before the destination, the destination may simply block ICMP.
Exercise
A trace shows hop 4 with three asterisks, but hops 5 to 8 answer normally and the destination replies. Is hop 4 broken? Why or why not?
Show answer
No. Traffic passes through hop 4, because later hops answer. Hop 4 most likely does not return ICMP Time Exceeded messages or rate limits them. The asterisks only show that it will not identify itself.
Exercise
Why does traceroute increase the TTL by 1 for each round of probes?
Show answer
A probe with TTL n expires at the nth router, which then sends back an ICMP Time Exceeded message with its address. Raising TTL by 1 each round reveals the routers one at a time, in order, until a probe reaches the destination.