Watch on Instagram

Network Bytes · Episode 70 · CCNA 3.0

"Traceroute: mapping the path"

Every IP packet carries a time to live (TTL) that each router lowers by one, and a router that takes it to zero drops the packet and sends back ICMP time exceeded. Traceroute uses that on purpose, sending probes with a TTL of 1, then 2, and so on, to list every hop on the path and its delay.

Posted · About a 1 minute watch, 4 minute read · Take the quiz

Ping vs traceroute

Ping answers one question: can I reach that address, yes or no (and how long did the round trip take)? When the answer is no, ping cannot tell you where things went wrong. Traceroute (traceroute on Cisco IOS, Linux and macOS, tracert on Windows) lists every router, or hop, between you and the destination, like breadcrumbs along a trail, so you can see how far your traffic gets.

Time to live: a countdown in every packet

Every IPv4 packet has a time to live (TTL) field in its header. Each router that forwards the packet takes one off. If a router takes the TTL to zero, it does not forward the packet: it drops it and sends an ICMP Time Exceeded message (type 11) back to the sender. This exists so that a packet caught in a routing loop does not circle forever. IPv6 does the same job with a field called the hop limit.

How traceroute uses TTL on purpose

Traceroute turns that safety feature into a map:

  • It sends a probe with a TTL of 1. The first router lowers it to zero and replies with time exceeded, so now you know hop 1.
  • Then it sends a probe with a TTL of 2. The first router lowers it to 1 and forwards it; the second router lowers it to zero and replies. Now you know hop 2.
  • It keeps raising the TTL by one each round, until the destination itself replies.

Each round usually sends three probes, which is why you see three times per line. Cisco IOS and Linux traceroute send UDP probes to high port numbers (starting at 33434), and the destination answers with ICMP Port Unreachable. Windows tracert sends ICMP echo requests, and the destination answers with an echo reply.

Reading the output

Each line is one hop: its number, the router's address and the delay for each probe. Delay that suddenly jumps at one hop and stays high afterwards points to a slow link around there. A line of **stars ( )* means no reply arrived before the timeout. That could be the trouble spot, but many routers simply drop or rate-limit the ICMP messages traceroute relies on. If hops after the starred one still answer, the quiet router is passing traffic fine and is usually not the fault.

Try it yourself

Open a terminal or Command Prompt and trace the path to a big website: tracert example.com on Windows, or traceroute example.com on macOS or Linux. Count the hops, and look for the line where the delay jumps from a few milliseconds (your home or office network) to tens of milliseconds (your provider and beyond). Run it again a few minutes later and see whether the path or the delays change.

Good to know

  • Traceroute shows the path the probes took this time; the return path and later packets can take different routes.
  • A starred hop with later hops still answering is usually just a router that does not reply to traceroute, not a broken router.
  • If the stars continue all the way to the end, the traffic (or the replies) are stopped at or after the last hop that answered; a firewall blocking the probes can look the same.
  • The terminal rows in the video (2 ms, 9 ms, *) and the address 203.0.113.9 (a documentation range) are illustrative.
  • "Breadcrumbs along a trail" is our analogy.

For CCNA learners

Traceroute is a core troubleshooting tool for verifying the path that traffic takes, alongside ping and the routing table (CCNA 200-301 domain 3.0, IP Connectivity). Know that each router decrements the TTL, that a TTL of zero triggers ICMP Time Exceeded (type 11), that traceroute raises the TTL by one per round, and the IOS and Windows probe differences (UDP to high ports vs ICMP echo).

Answer to the comment question

The third router on the path. The probe leaves with a TTL of 3. Router 1 lowers it to 2 and forwards it, router 2 lowers it to 1 and forwards it, and router 3 lowers it to 0, so router 3 drops the probe and sends back time exceeded. That is exactly how traceroute discovers hop 3.

Test your knowledge

Quick quiz: "Traceroute: mapping the path"

4 multiple-choice questions. Pick one answer for each, then check how you did.

1What does each router do to a packet's time to live (TTL)?
2A router takes a packet's TTL to zero. What happens?
3Why does traceroute send its first probe with a TTL of 1?
4A traceroute shows * at hop 4, but hops 5 to 8 answer normally. What is most likely?

Sources

Video transcript

Where exactly does your traffic stop?

Ping says yes or no. Traceroute shows the whole path, router by router, like breadcrumbs along a trail.

Every packet carries a countdown called time to live. Each router takes one off. At zero, the router drops it and sends back: time exceeded.

Traceroute uses that on purpose. It sends a probe with a time to live of one, so the first router answers. Then two, so the second router answers, and so on, until the destination replies.

Each line is one hop and its delay. Stars mean no answer: maybe the trouble spot, or just a quiet router.

A probe leaves with a time to live of three. Which router sends back time exceeded? Comment your answer below!

That's your byte.

More from Network Bytes

All Network Bytes lessons