Skip to content
A-Line

Back to guides

How traceroute works, and how to read what it tells you

By Arthur De WittePublished Updated 11 min read

On this page

You type traceroute google.com and get a list of addresses with timings in milliseconds. Each line is a router between you and the server. Most explanations stop at “it sends packets with an increasing TTL”. This guide goes a bit further: how that trick works step by step, what every column in the output means, when the output misleads you, and a short routine for finding out where a slow connection actually goes wrong.

What traceroute is for

Traceroute shows the path your packets take to a destination, one router at a time. Van Jacobson wrote the original in 1987–88, after a suggestion from Steve Deering (Wikipedia). ping tells you whether a host is reachable. Traceroute tells you where along the way things slow down or stop.

That is the useful part when something is slow. It tells you whether the problem sits in your own network, at your internet provider, somewhere in transit, or at the destination, so you can contact the right party instead of guessing.

A way to picture it: you post a letter with a counter on it, and every post office that handles it lowers the counter by one. The post office where the counter reaches zero sends you a note saying “I had it”. Post enough letters with counters starting at 1, 2, 3 and so on, and you have heard from every post office on the route.

How TTL works

Every IP packet carries a Time to Live field. RFC 791 defined it in 1981 as an 8-bit number, and it hasn’t changed since (RFC 791). Each router lowers it by one before passing the packet on. When it reaches zero, the router drops the packet and sends back an ICMP Time Exceeded message (type 11, code 0).

TTL exists to stop routing loops. Without it, a misconfigured route could bounce a packet between two routers forever. The starting value depends on the system: Linux uses 64, Windows 128, and some network equipment 255.

The trick traceroute plays

Traceroute sends a packet with a TTL of 1. The first router lowers it to zero, drops it and reports back, so now you know that router’s address and how long the round trip took. The next packet gets a TTL of 2: the first router passes it on, the second one reports. That repeats until a packet reaches the destination.

The destination answers differently. On Linux and macOS, traceroute sends UDP packets to high port numbers (33434 and up). Nothing listens there, so the destination replies with Port Unreachable, and traceroute knows it has arrived. Windows tracert sends ICMP Echo Requests instead and gets an Echo Reply back.

By default traceroute sends three probes per TTL value and stops after 30 hops, so a full trace is at most 90 packets. Step through it below.

  1. Three routers you can't see yet

    Between your computer and 142.250.80.46 sit routers you don't know about. Traceroute is about to find them one by one.

  2. TTL 1: the first router answers

    The first packet may pass one router. Your home router lowers the TTL to zero, drops the packet and replies with Time Exceeded. That reply gives away its address, 192.168.1.1, and the round trip time.

  3. TTL 2: one router further

    The first router lowers the TTL from 2 to 1 and passes the packet on. The second router lowers it to zero and is the one that answers this time: 10.22.0.1, at your internet provider.

  4. TTL 3: into the wider internet

    Two routers pass the packet on, the third one answers. Every new TTL value reveals exactly one more router on the path.

  5. TTL 4: the destination answers

    This packet reaches the server itself. Nothing listens on the port it was sent to, so the server replies with Port Unreachable. Traceroute knows it has arrived and stops.

Terminal

$ traceroute 142.250.80.46
traceroute to 142.250.80.46, 30 hops max, 60 byte packets
 1  192.168.1.1     1.2 ms   1.1 ms   1.3 ms
 2  10.22.0.1      11.4 ms  12.1 ms  11.8 ms
 3  72.14.215.85   18.7 ms  19.2 ms  18.9 ms
 4  142.250.80.46  24.1 ms  23.8 ms  24.3 ms

Reading the output

Here is a typical trace to Google, starting from a network in Seattle. Every part of it is explained underneath.

Terminal

