Explain the OSI model and what each layer adds.
Short answer
The OSI model splits networking into seven layers, each adding one responsibility: Physical (bits on the wire), Data Link (frames and MAC addressing), Network (IP routing), Transport (TCP/UDP, ports, reliability), Session (managing connections), Presentation (encoding, encryption, compression), and Application (protocols like HTTP). Each layer wraps the one above it as data goes down the stack.
The OSI model is a conceptual framework that breaks networking into seven layers, each responsible for one thing. No real stack implements it exactly, but it's the shared vocabulary engineers and analysts use to localize problems and reason about where a security control belongs.
The seven layers, bottom to top
- Physical — moves raw bits as electrical, optical, or radio signals over a medium. Cables, NICs, voltages.
- Data Link — groups bits into frames and uses MAC addresses for delivery on the local segment. Switches and VLANs live here, plus error detection.
- Network — handles logical addressing and routing between networks with IP. Routers operate here.
- Transport — provides end-to-end delivery with TCP/UDP, ports, segmentation, and (for TCP) reliability and flow control.
- Session — establishes, manages, and tears down conversations between applications.
- Presentation — translates data formats: encoding, compression, and encryption (e.g., TLS is often placed here).
- Application — the protocols users interact with: HTTP, DNS, SMTP, SSH.
Why it still matters
As data travels down the stack on the sender, each layer wraps the payload with its own header — encapsulation — and the receiver unwraps it on the way up. The model lets you say "this is a Layer 2 problem" (a switching loop) versus "a Layer 7 problem" (a malformed HTTP request), which immediately narrows tooling and ownership. Security controls map to layers too: a packet filter works at Layer 3/4, a WAF at Layer 7.
Interviewers look for the seven layers in order, one crisp responsibility per layer, and at least one device or protocol mapped to the right layer.
Likely follow-ups
- At which layer does a router operate versus a switch?
- Which OSI layer is a typical web application firewall protecting?
- How does encapsulation work as a packet moves down the stack?