How the OSI and TCP/IP models work
medium 40 minA network request is a message wrapped in headers, one per layer, like dolls inside dolls.
Remember it
The few things worth knowing cold, and how to make them stick.
Memory hook
Each layer talks to its twin, and only its twin reads its header.
Nesting dolls: a note in a blue doll (doors, TCP), in a red doll (towns, IP), in a green doll (next door, Ethernet). Max reads only the green tag, Sam swaps the green doll and lowers the steps, Lee opens them all.
Cheat sheet
- OSI
- physical, data link, network, transport, session, presentation, application
- TCP/IP
- link, internet, transport, application
- PDUs
- frame, packet, segment / datagram, message
- Headers
- Eth 14 + 4, IPv4 20, TCP 20, UDP 8
- MTU / MSS
- 1500 / 1460
- Min Ethernet frame
- 64 bytes
- Linux TTL
- 64
- Ephemeral ports
- 32768 to 60999
- RTO
- starts at 1 s, doubles
- EtherTypes
- IPv4 0x0800, ARP 0x0806, IPv6 0x86DD
Spot it when you see
- "Is it the network?"
- "L4 or L7?"
- "What happens when you type a URL?"
- Big transfers hang, small ones work.
Tricks that stick
- Bottom up: Please Do Not Throw Sausage Pizza Away (physical, data link, network, transport, session, presentation, application).
- Green, red, blue: next door, town, door.
- Refused is an answer; a timeout is silence.
- Ping proves ICMP, not your app.
Do not forget
- Saying a switch reads IP addresses.
- Thinking routers change IP addresses (only NAT does).
- Treating a working ping as proof that the app port is open.
- Forcing TLS, ARP or QUIC into exactly one OSI box.
- Forgetting the 4-byte Ethernet check and the 64-byte minimum.
- Blocking all ICMP and breaking path MTU discovery.