OSI vs TCP/IP — Deep Dive
The OSI (Open Systems Interconnection) model is a conceptual framework standardising network functions into seven layers. The TCP/IP model is the four-layer practical model used in real-world internet communication. Both are essential knowledge for networking.
---
1. OSI 7-Layer Model — Complete Reference Table
| Layer # | Name | Function | PDU | Key Protocols | Devices |
|---|---|---|---|---|---|
| 7 | Application | Provides network services directly to user applications; interface between applications and network | Data | HTTP, HTTPS, FTP, SMTP, DNS, Telnet, SNMP, DHCP | — |
| 6 | Presentation | Data translation (ASCII↔EBCDIC), encryption/decryption (SSL/TLS), compression (JPEG, MPEG) | Data | SSL, TLS, JPEG, MPEG, ASCII, GIF | — |
| 5 | Session | Establishes, maintains, and terminates sessions; synchronisation checkpoints; dialog control | Data | NetBIOS, RPC, NFS, SAP, SQL sessions | — |
| 4 | Transport | End-to-end delivery; segmentation/reassembly; error recovery; flow control; multiplexing via ports | Segment | TCP, UDP, SCTP, SPX | — |
| 3 | Network | Logical IP addressing; routing; path determination; fragmentation and reassembly | Packet | IP, ICMP, ARP, OSPF, RIP, BGP | Router |
| 2 | Data Link | Physical MAC addressing; framing; error detection (CRC); media access control | Frame | Ethernet (802.3), Wi-Fi (802.11), PPP, HDLC | Switch, Bridge |
| 1 | Physical | Transmission of raw bits over medium; defines voltages, timing, connectors | Bits | RS-232, USB, DSL, SONET | Repeater, Hub |
---
2. Layer-by-Layer Explanation
Layer 1 — Physical: Deals with actual physical transmission. Defines cable types, connectors, voltage levels, bit timing, and modulation. Devices: Repeaters, Hubs, cables. PDU = Bits.
Layer 2 — Data Link: Node-to-node delivery across a single link. Encapsulates packets into frames, adds MAC addresses, performs CRC error detection. Split into LLC (flow/error control) and MAC (media access) sub-layers. PDU = Frame. Devices: Switches, Bridges.
Layer 3 — Network: Routes packets from source to destination across multiple networks using IP addresses. Functions: logical addressing, path determination, packet forwarding, fragmentation. PDU = Packet. Device: Router.
Layer 4 — Transport: End-to-end communication between processes (identified by port numbers). TCP provides reliable, ordered, error-checked delivery. UDP provides fast, connectionless, best-effort delivery. PDU = Segment.
Layer 5 — Session: Manages communication sessions. Provides synchronisation (checkpoints for large transfers so they can resume after failure), dialog control (half-duplex vs full-duplex management). Example: NetBIOS session for Windows file sharing.
Layer 6 — Presentation: Acts as a data translator. Converts data formats (EBCDIC to ASCII), handles encryption/decryption (TLS), and compression (JPEG for images, MPEG for video). Ensures data is in a usable format.
Layer 7 — Application: Provides network services to end-user applications. NOT the application itself (browser, email client) but the protocols applications use. Examples: HTTP (web), FTP (file transfer), SMTP (email sending), DNS (name resolution).
Exam Tip: Mnemonic bottom-to-top: "Please Do Not Throw Sausage Pizza Away" = Physical, Data Link, Network, Transport, Session, Presentation, Application. Top-to-bottom: "All People Seem To Need Data Processing."
---
3. TCP/IP 4-Layer Model
| Layer # | TCP/IP Layer | OSI Equivalent | Key Protocols |
|---|---|---|---|
| 4 | Application | OSI Layers 5, 6, 7 combined | HTTP, HTTPS, FTP, SMTP, POP3, IMAP, DNS, DHCP, SSH, Telnet, SNMP |
| 3 | Transport | OSI Layer 4 | TCP, UDP |
| 2 | Internet | OSI Layer 3 | IPv4, IPv6, ICMP, ARP |
| 1 | Network Access (Link) | OSI Layers 1 + 2 | Ethernet (802.3), Wi-Fi (802.11), PPP, Frame Relay |
---
4. OSI vs TCP/IP — 7 Key Differences
| # | Feature | OSI Model | TCP/IP Model |
|---|---|---|---|
| 1 | Number of layers | 7 | 4 |
| 2 | Developed by | ISO (International Standards Organisation) | DARPA (US Defense Advanced Research Projects Agency) |
| 3 | Approach | Generic, protocol-independent reference model | Practical, built around specific TCP/IP protocols |
| 4 | Session & Presentation | Separate dedicated layers (5 and 6) | Merged into single Application layer |
| 5 | Development timing | Top-down: model designed before protocols | Bottom-up: protocols already existed when model formalised |
| 6 | Usage | Reference/teaching model — not directly implemented | Actual implementation used on the internet today |
| 7 | Reliability | Transport layer specifies both reliable and unreliable options | TCP (reliable) and UDP (unreliable) at Transport layer |
---
5. Encapsulation and Decapsulation
When sending, each layer adds a header (encapsulation):
Application Data
→ [L7 Header | Data] → [L6 Header | Data] → [L5 Header | Data]
→ [L4 Header | Segment]
→ [L3 Header | Packet]
→ [L2 Header | Frame | L2 Trailer]
→ Bits on wire
When receiving, each layer strips its header (decapsulation). The process is perfectly symmetric.
Study Deep: Why OSI if TCP/IP is Used?
- OSI is a universal troubleshooting vocabulary: saying "this is a Layer 3 problem" instantly means routing/IP, narrowing diagnosis from hundreds of possibilities to a handful.
- Certification exams (CCNA, CompTIA Network+, CISSP) use OSI as their primary framework even though TCP/IP is what runs on the internet.
- Protocol encapsulation is an OSI concept used in TCP/IP: HTTP data → TCP segment → IP packet → Ethernet frame → bits.
- OSI Session and Presentation functions are handled by libraries (TLS, codec libraries) in TCP/IP implementations — which is why TCP/IP merges them into the Application layer.
Exam Tip: Know all PDU names: Physical=Bits, Data Link=Frame, Network=Packet, Transport=Segment, Application/Session/Presentation=Data. These names appear in almost every networking exam.