Code Safari

Chapter 106·Intermediate·10 min read

How Internet Routing Works: How a Packet Finds Its Way Across the World

How does a packet cross the planet in milliseconds? A plain-English explanation of internet routing — routers and hops, autonomous systems, how BGP stitches 70,000 networks into one internet, and why the internet has no map and no one in charge of the path.

August 4, 2026

By now your data is chopped into packets, each stamped with a destination IP address, and TCP is standing by to reassemble them reliably. One enormous question remains: how does a packet actually get from your laptop to a server on another continent, across a planet-spanning tangle of networks, in a few dozen milliseconds?

The answer is routing, and it works in a way that surprises most people: no one plans the journey. There is no map, no central controller, no master route. The path emerges from thousands of small, independent decisions — and understanding that is understanding the internet's deepest structural truth.

The core idea: local decisions, no map

A router is a specialised computer whose entire job is to receive packets and forward them toward their destination. But here's the key: a router doesn't know the full path to anywhere. It knows only one thing — for a given destination, which neighbouring router should I hand this to next?

Packet arrives at a router
Router: best next hop toward this IP?
Forward to that neighbour
Repeat until the destination’s network
Routing is a chain of local decisions — each router picks only the next hop.

Each packet travels as a series of hops — router to router to router — and at each one, a single local decision is made: "based on the destination address, my best next step is that neighbour." String enough of these together and the packet crosses the world, without any individual router ever having known the whole route. It's like getting directions by asking a local at every corner "which way to the station?" — nobody knows the entire path, yet everyone knows the next turn, and that's enough.

This is why the internet is so resilient (the theme from packet switching): if a router or link goes down, its neighbours simply start choosing a different next hop. The route reshapes itself around the failure, because it was never fixed to begin with.

The internet is a network of networks

To understand who those routers belong to, you have to see the internet's real structure. It is not one network. The word itself is the clue — inter-net, between networks. The internet is tens of thousands of separate, independently-operated networks that have agreed to interconnect.

Each of these is called an Autonomous System (AS) — a network under one organisation's control, with its own internal routing policy. Your ISP is an AS. So is Google, Cloudflare, your university, a big bank, a national telecom. There are roughly 70,000+ of them, each with a unique number.

BGP: how strangers agree to carry each other's traffic

The protocol that stitches all those autonomous systems into a single internet is BGP — the Border Gateway Protocol. It operates at the borders between networks, and its job is beautifully simple to state: it lets each AS announce to its neighbours which addresses it can reach.

A network essentially says to the ones it connects to: "I can deliver traffic for these blocks of IP addresses — send them my way." Its neighbours hear this, record it, and pass along refined versions to their neighbours. Through millions of these announcements rippling across the globe, every network builds up a picture of "to reach that block of addresses, hand packets toward this neighbour." Assemble all those pictures and you have the routes that move data across the planet.

Bank’s AS: "I own these IPs"
Its providers announce it onward
Announcements ripple across ASes
Every network learns a next hop toward the bank
BGP: networks announce reachability to neighbours, who propagate it onward.

Two things about BGP are worth sitting with:

  • It runs largely on trust. Historically, when a network announced "I can reach these addresses," neighbours mostly believed it. This makes the system flexible and decentralised — and occasionally fragile: a network that wrongly (or maliciously) announces addresses it doesn't own can pull huge swaths of traffic toward itself, a route hijack. Real outages have happened this way — a single bad announcement rippling out and blackholing popular services. (Security additions like RPKI are steadily hardening this.)
  • Policy, not just distance, picks routes. Networks choose paths based on business relationships and cost as much as hop count. The "best" route is often the cheapest or most contractually favourable one, not the geographically shortest — which is why your packets sometimes take surprising detours.

Seeing the path for yourself

This isn't abstract — you can watch it. The traceroute command (or tracert on Windows) sends packets to a destination and reports every router they pass through on the way:

traceroute example.com
 1  router.home        (192.168.1.1)      2 ms
 2  isp-gateway        (10.20.30.1)       9 ms
 3  isp-core           (72.14.x.x)       12 ms
 ...
 12 example.com        (93.184.216.34)   88 ms

Run it and you'll typically see 10–20 hops, and if you look up who owns each address, they cross several different companies' networks — your ISP, then one or more backbone carriers, then the destination's provider — exactly the autonomous-system hand-offs BGP arranged. You are watching a packet's real journey, one local decision at a time.

The profound part: nobody's in charge of the route

Here's the idea to carry away. When your data crosses the world, no single entity chose that path. It's the emergent product of:

  • Thousands of autonomous systems, each following its own policies,
  • Announcing routes to each other via BGP,
  • With every router making purely local next-hop decisions.

There is no master map of the internet, no central router all traffic flows through, no authority that plans your packet's journey. The route materialises from countless independent parties cooperating through shared protocols — and reshapes itself continuously as links fail, congestion shifts, and business deals change. It's less like a highway system with a transport ministry and more like a global ecosystem that happens to reliably deliver your data. That decentralisation is both the internet's great strength and, occasionally, its vulnerability — and it foreshadows the governance question we close on.

Recap

  • A router never knows the full path — it makes one local decision per packet: the best next hop toward the destination address. The route emerges hop by hop.
  • The internet is a network of networks: ~70,000+ independently-run autonomous systems (ISPs, companies, clouds), interconnected at their borders.
  • BGP stitches them together by letting each AS announce which addresses it can reach; neighbours propagate those announcements until everyone knows a next hop.
  • BGP runs largely on trust (hence route hijacks) and picks paths by policy and cost, not just distance — so packets take surprising routes.
  • traceroute reveals the real 10–20-hop journey across multiple companies' networks — and there's no master map or central authority planning it.

We've traced the logical journey end to end. But packets travel on something physical. Next: the cables, and the companies, that the whole internet actually runs on. Continue to The physical internet.

How Internet Routing Works: How a Packet Finds Its Way Across the World | Code Safari