Machine Room

Machine Room · 24 Oct 2026 · 8:57

The OSI Model, Explained With One WhatsApp 'Hi' Through All 7 Layers

Watch on YouTube

The OSI model splits networking into seven layers, and every layer wraps the data in its own header. This episode follows one real packet down, across and back up those layers: a WhatsApp "Hi", two bytes of text that leave the phone wrapped in headers many times their size.

Down the stack on the phone: layer 7 is the app writing the message, layer 6 is encryption (WhatsApp locks it twice: end-to-end so only your friend can open "Hi", and a transport lock, Noise Pipes, that only WhatsApp's server can open, which hides who you are messaging), layer 5 tracks the conversation, layer 4 is TCP (port and sequence number), layer 3 is IP (your phone's address and the server's, never your friend's), layer 2 is Wi-Fi (MAC addresses for the next stop only, plus a CRC check number), layer 1 is radio waves. Across the internet: the home router swaps the private address for the home's public one (NAT), and eight routers on this trip each strip layer 2, read the IP address, lower the TTL counter and wrap a new layer 2. Back up at the server, each layer removes its own header, the server forwards the still-locked "Hi", and only your friend's phone opens lock one. Then the same seven layers as a troubleshooting checklist when a message won't send.

Measured on our own connection: a packet capture of a real "Hi" from WhatsApp Desktop (IPv4 header 20 bytes, TCP header 32 bytes with timestamps, TTL 64 on the way out) and a traceroute to WhatsApp's chat server (8 routers from Mumbai). The encrypted parts are shown without a size on purpose: they are not readable on the wire. The real internet runs the simpler TCP/IP model, which has no separate headers for layers 5 and 6; the OSI model is the map used to learn and debug it.

This episode with chapters, full transcript and sources: https://themachineroom.dev/v/osi-one-packet/?utm_source=youtube&utm_medium=description&utm_campaign=osi-one-packet

Chapters

  1. 0:00One Packet: headers and the OSI model
  2. 1:02Layers 7, 6, 5: the app, encryption and session
  3. 2:14Layers 4, 3: TCP ports and IP addresses
  4. 3:14Layers 2, 1: MAC addresses and radio waves
  5. 4:19Across: routers, NAT and TTL
  6. 5:50Back Up: unwrapping at WhatsApp's server
  7. 7:45Which Layer Broke: troubleshooting with the OSI model

Sources

Previous episode, how Starlink routes a web page through satellites: https://youtu.be/aEokWFY_WxU

Get the next one by email

One email per video, with the sources. No newsletter padding, no selling the list. Leave any time.

Transcript

The narration, word for word, from the subtitle file that ships with the video.

0:00One Packet: headers and the OSI model

You type "Hi" to a friend on WhatsApp and press send. Your phone sends it as a packet. This is that packet, frozen just before it leaves: "Hi" in the middle, with labels wrapped around it, one inside the next. "Hi" is 2 bytes. The labels around it are many times bigger. Each label is called a header. Each header answers one question about the trip: who it's for, which program, which machine, where next. Seven layers on your phone built this packet, top to bottom. That stack of seven is the OSI model. The packet goes to WhatsApp's server first, not straight to your friend, and the server sends your friend a new packet. We'll follow it all the way, and at the end we'll use the same seven layers to find what broke when a message won't send.

1:02Layers 7, 6, 5: the app, encryption and session

Layer 7, the top, is the WhatsApp app itself. It writes the message: who it's for, your friend, and the text, "Hi". Layer 6 encrypts it: scrambles it so only someone with the right key can read it. WhatsApp does this twice. Lock one goes around "Hi" only, and only your friend can open it. That's end-to-end encryption. Lock two goes around the whole message, "for: your friend" included, and only WhatsApp's server can open it. Anyone watching along the way can't even see who you're messaging. Layer 5 keeps track of which conversation the packet belongs to. On the real internet, layers 5 and 6 add no headers of their own. The app and its locks do those jobs. That's because the internet runs a simpler version of the map, called TCP IP. The OSI model is the seven-step map people use to learn networks and find what broke.

