Exercises — OSI model — 7 layers, responsibilities, PDU names
Level 1 — Recognition
Goal: can you name the layer, its PDU, and its address?
Q1.1
Name all 7 OSI layers top to bottom, and give the mnemonic you would use.
Recall Solution
Top → Bottom: Application, Presentation, Session, Transport, Network, Data Link, Physical. Mnemonic: All People Seem To Need Data Processing. (See 4.3.1 OSI model — 7 layers, responsibilities, PDU names for the full table.)
Q1.2
Fill the blank PDU for each layer: Transport = ___, Network = ___, Data Link = ___, Physical = ___, Application = ___.
Recall Solution
- Transport → Segment (TCP) / Datagram (UDP)
- Network → Packet
- Data Link → Frame
- Physical → Bit
- Application (also Presentation & Session) → Data
Chain bottom→top: Bits → Frames → Packets → Segments → Data.
Q1.3
Match each address to its layer: MAC address, IP address, Port number.
Recall Solution
- MAC address → Layer 2 (Data Link)
- IP address → Layer 3 (Network)
- Port number → Layer 4 (Transport)
Reveal-yourself drill: MAC address lives at layer ::: 2 (Data Link) IP address lives at layer ::: 3 (Network) Port number lives at layer ::: 4 (Transport)
Level 2 — Application
Goal: given a real thing, place it at the right layer.
Q2.1
At which layer does each of these operate? (a) HTTP (b) A router forwarding by IP (c) An Ethernet switch (d) TLS encryption (classic OSI) (e) A network cable pushing voltage.
Recall Solution
- (a) HTTP → Layer 7 (Application)
- (b) Router → Layer 3 (Network) — it uses IP. See Routers vs Switches vs Hubs.
- (c) Switch → Layer 2 (Data Link) — it uses MAC.
- (d) TLS encryption → Layer 6 (Presentation) in classic OSI.
- (e) Cable/voltage → Layer 1 (Physical).
Q2.2
A browser (port unknown) contacts a web server on port 443. Which layer reads the port number, and what job does that number do?
Recall Solution
Port 443 is read at Layer 4 (Transport). Layer 3 delivers the packet to the correct machine (IP), but many programs run on one machine, so Layer 4 uses the port to hand data to the correct process — here, the HTTPS web service. See Ports and Sockets.
Q2.3
You resume a 1 GB download that failed at 90% and it continues from the checkpoint. Which layer's bookkeeping made that possible?
Recall Solution
Layer 5 (Session) — it manages dialog control and checkpoints, so a broken transfer can resume instead of restarting.
Level 3 — Analysis
Goal: explain WHY, and compute encapsulation overhead.
Q3.1
Application data bytes. Headers added: Transport B, Network B, Data Link header+trailer B. Compute the final frame size and the overhead percentage.
Recall Solution
Encapsulation is purely additive — every layer prepends (and L2 also appends a trailer) its own metadata; nothing is removed until the receiver de-encapsulates. So: Overhead bytes . As a fraction of the frame: Look at figure s01: each ring wraps the one inside it, so the outermost band (the frame) is always the biggest. This is why "overhead" exists in networking. See Encapsulation and De-encapsulation.
Q3.2
The link's Maximum Transmission Unit (MTU) — the largest frame the medium allows — is 1518 B, of which 18 B is L2 header+trailer and 40 B is TCP+IP headers. What is the largest application payload that fits in one frame (this payload limit is the MSS, Maximum Segment Size)?
Recall Solution
The frame budget is 1518 B. Subtract every wrapper: So bytes — the classic Ethernet MSS. Anything larger must be segmented at Layer 4 into multiple frames.
Q3.3
Why does the PDU name change at every layer, but stay "Data" for Layers 5, 6, 7?
Recall Solution
The name changes because each lower layer adds a new header, producing a new logical unit (Data → Segment → Packet → Frame → Bits). Layers 5–7 do not add a transport-style header that creates a new addressed unit — they hand the same "Data" blob downward — so it keeps the name Data until Transport wraps it into a Segment.
Level 4 — Synthesis
Goal: trace a whole journey across the stack and across devices.
Q4.1
A packet travels PC-A → Switch → Router → PC-B. For each device, name the highest layer it inspects and what it reads there.
Recall Solution
- Switch → up to Layer 2; reads the destination MAC to forward the frame on the local link.
- Router → up to Layer 3; reads the destination IP to choose the next network. It rewrites the L2 frame (new MAC header) for the next hop but keeps the L3 packet's IP addresses.
- PC-B (endpoint) → all the way to Layer 7; it de-encapsulates every wrapper and hands the raw Data to the application.
Figure s02: the switch peeks only into the green (L2) band; the router peeks into the blue (L3) band; only the end host opens the whole onion. See MAC Address and ARP and IP Addressing and Subnetting.
Q4.2
On the sender, order these events as data goes down the stack, and give the PDU after each: (i) add IP header, (ii) add TCP header, (iii) encode to bits, (iv) add MAC header/trailer.
Recall Solution
- (ii) add TCP header → Segment
- (i) add IP header → Packet
- (iv) add MAC header/trailer → Frame
- (iii) encode to bits → Bits
Order = ii → i → iv → iii. This is exactly the encapsulation chain
Q4.3
When a router forwards a packet, which fields are rewritten and which are preserved? (source/dest MAC vs source/dest IP)
Recall Solution
- MAC addresses (L2) → rewritten at every hop. The old frame is stripped and a new frame is built with this hop's source MAC and the next hop's destination MAC.
- IP addresses (L3) → preserved end-to-end (original source IP, final destination IP) — this is why IP is called the "logical/end-to-end" address while MAC is "local/link" only.
Level 5 — Mastery
Goal: edge cases, degenerate inputs, and cross-model traps.
Q5.1
Map the OSI layers onto the TCP/IP model. Which three OSI layers collapse into one, and what is it called?
Recall Solution
OSI's Application + Presentation + Session collapse into the single TCP/IP Application layer. Rough mapping:
- OSI 7/6/5 → TCP/IP Application
- OSI 4 → TCP/IP Transport
- OSI 3 → TCP/IP Internet
- OSI 2/1 → TCP/IP Network Access (or split into Data Link + Physical in the 5-layer version).
OSI is the map; TCP/IP is the road actually built. See TCP-IP Model — 4 vs 5 layers.
Q5.2 (degenerate input)
Two PCs are connected by a single cable with no switch and no router — same local network. When PC-A sends to PC-B, does the data ever reach Layer 3 routing logic on any device between them? Explain.
Recall Solution
No routing happens between them. There is no router, so no device does Layer-3 forwarding. Both hosts still build an L3 packet (IP header) internally, but because both are on the same network, delivery is purely a Layer 2 (MAC) affair over the cable. Layer 3's job — choosing a path across networks — is trivial/absent when there is only one network. This is the degenerate case where the Network layer exists on the endpoints but its routing function is never exercised.
Q5.3 (zero-payload edge case)
A TCP acknowledgement carries bytes of application data. Using , , , what is the frame size, and what does the overhead percentage become?
Recall Solution
Overhead as a fraction of the frame . Every single byte on the wire is header — the frame is all wrapper, no gift. This shows why chatty protocols with tiny payloads are so inefficient: the fixed header cost dominates.
Q5.4 (limiting behaviour)
As the application payload (very large transfers, ignoring MTU splitting), what does the overhead fraction approach?
Recall Solution
With fixed headers : Why a limit here? We are asking "what happens in the best case of huge transfers?" The header cost is a fixed number of bytes, but the payload grows without bound, so the ratio of fixed overhead to total shrinks toward zero. Big transfers are efficient; the header tax becomes negligible. (Contrast with Q5.3, the other extreme, where the ratio hit 100%.)