$ traceroute google.com
traceroute to google.com (142.250.80.46), 30 hops max
  1  gateway (192.168.1.1)  1.234 ms  1.120 ms  1.089 ms
  2  ae-1.r01.sttlwa01.us.bb.gin.ntt.net (129.250.2.11)  11.234 ms  12.891 ms  11.445 ms
  3  * * *
  4  108.170.245.65 (108.170.245.65)  18.432 ms  17.891 ms  18.112 ms
  5  lax17s55-in-f14.1e100.net (142.250.80.46)  24.112 ms  23.987 ms  24.234 ms

Point at a part of the output, or read the list below.

Hop number
The router's position on the route. Hop 1 is almost always your own router.
Hostname
The router's name, if it has one. Names often hide a location: sttlwa is Seattle, lax is Los Angeles, fra is Frankfurt.
IP address
The address that answered. Run traceroute with -n to skip the name lookups and get only these, which is a lot faster.
Three round trip times
One per probe. Three close values mean the timing is real. If two say 12 ms and one says 45 ms, that third one is a one-off.
Asterisks
This router didn't answer within the timeout. Hops 4 and 5 answer normally, so traffic clearly passes through it. It just doesn't reply to traceroute.

That last row is the one people misread most. Asterisks between two healthy hops mean “this router won’t talk to me”, not “this router is down”.

Running it on your system

Windows tracert sends ICMP Echo Requests by default, while traceroute on Linux and macOS sends UDP to port 33434 and up (Microsoft Learn). A firewall that blocks one may let the other through, so the same trace can look different from Windows and from Linux.

# Linux and macOS (UDP probes)
traceroute google.com

# Windows (ICMP probes)
tracert google.com

# ICMP on Linux (needs root)
sudo traceroute -I google.com

# TCP to port 443 on Linux (gets through most firewalls)
sudo traceroute -T -p 443 google.com

The flags you’ll actually use:

What Linux and macOS Windows What it does
No name lookups -n -d Skips reverse DNS, so output appears right away
Max hops -m 20 -h 20 Stops earlier than the default 30
Timeout -w 2 -w 2000 Wait per probe (seconds on Linux, milliseconds on Windows)
Probes per hop -q 1 not available One probe instead of three: faster, less reliable
ICMP -I default Sends ICMP Echo instead of UDP
TCP -T -p 443 not available Sends TCP SYN to port 443
Source -s 10.0.0.5 -S 10.0.0.5 Traces from a specific network interface

-n is worth remembering. A name lookup on every hop can add seconds per line, and when something is down you want the addresses now. Names can wait.

When a normal trace gives you nothing but asterisks, try TCP mode. traceroute -T -p 443 looks like the start of an HTTPS connection, and few firewalls block that, because blocking it would break the web.

When traceroute misleads you

Some output doesn’t mean what it seems to mean, and this catches experienced engineers too.

Slow routers that aren’t slow

Routers answer traceroute as a side job. Forwarding traffic comes first, and many operators limit ICMP replies to as few as one per second on busy routers (APNIC). So if hop 5 shows 150 ms and hop 6 shows 25 ms, hop 5 isn’t slow. It’s just in no hurry to answer you.

Load balancers that mix routes

Classic traceroute changes the UDP port for every probe. Load balancers that spread traffic over several equal paths (ECMP) use that port to decide which path a packet takes. Probes for the same hop can then travel different routes, and the trace stitches pieces of several paths together into one that doesn’t exist. Paris traceroute was built in 2007 to fix exactly that (Paris traceroute).

Routers that stay silent

Some routers block ICMP completely, others limit it. Both show up as asterisks. In cloud networks it is normal to see two or three silent hops in every trace, because the providers’ internal routers rarely answer. Treat silent hops as normal, unless every hop after them goes silent too.

Test your reading

Three traces. Decide for yourself whether each one shows a real problem, then open the answer.

The silent hop

1  192.168.1.1      2.1 ms   1.8 ms   2.3 ms
2  10.0.0.1        12.4 ms  11.8 ms  12.1 ms
3  *                *        *
4  72.14.215.85    19.2 ms  18.7 ms  19.5 ms
5  142.250.80.46   24.1 ms  23.8 ms  24.3 ms
Is this a real problem?

