Why layers exist
A network stack is layered so each level can evolve independently: your application doesn't need to know whether the link below is Wi-Fi or fiber, and Ethernet doesn't need to understand HTTP headers. The TCP/IP model (link → internet → transport → application) is what production systems implement; the OSI seven-layer model is the teaching vocabulary interviewers still use — know how they map (OSI layers 1–2 ≈ TCP/IP link, 3 ≈ internet, 4 ≈ transport, 5–7 ≈ application).
What each layer owns
| Layer | Owns | Does NOT own |
|---|---|---|
| Link | Local delivery on one network segment | End-to-end routing |
| Internet (IP) | Global addressing, routing | Reliability, ordering |
| Transport (TCP/UDP) | Ports, multiplexing, (TCP) reliability | Request/response semantics |
| Application (HTTP, DNS, TLS) | Protocol semantics your code sees | How packets are routed |
The classic interview walkthrough: HTTPS GET
When someone asks "what happens when you type a URL?", hit these beats in order:
- DNS — resolve hostname to IP (recursive resolver, caching).
- TCP — three-way handshake to
(IP, port 443). - TLS — certificate validation, key exchange, encrypted channel.
- HTTP — request line, headers, response status/body over the TLS tunnel.
Each step wraps the previous in headers: HTTP bytes → TCP segment → IP packet → link frame. Routers read only what they need (IP header); only the destination fully decapsulates.
IP addressing & NAT (interview minimum)
- Private ranges (RFC 1918):
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16— not routable on the public internet. - NAT/PAT — many private hosts share one public IP; the router tracks
(private IP, port) ↔ (public IP, port)mappings. Explains why a service in a private subnet needs a load balancer or NAT gateway for inbound traffic. - CIDR —
/24means 256 addresses; know enough to reason about subnet sizing in VPC design follow-ups, not to subnet in your head under pressure.
Senior-level signal
When debugging "works locally, fails in the VPC," ask which layer failed — DNS resolution, security group (IP), TLS cert mismatch (application), or TCP timeout (transport). Mixing layers wastes hours.
Further Reading
- Kurose & Ross, 8th Ed — Ch. 1 §1.5.1–1.5.2 (pp. 47–53): layered architecture and encapsulationBook20m
- Cloudflare Learning — What is the OSI model? (concise layer-by-layer breakdown with real-protocol examples)Article15m
- Kurose & Ross, 8th Ed — Ch. 4 §4.3.3 (pp. 344–346): NAT (why private IPs need translation)Book15m
Hands-On Tasks (Optional)
Low-setup exercises you can run locally or on a free-tier cloud account. No autograding — the goal is to build intuition, not pass a test.
- Walk through one HTTPS GET on paper20m
Pick a site you use daily. Write the DNS lookup, TCP handshake, TLS handshake, and HTTP request/response — name which layer each step belongs to. No tools required; the exercise is fluency for verbal rounds.