Layered Models: OSI vs TCP/IP
The seven OSI layers, the four/five-layer TCP/IP model, and what each layer actually does for a packet in flight.
- Name the OSI and TCP/IP layers in order and state the job of each
- Map OSI layers to their TCP/IP counterparts
- Explain why layering exists (independence, replaceability, clear contracts)
Interviewer: "You type a URL and press Enter — which layers are involved, and in what order?" If you can narrate that story top-to-bottom, every layer-definition question in the syllabus is already answered.
Why layers? Each layer offers a service to the one above and hides how it is implemented. You can swap Wi-Fi for Ethernet without touching TCP or the browser. Protocols on the same layer on two machines "talk past each other" — horizontal protocols, vertical services.
OSI (7 layers, top → bottom): 7. Application — user services (HTTP, DNS, SMTP) 6. Presentation — encoding, encryption, compression 5. Session — dialogs, checkpointing, session setup 4. Transport — end-to-end delivery, segmentation, reliability (TCP/UDP) 3. Network — logical addressing and routing (IP, ICMP) 2. Data Link — framing, MAC addressing, error detection (Ethernet, Wi-Fi)
- Physical — bits on the medium (voltage, light, radio)
TCP/IP model (what the internet actually uses):
- Application (merges OSI 5–7)
- Transport (OSI 4)
- Internet (OSI 3)
- Network Access / Link (OSI 1–2)
Units each layer moves:
| Layer | PDU |
|---|---|
| Transport | Segment (TCP) / Datagram (UDP) |
| Network | Packet |
| Data Link | Frame |
| Physical | Bits |
Encapsulation: each layer adds its own header (and the data link layer adds a trailer) as the data travels down; the receiver strips them on the way up (decapsulation).
| Layer | Key protocols / tech | |
|---|---|---|
| 7 | Application | HTTP, DNS, SMTP, FTP |
| 6 | Presentation | TLS, JPEG, ASCII |
| 5 | Session | NetBIOS, RPC sessions |
| 4 | Transport | TCP, UDP |
| 3 | Network | IPv4, IPv6, ICMP, OSPF |
| 2 | Data Link | Ethernet, Wi-Fi (802.11), ARP |
| 1 | Physical | 1000BASE-T, radio, fiber |
Please Do Not Throw Sausage Pizza Away (1→7).
Segment at layer 4, packet at layer 3, frame at layer 2 — examiners mark the exact word.
- 1
Application
Browser builds HTTP GET; DNS has already resolved the host to an IP.
- 2
Transport
TCP: source port (ephemeral, e.g. 51234) + dest port 80; payload becomes a segment; MSS caps size.
- 3
Internet
IP header: src IP = your device, dst IP = server; TTL set (e.g. 128).
- 4
Data Link
Frame: MAC src = your Wi-Fi NIC, MAC dst = default gateway AP; FCS trailer for error detection.
- 5
Physical
Bits modulated onto 2.4/5 GHz radio; AP forwards toward the internet.
- 6
Server side
Reverse: strip headers layer by layer; HTTP handler reads GET.
Solution
Full down-and-up trace; each layer adds its header, the peer removes it.
At which layer do each of these live: IP packet, TCP segment, Ethernet frame, HTTP message?
Hint: HTTP is application; then 4, 3, 2.
Saying TCP/IP and OSI are the same model
OSI is the 7-layer teaching model; TCP/IP is the 4/5-layer implementation the internet uses.
Placing IP at layer 2 or TCP at layer 3
IP = network (3), TCP = transport (4).
Which OSI layer is responsible for end-to-end error recovery and flow control?
Layer 4, Transport (TCP).
Source: Classic university short question.
- Layering = service up, protocol across, independence between.
- OSI 7 layers; TCP/IP merges 5–7 into Application.
- PDUs: segment (L4), packet (L3), frame (L2), bits (L1).