TCP/IP & OSI
Model Cheatsheet
A complete visual reference for the 7-layer OSI model and 4-layer TCP/IP model, including protocols at each layer, PDUs, and practical examples — with interactive quiz and slideshow.
What are OSI and TCP/IP?
The OSI (Open Systems Interconnection) model is a 7-layer conceptual framework that standardises how different network systems communicate. Created by ISO, it provides a universal language for describing network functions.
The TCP/IP model is the practical 4-layer implementation used by the internet. It combines several OSI layers and is the actual protocol suite your devices use every day.
Why it matters: Network engineers use these models to diagnose faults ("at which layer is the problem?"), security analysts use them to understand attack surfaces, and certifications like CompTIA Network+ and CCNA test knowledge of both.
1. OSI Model — 7 Layers
Mnemonic: Please Do Not Throw Sausage Pizza Away (Physical → Data Link → Network → Transport → Session → Presentation → Application)
2. TCP/IP Model — 4 Layers
The TCP/IP model is what the internet actually uses. It maps to OSI but is simpler with 4 layers.
HTTP, HTTPS, DNS, FTP, SSH, SMTP
TCP, UDP
IP, ICMP, ARP, BGP
Ethernet, Wi-Fi, ARP
Session + Presentation + Application
Transport
Network
Physical + Data Link
3. TCP vs UDP
| Feature | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented (3-way handshake) | Connectionless |
| Reliability | Guaranteed delivery, retransmission | Best-effort, no guarantee |
| Speed | Slower due to overhead | Faster, lower overhead |
| Ordering | Packets delivered in order | No ordering guarantee |
| Error Checking | Yes — checksum + ACK | Checksum only |
| Flow Control | Yes (sliding window) | No |
| Use Cases | HTTP, SSH, FTP, email — anything requiring accuracy | DNS, DHCP, VoIP, streaming, gaming |
| Header Size | 20–60 bytes | 8 bytes fixed |
4. TCP 3-Way Handshake
Before TCP data transfer begins, both endpoints establish a connection using a three-step process.
Client Server ──── SYN (seq=x) ────────────► Step 1: Client wants to connect ◄─── SYN-ACK (seq=y,ack=x+1) ─ Step 2: Server acknowledges ──── ACK (ack=y+1) ──────────► Step 3: Client confirms [Connection Established — Data Exchange Begins] ──── FIN ────────────────────► Step 4: Client requests close ◄─── FIN-ACK ──────────────── Step 5: Server acknowledges ◄─── FIN ──────────────────── Step 6: Server also closes ──── ACK ────────────────────► Step 7: Client confirms
5. Protocol Summary by Layer
| OSI Layer | Protocol | Purpose |
|---|---|---|
| 7 — Application | HTTP/HTTPS | Web page transfer |
| 7 — Application | DNS | Domain name resolution |
| 7 — Application | SMTP/POP3/IMAP | Email transfer |
| 7 — Application | SSH/Telnet | Remote administration |
| 7 — Application | SNMP | Network device monitoring |
| 6 — Presentation | SSL/TLS | Encryption / decryption |
| 6 — Presentation | JPEG/PNG/MP4 | Media formatting |
| 5 — Session | NetBIOS, RPC | Session establishment |
| 4 — Transport | TCP | Reliable ordered delivery |
| 4 — Transport | UDP | Fast unreliable delivery |
| 3 — Network | IP (v4/v6) | Logical addressing & routing |
| 3 — Network | ICMP | Error messages (ping) |
| 3 — Network | OSPF / BGP | Routing protocols |
| 2 — Data Link | Ethernet / 802.11 | MAC addressing & framing |
| 2 — Data Link | ARP | IP-to-MAC resolution |
| 1 — Physical | Ethernet cable / Wi-Fi | Raw bit transmission |