2:14Layers 4, 3: TCP ports and IP addresses

Layer 4 is called transport. Here it's TCP, and its header adds two things. A port number. WhatsApp's server runs many programs, and the port says which one gets this packet. A sequence number. A long message is cut into pieces, and this number lets the far side put them back in order and notice any piece that went missing, so it gets sent again. "Hi" fits in one piece. Layer 3 is called network. Here it's IP, and its header adds two addresses: your phone's, and WhatsApp's server's. Your friend's address isn't on it. For messages, your phone only ever talks to WhatsApp's server. Every router along the way will read that server address to decide where to send the packet next.

3:14Layers 2, 1: MAC addresses and radio waves

Layer 2 is called data link. Its header names only the next stop, your Wi-Fi router. Your phone's Wi-Fi has its own address on this network, called a MAC address. Layer 2 writes your phone's MAC address and your router's, never the server's. Layer 2 also adds a check number at the very end of the packet. The router works the number out again when the packet arrives, and if the two don't match, the packet was damaged on the way and the router throws it away. Layer 1 is called physical, and it adds no header. It turns the whole packet into ones and zeros and sends them out as radio waves. Here's the whole packet as it leaves your phone. "Hi" is the smallest part. From the outside in: next stop, which machine, which program, lock two, who it's for, lock one, and "Hi" in the middle.

4:19Across: routers, NAT and TTL

Your Wi-Fi router catches the radio waves, turns them back into the packet, checks the check number, and takes off the layer 2 header. That header's job is done. The router reads the layer 3 header, the server's address, and picks the next stop on the way there. Your home router also swaps your phone's address, and often its port, for your home's own internet address, because every device in your house shares that one address. That swap is called NAT. It wraps a new layer 2 header for the next stop and sends the packet on. Every router after that does the same small job: take off layer 2, read the server's address, wrap a new layer 2, send. None of them can open the locks. The IP header also carries a counter that every router lowers by one. If it reaches zero, the router throws the packet away, so a lost packet can't circle forever. On this trip, the packet makes eight of these stops to reach WhatsApp's server. The layer 2 header is new at every stop, and the server's address never changes.

5:50Back Up: unwrapping at WhatsApp's server

At WhatsApp's server, the packet climbs back up the seven layers, and each layer takes off its own header. Layer 1 turns the signal on the wire back into ones and zeros. Layer 2 works out the check number again. It matches, so nothing was damaged, and the layer 2 header the last router put on comes off. Layer 3 reads the IP header, sees the server's own address, and takes it off. Layer 4 reads the port, hands the packet to WhatsApp's chat program, and the TCP header comes off. Layer 5 has no header to take off. It matches the packet to your phone's conversation. Layer 6 opens lock two, and layer 7 reads "for: your friend". Here the climb stops. "Hi" is still behind lock one, and the server has no key for it. If your friend's phone is offline, the server holds it until the phone comes back. The server wraps the same locked "Hi" in a new packet, with a new lock two that only your friend's phone can open, and sends it across the internet the same way. Your friend's phone climbs the layers too: layer 2, IP, TCP, lock two. Then it goes one step further than the server. It opens lock one, and "Hi" appears on the screen. Every header your phone wrapped around "Hi" was taken off by the same layer at the end of its trip: layer 2 at your router, IP, TCP and lock two at the server, and lock one only on your friend's phone.

7:45Which Layer Broke: troubleshooting with the OSI model

Sometimes your "Hi" won't send. The seven layers tell you where to look, starting at the bottom. Layer 1: Wi-Fi is off, or you're out of range. No radio waves leave your phone. Layer 2: your phone sees the Wi-Fi but can't join it, because the password is wrong. Your phone and the router never connect. Layer 3: your phone joined the Wi-Fi, but it never got an IP address from the router. With no address to send from, no packet can leave. Layer 4: the internet works, but this network's firewall stops the TCP connection to WhatsApp's server from opening. Some office and school networks do this. Your packet is stopped at the network's edge. If layers 1 to 4 all work, the problem is at the top, in the app itself or on WhatsApp's server. The seven layers aren't a list to memorise. They're seven places your packet can stop.