No. Hop 3 shows asterisks, but hops 4 and 5 carry on with steady, healthy times.

That router doesn’t answer traceroute, as a firewall policy. Traffic passes through it normally and the route is fine.

The latency spike

1  192.168.1.1      1.2 ms   1.1 ms   1.3 ms
2  10.0.0.1        11.4 ms  12.1 ms  11.8 ms
3  68.85.105.201  148.3 ms 147.9 ms 149.1 ms
4  72.14.215.85    19.5 ms  18.8 ms  19.2 ms
5  142.250.80.46   24.3 ms  23.7 ms  24.1 ms
Is this a real problem?

No. Hop 3 takes about 148 ms, but hop 4 is back at about 19 ms.

Hop 3 is limiting its ICMP replies. Packets still pass through it quickly, which hop 4’s low time proves. If hop 3 were really congested, hops 4 and 5 would be slow as well.

The jump that stays

1  192.168.1.1      1.2 ms   1.1 ms   1.3 ms
2  10.0.0.1        11.4 ms  12.1 ms  11.8 ms
3  68.85.105.201   89.3 ms  92.1 ms  88.7 ms
4  72.14.215.85    94.5 ms  91.8 ms  95.2 ms
5  142.250.80.46  102.3 ms  98.7 ms 101.1 ms
Is this a real problem?

Yes. The time jumps to about 90 ms at hop 3 and stays there through hops 4 and 5.

Something between hop 2 and hop 3 is congested. Run mtr against the destination for a few minutes to confirm it, then contact the provider that runs that part of the route.

The same openness that makes traceroute useful also lets anyone map a network’s insides. MITRE lists route enumeration with traceroute as attack pattern CAPEC-293, related to CWE-200, exposure of sensitive information (MITRE CAPEC). That is why many organisations block traceroute probes at their network edge, and why you’ll keep running into asterisks.

Paris traceroute, mtr and other variants

Paris traceroute keeps the flow identifier (source port, destination port and protocol) the same for every probe, so all probes for a hop follow the same path through load balancers (Kentik). Nearly every provider uses that kind of load balancing, so classic traceroute can show you a route that is half path A and half path B. Paris traceroute shows the one your traffic really takes.

mtr combines traceroute with continuous ping. Instead of three probes per hop it keeps probing and shows running numbers per hop: packet loss, average time, jitter, best and worst. Reach for it when a problem comes and goes. A single traceroute can catch a good moment; a minute of mtr catches the drops that happen every ten seconds.

TCP traceroute (tcptraceroute, or traceroute -T on Linux) sends TCP SYN packets instead of UDP or ICMP. Firewalls have to let TCP to ports 80 and 443 through for the web to work, so it often gets an answer where classic traceroute only gets asterisks.

Trippy puts traceroute, ping and a live view in one terminal app. It speaks ICMP, UDP and TCP, handles load-balanced paths, runs continuously like mtr, and adds per-hop charts, network owner (AS) lookups and rough locations. It runs on Linux, macOS and Windows.

Which one to use depends on what you’re looking for:

Variant Probes Load-balanced paths Keeps running Gets through firewalls Best for
Classic traceroute UDP or ICMP No No No A first look
Paris traceroute UDP, fixed flow Yes No No Routes through load balancers
mtr ICMP No Yes No Problems that come and go
TCP traceroute TCP SYN No No Yes Networks that block the rest
pathping (Windows) ICMP No For a set time No Loss per hop on Windows
Trippy ICMP, UDP or TCP Yes Yes Yes All of the above in one tool

Finding where a connection goes wrong

