How the Internet Works
A packet, an address, a port, a phone book. Louis Pouzin invented the post office — the rest is sorting.
42 seconds · English captions included · 8.7 Mo
The 7 things you'll know how to do
Lesson 11: How the Internet Works
Regarde la leçon (42 s) : 1971, un Français invente le paquet qui voyage tout seul. Ensuite, tout le reste n'est que de l'adresse, des portes et un annuaire.
The address: four numbers, three dots
Écris `adresse(a, b, c, d)` : l'adresse IP en quatre nombres — `adresse(203, 113, 7, 42)` → `"203.113.7.42"`. Quatre octets, trois points, dans l'ordre.
Pouzin's datagram
Écris `datagramme(src, dst, donnees)` : le paquet complet — un Hash avec `"src"`, `"dst"` et `"data"`. Idée de Louis Pouzin en 1971 : tout le voyage est DANS le paquet.
Same address, another door
Écris `port(service)` : `"http"` → 80 · `"https"` → 443 · `"ssh"` → 22 · tout autre service → `nil`. Même machine, autre porte : c'est ça qui sépare le web du SSH.
The DNS phone book
Écris `resoudre(nom)` : le DNS — `"slopcourse.fr"` → `"203.113.7.42"` · `"42.fr"` → `"198.51.100.42"` · nom inconnu → `nil`. Tu tapes un nom, il te rend une adresse.
Catch the packet
Écris `attrape?(reseau, mon_port, dst, port)` : true SI `dst` commence par MON réseau (comme `"10.0.0."`) ET que le port du paquet vaut `mon_port`. Bon réseau + bonne porte — sinon tu laisses passer.
Lesson 11: OK
Sans aide : `joue(moi, paquet)` — 1) résous `moi` dans ce DNS : `"slopcourse.fr"` → `"203.113.7.42"`, `"42.fr"` → `"198.51.100.42"` · 2) mon réseau = les trois premiers chiffres + `"."` · 3) attrape si `paquet["dst"]` est sur mon réseau ET `paquet["port"] == 443`. Nom inconnu → `false`.
📄 The cheat sheet
print it, stick it on your monitor, pretend it was your idea📄 Cheat sheet — How the Internet Works (Pouzin & the datagram)
1971, Louis Pouzin invents the self-addressed packet. Since then, the Internet is just a giant, very well-sorted post office: an address, a door, a phone book.
The history, in three lines
| Year | What happened | What it brought |
|---|---|---|
| 1971 | Louis Pouzin (CYCLADES) invents the datagram | the autonomous packet: the whole trip is inside |
| 1974 | Cerf & Kahn (TCP/IP) build on it | the Inter-Net contract: best effort, no guaranteed route |
| today | billions of packets per second | your 4 ideas · address · port · DNS · sorting |
Pouzin: instead of building a circuit between two machines (the telephone), you cut into packets, address each one, and send. Each router does its local sorting. That's the founding gesture.
1. The IP address: a neighborhood, then a house
def adresse(a, b, c, d)
"#{a}.#{b}.#{c}.#{d}"
end
adresse(203, 113, 7, 42) # => "203.113.7.42"
# network = the first 3 octets here (our game's shortcut)
ip.split(".")[0..2].join(".") + "." # => "203.113.7."
The beginning says the network (the neighborhood), the end says the host (the house). Same street, other numbers.
2. The datagram: the complete envelope
def datagramme(src, dst, donnees)
{ "src" => src, "dst" => dst, "data" => donnees }
end
datagramme("10.0.0.1", "10.0.0.2", "ping")
# => {"src"=>"10.0.0.1", "dst"=>"10.0.0.2", "data"=>"ping"}
Sender, receiver, content: nothing to look up elsewhere. (That's Pouzin's idea.)
3. Doors: one address, several services
case service
when "http" then 80
when "https" then 443
when "ssh" then 22
else nil # unknown service: the door doesn't exist for us
end
One machine, several doors: the address gets you to the house, the port gets you to the room.
4. The DNS: the phone book
case nom
when "slopcourse.fr" then "203.113.7.42"
when "42.fr" then "198.51.100.42"
else nil
end
You type a name, it hands you a number. No magic: a case/when at world scale
(the real DNS are millions of lines of the same kind, arranged hierarchically).
5. The game: catch the packet
def attrape?(reseau, mon_port, dst, port)
dst.start_with?(reseau) && port == mon_port
end
attrape?("10.0.0.", 8080, "10.0.0.42", 8080) # => true
attrape?("10.0.0.", 8080, "192.168.1.5", 8080) # => false — other neighborhood
attrape?("10.0.0.", 8080, "10.0.0.42", 22) # => false — other door
Both conditions, always. One && — and half of Internet filtering lives there:
my network AND my port.
The full turn (what your router does, in one function)
# 1. DNS: name -> address 2. address -> network 3. packet: network + port == me ?
# 4. yes -> I catch 5. no -> I let pass (and someone else will catch it)
Never say again
"the Internet sends data down a tube"→ autonomous packets, each with its address"you need a permanent connection"→ Pouzin proved the opposite in 1971"the DNS is magic"→ a name → address directory; yours would fit in ten lines of Ruby
SlopCourse — from slop to clean code.