The 7-Layer OSI Model Explained
The OSI (Open Systems Interconnection) model is a 7-layer mental framework for understanding how networks work. Real networks don’t strictly follow it — TCP/IP collapses some layers — but every network engineer thinks in OSI terms when debugging. Knowing it cuts your troubleshooting time in half.
The 7 layers
| # | Layer | What it does | Examples |
|---|---|---|---|
| 7 | Application | User-facing protocols | HTTP, SMTP, SSH, DNS |
| 6 | Presentation | Encoding, encryption | TLS, JPEG, ASCII |
| 5 | Session | Setup/tear down conversations | NetBIOS, RPC |
| 4 | Transport | End-to-end delivery | TCP, UDP |
| 3 | Network | Routing across networks | IP, ICMP |
| 2 | Data Link | Frames between adjacent nodes | Ethernet, Wi-Fi (MAC) |
| 1 | Physical | Bits on wire/radio | Cat6, fiber, 802.11 radio |
How it works in practice
When you load a webpage:
- L7 (App) — Browser sends an HTTP GET request
- L6 (Pres) — TLS encrypts it
- L4 (Trans) — TCP wraps it in segments, adds ports
- L3 (Net) — IP wraps that in a packet, adds source/destination IPs
- L2 (Link) — Ethernet/Wi-Fi wraps it in a frame, adds MAC addresses
- L1 (Phys) — Frame becomes electrical pulses or radio waves on the wire
At the destination, this happens in reverse — each layer strips its header and hands the payload up.
The mnemonic
Please Do Not Touch Steve’s Pet Alligator (bottom up: Physical, Data, Network, Transport, Session, Presentation, Application).
Why it matters for debugging
When something doesn’t work, walk up the stack:
- Cable plugged in? (L1)
- Link light on the switch? (L2)
pingthe gateway? (L3)- Can you open a TCP socket to the port? (L4)
- Is the application responding correctly? (L7)
This methodical layer-by-layer approach is THE skill that separates a network engineer from a guess-and-restart troubleshooter.
Real systems don’t perfectly follow OSI
The TCP/IP stack (which actually runs the internet) merges some OSI layers — it has only 4 layers. Layers 5/6 are mostly absorbed into the application. We’ll cover that next.
What to learn next
The TCP/IP 4-layer model — the simpler, real-world version that the internet actually runs on.