The TCP/IP & OSI Models
The layered map that organizes every protocol you have met so far
You have now seen IP, MAC, ARP, ports, and the encapsulation journey. This chapter zooms out and gives you the map that ties them all together: the layered network model. Layering is the single most useful mental framework in networking.
We will cover the practical 4-layer TCP/IP model, the classic 7-layer OSI model, and how they line up — so that whenever you meet a new protocol, you instantly know where it fits.
Why layer the network at all?
Networking is hard because it does many jobs at once: find the right app, deliver reliably, route across the world, and put bits on a wire. Layering splits these into separate concerns, each handled by one layer that only talks to the layers directly above and below it.
Big idea: Each layer has one job and trusts the layer below to do its job. You can swap WiFi for Ethernet without changing HTTP.
The TCP/IP model (4 layers)
The model actually used by the internet is the 4-layer TCP/IP model. From top to bottom:
- Application
- What your program speaks — HTTP, DNS, TLS.
- Transport
- App-to-app delivery — TCP (reliable) and UDP (fast).
- Internet
- Routing across networks — IP and ICMP.
- Link
- The local physical hop — Ethernet, WiFi, ARP, MAC.
The OSI model (7 layers)
The OSI model is the classic teaching model with 7 layers. It splits the top and bottom of the TCP/IP model into finer pieces:
- 7 Application · 6 Presentation · 5 Session
- 4 Transport
- 3 Network
- 2 Data Link · 1 Physical
Reality: Engineers talk in OSI layer numbers all the time ("a layer-4 load balancer", "a layer-7 proxy") even though the internet runs on TCP/IP.
How they map together
The two models are not rivals — they line up. OSI’s top three (Application, Presentation, Session) collapse into TCP/IP’s Application. OSI Transport = TCP/IP Transport, OSI Network = TCP/IP Internet, and OSI’s bottom two (Data Link, Physical) become TCP/IP’s Link.
A header per layer (encapsulation)
Layers are why encapsulation (Chapter 1) works the way it does. As data goes down the stack, each layer wraps it with its own header: Transport adds the TCP/UDP header (→ segment/datagram), Internet adds the IP header (→ packet), Link adds the frame header (→ frame). At the receiver it is unwrapped in reverse.
Symmetry: Down the stack = wrap. Up the stack = unwrap. Each layer only reads its own header.
Remembering the 7 layers
A classic mnemonic for OSI bottom-to-top (Physical → Application): "Please Do Not Throw Sausage Pizza Away" — Physical, Data link, Network, Transport, Session, Presentation, Application.
Where each protocol lives
Use the model as a filing system. When you meet a protocol, ask "what layer is this?" and you immediately know its job:
- HTTP, DNS, TLS
- Application layer.
- TCP, UDP
- Transport layer.
- IP, ICMP
- Internet/Network layer.
- ARP, Ethernet, MAC
- Link layer.