Why layer anything at all?
Imagine you had to think about electrical voltage on a cable at the exact same moment you were thinking about what a web page's HTML looks like. That would be unmanageable — so networking is broken into layers, where each layer only has to worry about its own job and trusts the layer below it to have already handled its part.
Think about mailing a letter internationally. You write a letter (the content), put it in an envelope with an address (so the postal system can route it), the local post office bags it with other mail heading the same direction, a truck carries the bag to an airport, a plane flies it to the destination country, and a local carrier makes the final delivery to the door. You never think about "how planes fly" while writing the letter — that's a different layer's problem. Networking models exist for the same reason: to separate concerns.
The OSI Model — 7 layers
OSI (Open Systems Interconnection) is the theoretical, academic model. It's rarely implemented exactly as written, but its vocabulary is everywhere — "that's a Layer 2 problem," "we're seeing Layer 7 errors" — so you need it even though the real Internet doesn't run on it directly.
- Layer 7 — Application: what the user-facing program actually does (HTTP, DNS, SMTP). This is "writing the letter."
- Layer 6 — Presentation: formatting, encryption, compression — making sure both ends understand the data the same way (translating the letter if the recipient speaks a different language).
- Layer 5 — Session: establishing, managing, and tearing down a conversation between two programs (agreeing you're having an ongoing exchange of letters, not a one-off).
- Layer 4 — Transport: reliable or unreliable delivery, ordering, error recovery (TCP/UDP). This is choosing tracked courier vs. a regular postcard.
- Layer 3 — Network: logical addressing and routing between different networks (IP). This is the destination address on the envelope, used by the postal system to route it across cities.
- Layer 2 — Data Link: framing and addressing on the local segment (Ethernet, MAC addresses, switches). This is the local mail carrier who knows exactly which house on the street to hand it to.
- Layer 1 — Physical: the actual bits on the wire — voltage, light pulses, radio waves, cabling, connectors. This is the paper, the truck, the road itself.
The TCP/IP Model — 4 layers
TCP/IP is the model the real Internet is actually built on. It's more practical and compresses OSI's upper three layers into one, since in practice applications, presentation, and session concerns are usually handled together by the same piece of software.
- Application: combines OSI's Application + Presentation + Session. HTTP, DNS, TLS, SSH all live here.
- Transport: same job as OSI Layer 4 — TCP or UDP.
- Internet: same job as OSI Layer 3 — IP addressing and routing.
- Network Access (also called Link): combines OSI's Data Link + Physical — Ethernet, Wi-Fi, and the actual signaling.
Side by side
| OSI Layer | TCP/IP Layer | Real-world analogy | Examples |
|---|---|---|---|
| 7 Application, 6 Presentation, 5 Session | Application | Writing the letter, choosing the language, agreeing to keep writing back and forth | HTTP, DNS, TLS, SSH |
| 4 Transport | Transport | Tracked courier vs. a postcard | TCP, UDP |
| 3 Network | Internet | The destination address that routes it across cities | IP, ICMP, routers |
| 2 Data Link, 1 Physical | Network Access | The local carrier and the actual road/truck | Ethernet, MAC addresses, Wi-Fi, cabling |
Engineers talk in OSI terms ("that's a Layer 3 issue," "we're doing Layer 2 troubleshooting") because it's precise and everyone was taught it — but the actual packets on the wire are structured according to TCP/IP. You'll use OSI vocabulary daily and TCP/IP's actual header structures whenever you're reading a packet capture.