Networking for Interviews/Networking Foundations

Layers, Encapsulation & the Request Path

TCP/IP layers vs OSI vocabulary, encapsulation, the classic "type a URL" walkthrough (DNS → TCP → TLS → HTTP), and just enough IP addressing and NAT to reason about VPCs and private subnets.

1/5Overview: 20m

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

LayerOwnsDoes NOT own
LinkLocal delivery on one network segmentEnd-to-end routing
Internet (IP)Global addressing, routingReliability, ordering
Transport (TCP/UDP)Ports, multiplexing, (TCP) reliabilityRequest/response semantics
Application (HTTP, DNS, TLS)Protocol semantics your code seesHow packets are routed

The classic interview walkthrough: HTTPS GET

When someone asks "what happens when you type a URL?", hit these beats in order:

  1. DNS — resolve hostname to IP (recursive resolver, caching).
  2. TCP — three-way handshake to (IP, port 443).
  3. TLS — certificate validation, key exchange, encrypted channel.
  4. 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/24 means 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

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 paper

    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.

    20m