FormatArticle
Reading time12 min read
Published
ByReference
Demonstration piece

How a message crosses the internet

There is no route planned in advance and no single machine in charge. A packet is passed from stranger to stranger until it arrives, or does not.

Network of nodes with one path through it drawn in turquoise
One path through the graph. It may not be the same path a second later.

The surprising thing about the internet is not that it is fast. It is that nothing in it knows the whole picture. No machine holds a map of the network, no authority assigns routes, and the two computers at either end of a conversation have no idea what lies between them. A message gets across because a few thousand independently operated networks have agreed on a very small set of rules about how to pass things along.

Cut it into packets

The first rule is that nothing travels whole. A message is chopped into packets, each carrying a destination address and its position in the sequence. Packets from one conversation may take different routes and arrive out of order or not at all — the receiving machine reassembles what turned up and asks for whatever is missing.

Pass it to someone closer

A router does not know where your packet is going. It knows which of its neighbours is generally in the right direction for that block of addresses, and it hands the packet over. The neighbour does the same. This repeats, typically ten to twenty times, until a router is finally connected to the destination network itself.

Those "generally in the right direction" tables are built by networks continuously telling each other which addresses they can reach, using the Border Gateway Protocol. BGP is closer to gossip than to a map: it is a system of assertions between commercial operators, which is why a mistaken announcement in one country can briefly pull a chunk of the world's traffic through it.

What each layer is responsible for
  1. Wire or radio
  2. Local network
  3. IP — addressing
  4. TCP — reliability
  5. HTTP — meaning

Each one assumes the layer below it mostly works, and cleans up when it does not.

Make it look reliable

On top of that unreliable delivery service sits TCP, which numbers packets, acknowledges what arrived, retransmits what did not, and slows down when the network shows signs of congestion. Everything you experience as a connection — a page loading, a call staying up — is this bookkeeping, running at both ends and nowhere in the middle.

  1. Step 1Name to addressDNS turns a hostname into an IP address, usually by asking a resolver that already knows.
  2. Step 2HandshakeThe two machines agree to talk, and increasingly agree on encryption at the same time.
  3. Step 3Packets outThe request is split, addressed and released into the network.
  4. Step 4HopsTen to twenty routers each make a local decision about where next.
  5. Step 5ReassemblyThe far end puts the pieces in order, asks for anything missing, and answers.

The design decision underneath all of this is the same one that makes a logic gate useful: keep each layer stupid and dependable, and let the layer above assume it works. The network promises very little. Everything else is built on top of that small promise.

This piece skips NAT, IPv6 and the modern reality that a large share of traffic never leaves a handful of private backbones. Each deserves its own piece.

Sources & further reading3
  • RFC 791: Internet ProtocolIETF, 1981
  • RFC 793: Transmission Control ProtocolIETF, 1981
  • Computer Networks: A Systems ApproachLarry Peterson and Bruce DavieStandard textbook treatment of routing and congestion control.

Tags