Skip to content
Optimal Lab

Networking · interactive

traceroute: mapping the path

Every IP packet carries a TTL that each router decrements; at zero the packet is dropped and the router usually reports back. traceroute sends packets with TTL 1, 2, 3… so each router on the path reveals itself in turn.

$ traceroute example.com

  1. 1home-router (192.168.1.1)1.2 ms
  2. 2…
  3. 3…
  4. 4…
  5. 5…
  6. 6…
you

TTL=1 → ICMP Time Exceeded

TTL 1: each router decrements TTL; at home-router it hits 0, so the router drops it and sends back “time exceeded”, revealing itself. 1.2 ms.

TTL 1

Step 2 of 4

  1. 1

    TTL stops loops

    Every router subtracts one. At zero, the packet is dropped, so a routing loop can't circle forever.

    Called hop limit in IPv6.

  2. 2

    Raise TTL one at a time

    TTL 1 dies at the first router, TTL 2 at the second… Each sends back ICMP Time Exceeded with its address.

    Three probes per hop give three timings.

  3. 3

    Read the latency jumps

    A big jump between two hops is distance (an ocean) or congestion. Stars just mean a router doesn't reply.

    Later hops answering normally means stars aren't a problem.

  4. 4

    mtr for ongoing problems

    mtr repeats traceroute continuously and shows loss per hop, which is better for intermittent issues.

    mtr -rwc 100 example.com

In production

Tools and technologies

Path tools are the first step in debugging the network.

Not tied to one language — use these names when you search docs or design a system.