Traceroute shows where a problem is, not what it is. The routine below gets you to the right place quickly; finding the cause still takes more context.

  1. Run a baseline trace with traceroute -n <host>. The -n skips name lookups, so you get results right away.
  2. Find the transition point: the first hop where the time goes up and stays up for every hop after it.
  3. Rule out false alarms. A spike at one hop that drops back at the next is a router limiting its replies. Ignore it.
  4. Confirm with mtr. mtr -n -c 100 <host> sends 100 probes and shows loss per hop. A single traceroute can catch a good moment; a hundred probes won’t.
  5. Compare from elsewhere. Trace from another network if you can. If the problem only shows up from one place, it’s in the first hops: your network or your provider.

And a quick reference for the patterns you’ll see most:

  • Asterisks from hop 1 onwards. Your own firewall blocks outgoing traceroute. Try sudo traceroute -T -p 443 or sudo traceroute -I.
  • Asterisks at one hop, the trace continues. That router doesn’t answer traceroute. Nothing to fix.
  • A spike at one hop that recovers at the next. The router limits its replies. No real congestion.
  • A jump at one hop that stays up until the destination. Real congestion at or before that hop. Find out which provider runs it and contact them.
  • The same addresses repeating. A routing loop. Usually short-lived; if it lasts more than about five minutes, the provider upstream has a misconfiguration.
  • The trace is fine but the app is slow. The route isn’t the problem. Look at DNS, the TLS handshake or the server itself; curl -w gives you a timing breakdown.

Traceroute in the cloud

Inside cloud networks, traceroute shows much less. Providers run a software-defined network on top of the physical one, and it doesn’t lower the TTL the way ordinary routers do. That is deliberate: providers don’t want anyone, attackers included, mapping their internal network. What you’ll see:

  • Within one private network: one or two hops, even if traffic crosses several physical switches.
  • Between networks or regions: the points where traffic enters and leaves each network, nothing in between.
  • Through a CDN: the trace ends at the nearest edge location, not at the origin server.
  • In Kubernetes: traces between pods can show extra hops from the network plugin, such as Calico or Cilium, depending on how it is set up.

Where traceroute still earns its keep is the path between your users and the edge of the cloud. If customers in one country report a slow connection, a trace from their side shows whether traffic takes a sensible route or a detour through another continent. The problem is rarely inside the cloud; it is usually in the transit on the way there.

A-Line.cloud runs apps on Talos Linux, which has no SSH and no shell at all, so there is nothing on the servers themselves to run traceroute from. Knowing how to read a trace from the outside is the useful skill. For how a Kubernetes setup keeps a service reachable when parts of it fail, see highly available Discord bots.

Frequently asked questions

What is the difference between ping and traceroute?

ping checks whether one host answers and how long the round trip takes. Traceroute shows every router along the way and where time gets added. Use ping to see whether a host is up, and traceroute when ping is slow and you want to know which part of the route causes it. mtr does both continuously.

What do the asterisks mean?

A router didn’t answer within the timeout, usually because a firewall drops traceroute probes on purpose. If the hops before and after it look normal, traffic passes through just fine. Asterisks only point to a real problem when every hop after them stays silent or loses packets too.

Are tracert and traceroute the same thing?

They do the same job with a different default. Windows tracert sends ICMP Echo Requests; traceroute on Linux and macOS sends UDP to port 33434 and up. Firewalls that treat ICMP and UDP differently will give you different results. Both tools have flags to switch protocol.

What is mtr and how is it different?

mtr combines traceroute with continuous ping and updates its results live. Traceroute sends three probes per hop and stops; mtr keeps going and shows loss, average time and jitter per hop. That makes it better for problems that come and go. Install it with apt install mtr on Ubuntu or brew install mtr on macOS.

Can traceroute be used to attack a network?

It can be used to scout one. MITRE lists route enumeration as attack pattern CAPEC-293 (MITRE CAPEC): attackers use traceroute to map a network’s layout and find its firewalls. That is why careful organisations block Time Exceeded replies and UDP probes at their edge.

Try it on a real connection

Step through the demo above once more, then open a terminal and run mtr google.com. Read the times hop by hop, and remember that a slow hop only matters if the hops after it are slow too. You’ll see everything from this guide happen live.