Internet packet routing
A Socratic walk-through of internet packet routing — reasoned out one step at a time, not lectured.
The question we started with
THE QUESTION #How can data reach the right destination when no machine controls the entire internet?
When you ask for a page in Tokyo from a laptop in Toronto, who decided the route? It is tempting to assume something somewhere holds a map of the whole internet. No such machine exists. So let us ask the harder question: what would a network need in order to deliver without anyone knowing the path?
Reasoning it through
REASONING #Shrink the problem. Suppose you are a single router and a packet lands on you carrying a destination address. What is the least you would need to know to be useful? Not the route — only which of my neighbours is closer to that destination. If your neighbour can answer the same question, the packet advances one hop at a time toward a place none of you can see.
Notice what that buys. A router's table does not list destinations; it lists prefixes — blocks of addresses — against a next hop, and picks the most specific block containing the address. So a million entries can steer traffic to billions of addresses.
But where do those tables come from, if no one is in charge? Routers tell each other. Networks under one administration advertise to their neighbours, using a protocol called BGP, which blocks they can reach and by what chain of networks — and each network applies its own policy about which offers to prefer. Nobody computes the global picture. When a link fails, adjacent routers withdraw those routes and their neighbours re-choose, which is why two packets of one conversation may take different paths, arrive out of order, or not arrive at all.
The analogy
THE ANALOGY #Picture a letter passed along by village postmasters, none of whom has ever seen a national map. Each reads the address, knows only which neighbouring village lies in roughly the right direction, and hands the letter on. The route is never planned; it is composed, hop by hop, out of small local judgements.
Postmasters would not gossip about the roads, and the internet's do — BGP is the part the image omits, and it is where the intelligence lives. Nor would a village discard a letter for going round in circles; a packet carries a hop counter, decremented at each router, and is dropped when it reaches zero.
Clarifying the model
THE MODEL #The misconception worth correcting is that a "connection" is a path reserved through the network. The path is held nowhere. Each packet is forwarded independently, and the sense of a steady connection is manufactured at the endpoints by TCP, which numbers packets and re-requests missing ones. The middle of the internet is deliberately simple and forgetful.
A picture of it
THE PICTURE #How to readStart at the top data shape — one packet, at one router. The two diamonds are the only decisions any router makes: is this packet still alive, and which known address block best matches it. Of the three labelled branches leaving the second diamond, only "the block is mine" ends the journey. The back-edge from the subroutine node to the top is the crucial part: the next router runs this identical chart, so the whole route is this one small decision, repeated.
What became clearer
WHAT CLEARED #Routing is emergent, not directed. No component holds the answer; it is produced by many routers each answering a much smaller question — "who is my best neighbour for this address block?" — while continuously telling each other what they can reach. The path exists only in retrospect.
Where to go next
ONWARD #- How BGP's reliance on trust has allowed route hijacks, and what RPKI tries to do about it.
- Why TCP's retransmission and ordering must live at the endpoints rather than in the routers.
- Why addresses are allocated in blocks, and how that keeps routing tables small enough to be useful.
Key terms
TERMS #| Term | What it means |
|---|---|
| Forwarding table | a router's list of address blocks paired with the next hop to use for each. |
| Longest-prefix match | the rule of choosing the most specific address block containing a destination. |
| BGP (Border Gateway Protocol) | how independently run networks advertise to each other which address blocks they can reach. |
| Hop limit (TTL) | a counter in each packet, decremented at every router, that discards packets caught in loops. |
Every term the collection defines is gathered in the glossary.