9 min
  • TCP/IP
  • Routing
  • Topology

Routing: how a packet finds its way

There is no map of the Internet, and no machine anywhere holds the route your packet will take. Each router knows only which of its links leads closer to a given block of addresses, and forwards accordingly. The path is what emerges.

That has a strange consequence worth sitting with: the packet does not know where it is, the sender does not know the route, and the route may differ from the one the reply takes. Every hop is a fresh decision by a machine with no memory of the one before it.

Loading the Network Map simulation…

The Internet is a graph of networks, not routers

Zoom out and the units stop being machines. The Internet is roughly a hundred thousand

autonomous systems — an ISP, a university, a large company — each running whatever it likes internally and announcing to its neighbours which addresses it can reach. That announcement protocol is BGP.

Two networks that exchange traffic directly are peering; a network that pays somebody to reach everywhere else is buying transit. Those commercial choices, not geography, decide the shape of the graph — which is why a CDN edge can be one hop away and a server on the next continent fifteen.

Traffic goes viaBecauseWhat you can measure
A peerFree, direct, usually shortLow latency, few AS hops
A transit providerPaid, but reaches everythingLonger paths, more hops
Check yourself
Who decides the full route your packet takes from Singapore to Frankfurt?

What one packet experiences

Down at the level of a single packet, each hop does the same small set of things: check the header, decrement the TTL, rewrite the link-layer addresses for the next link, and forward. The IP addresses on the packet never change; the hardware addresses change every single hop.

Watch one make the crossing, and watch the TTL count down as it goes:

Loading the Packet Journey simulation…
Predict what happens next
You measure the path out to a server as eight hops. How many hops will the reply take coming back?

Key takeaways

  • No machine holds the route. A path is the emergent result of one independent decision per router.
  • The unit of Internet structure is the autonomous system, not the router, and BGP is how those units tell each other what they can reach.
  • Peering and transit are commercial relationships, and they shape the topology more than distance does.
  • IP addresses survive every hop; link-layer addresses are rewritten at every one of them.
  • The return path is routed independently and is often different, which is why one-way faults exist at all.

Take it further