Capstone: What Happens When You Visit https://example.com
The canonical networking interview question is a test of whether you can tell the story at the right altitude — nine steps in a minute, twelve layers on request, and at every layer the mechanism, the state that changes, and the failure you would name.
The problem
https://example.com and press Enter". Ten minutes, no whiteboard. Where do you start, how deep do you go, and how do you show you can debug it rather than recite it?Level 1: the nine-step story in sixty seconds
Start at the altitude where every step is a noun the interviewer recognises and the chain is complete: the browser parses the URL; DNS turns the name into an IP; the OS routes toward that IP; TCP opens a connection; TLS secures it and proves the server’s identity; HTTP asks for the page; the server produces a response; the response comes back and the browser renders it. Say it in one breath, then stop and let them choose where to zoom. The stopping is the skill: a candidate who dives into TCP window scaling before finishing the story has shown they cannot summarise.
The "open a website" journey renders this same chain with four zoom levels, and the interactive here lets you expand any rung into its sub-steps and inject a failure at each — the way an interviewer will.
- URLscheme `https`, host `example.com`, default port 443, path `/`↓
- DNSbrowser cache → OS → resolver → authoritative; an A/AAAA record↓
- IPa destination address; the packet has a source and a destination↓
- Routingdefault gateway, then longest-prefix match hop by hop↓
- Transport connectionTCP three-way handshake (or QUIC over UDP for HTTP/3)↓
- TLSClientHello with SNI, certificate, key agreement; one RTT on 1.3↓
- HTTPGET / with Host and headers; HTTP/2 over the same connection↓
- ServerLB → app → database → response body↓
- Responsestatus, headers, body; the browser parses and renders, then fetches more
Level 2: twelve layers when they ask for more
When the interviewer says "go deeper", the second ladder adds the layers the first one skipped: the socket API and the kernel between browser and network, the link layer between IP and the router, and the return trip. Now each rung has a mechanism to name: socket()/connect() and the descriptor; the kernel’s TCP state machine and buffers; the IP header with TTL; ARP or neighbor discovery to find the gateway’s MAC; the Ethernet or Wi-Fi frame; NAT at the home router rewriting the source; BGP-chosen paths across autonomous systems; the destination’s NIC, kernel, accept(), and the process.
At this altitude the interviewer is listening for which state changes where: DNS caches populated, a socket in SYN_SENT then ESTABLISHED, a NAT table entry, sequence numbers advancing, a TLS session key, a keep-alive connection left open for the next request. Follow a Web Request Through Every Layer and Follow One Packet trace these state changes explicitly; Follow send() Through the OS to recv() covers the kernel half.
- BrowserURL parse, HSTS check, cache check, connection pool lookup↓
- Socket`socket()`, `connect()`: a descriptor and a kernel TCP control block↓
- Kernelsend buffer, TCP state machine, timers; the syscall boundary↓
- TransportSYN with ISN, MSS, window scale; later segments with seq/ack↓
- IPsrc/dst addresses, TTL 64, DF bit; routing-table lookup for the next hop↓
- Ethernet / Wi-FiARP/ND for the gateway’s MAC; a frame with src/dst MAC↓
- Home routerNAT: rewrite src IP:port, record the mapping; decrement TTL↓
- InternetISP → transit/peering → destination AS; BGP path; each hop swaps MACs and decrements TTL↓
- Destinationedge / LB terminates TCP; SYN-ACK; `accept()` wakes a process↓
- TLSSNI selects the certificate; chain verified; session keys derived↓
- HTTPrequest framed (HTTP/2 stream), routed by Host/path↓
- Applicationhandler runs, database queried, response serialised and sent back down the same stack
How to answer progressively, and what they listen for
Answer in rounds. Round one is the nine-step story with no detail — sixty seconds. Round two, on request, expands one rung they pick, to the level-2 mechanisms, naming the state that changes. Round three, if they keep pushing, is internals: SYN cookies, TLS 1.3 key schedule, HTTP/2 HPACK, epoll on the server. You do not choose the rung; they do, and following their choice cheaply is what distinguishes understanding from recitation.
At every layer, be ready with three things: the mechanism (what happens), a number (how long it takes, how big it is), and a failure (what breaks here and what it looks like). "TLS handshake — one round trip on 1.3, two on 1.2, so ~30 ms in-region; fails as an expired certificate, a hostname mismatch or a missing intermediate that browsers hide and curl exposes" is a complete answer for that rung. A candidate who can name the failure at each layer has clearly debugged it, and that is what the question is for.
| Layer | What they listen for | A number | Failure to name |
|---|---|---|---|
| URL / browser | Scheme → port 443; HSTS; cache and connection reuse before any network | 0 ms if cached | HSTS forcing HTTPS on a host without a cert |
| DNS | Cache chain; recursive vs authoritative; TTL; A vs AAAA | ~1 ms cached, 20–100 ms cold | NXDOMAIN, stale cache after a change, split-horizon |
| Routing / IP | Default gateway; longest-prefix match per hop; TTL decrements; NAT at the edge | ~10–15 hops, TTL 64 → ~50 | No route to host; NAT table exhaustion; MTU black hole |
| Link | ARP/ND finds the gateway MAC; MACs change each hop, IPs do not | 1 ARP round trip on a LAN | Wrong gateway; ARP failure = "destination host unreachable" |
| TCP | SYN/SYN-ACK/ACK; ISN; window; slow start; HOL blocking | 1 RTT to connect | Timeout (dropped) vs refused (RST); backlog overflow |
| TLS | SNI; certificate chain to a trusted root; key agreement; 1.3 = 1 RTT | 1 RTT (1.3), 2 (1.2) | Expired cert, name mismatch, missing intermediate, clock |
| HTTP | Request line, Host, headers; status codes; HTTP/2 multiplexing; keep-alive | 1 RTT + server time | 502/503/504 and which hop wrote them; 4xx as client faults |
| Server | LB → app → DB; accept(); worker model; the timeout ladder | p50 20 ms, p99 200 ms | Slow query → 504; crash → 502; health check flip → 503 |
| Response / render | Same path in reverse; browser parses HTML, fetches assets over the same connection | often 20–100 more requests | Mixed content, blocked assets, a CDN miss |
The return path and what happens after the first byte
Half-answers stop at "the server sends the response". Complete it: the response travels the reverse path — but not necessarily the reverse route, since each direction is routed independently — through the NAT mapping the outbound packet created, into the client’s kernel receive buffer, and up to the browser through the same socket. Then the browser parses HTML, discovers stylesheets, scripts and images, and issues a dozen or a hundred more requests, multiplexed on the same HTTP/2 connection (or on a small pool of HTTP/1.1 connections), most of them to a CDN whose DNS answer put an edge server a few milliseconds away. The first page load is dominated by round trips — DNS, TCP, TLS, then request — which is why Where the Time Goes: The Request Timeline is mostly about counting them.
End with the cross-domain picture if invited: the server side is a process the OS scheduled, reading from a socket via epoll, hitting a database whose buffer pool may or may not have the page — Capstone: A Server With 50,000 Concurrent Connections and Capstone: Three Seconds from Warsaw are the OS and together versions of this same walk.
- Return route ≠ reverse of the forward route; NAT mapping from the outbound packet lets the reply in.
- The first request is RTT-bound: DNS + TCP + TLS + HTTP ≈ 3–4 round trips before the first byte.
- Subsequent assets reuse the connection; the CDN’s DNS answer decides how far they travel.
What weak answers do
They skip DNS or say "the browser looks up the IP" without saying where. They say "the packet is sent to the server" with no routing, no gateway, no NAT. They confuse TCP with TLS, or put the TLS handshake before the TCP one. They describe HTTP as "the request" without a method, a Host header or a status code. They say "the server processes it" and stop. And they cannot name a single failure at any layer, which is the difference between having read about the stack and having debugged it. The Why Can’t I Connect? ladder is this lesson’s debugging twin: every rung there is a failure to name here.
- Do: complete the chain first, expand on request, give a mechanism + a number + a failure per layer.
- Do not: start at the deepest layer you know; skip DNS or routing; confuse TCP and TLS ordering; stop at "the server responds".
Key points
- Tell the nine-step story first — URL, DNS, IP, routing, transport, TLS, HTTP, server, response — then expand only where asked.
- The advanced ladder makes the OS and link layers explicit: socket, kernel, IP, Ethernet/Wi-Fi, router/NAT, internet, destination.
- At each layer give a mechanism, a number and a failure; naming failures proves you have debugged it.
- The first byte costs ~3–4 round trips (DNS, TCP, TLS, HTTP); the rest of the page reuses the connection.
- The return route is independent of the forward route; NAT state from the outbound packet admits the reply.
- Weak answers skip DNS or routing, misorder TCP and TLS, and stop at "the server responds".
Why does this exist?
Mechanisms are answers to constraints. Open each question before reading the answer.
▸Why do interviewers keep asking this question?
It is the only question that touches every layer, has no single right depth, and exposes whether the candidate can choose an altitude, follow a prompt to zoom, and connect mechanisms to failures they have seen.
▸Why answer in rounds instead of dumping everything?
The interviewer has a specific layer they care about, and a complete overview lets them steer there. Front-loading detail hides the overview and wastes time on layers they were not going to probe.
▸Why a failure per layer?
Failures are where understanding is tested in practice. A layer you can break in your head is a layer you can debug in production; a layer you can only describe is a layer you have read about.
Capstone: visiting a URL
The browser parses the URL: scheme https means port 443. DNS turns example.com into an IP address. The client picks an address to connect to. Packets are forwarded router by router toward that address. TCP sets up a reliable connection with a three-way handshake. TLS negotiates encryption and proves the server's identity. The browser sends GET / and the server answers with a status and a body. A server process handles the request and builds the response. The response travels back and the browser renders it.
- Browser cache → OS resolver cache (getaddrinfo) → /etc/hosts
- Stub resolver asks the recursive resolver (from DHCP/VPN config) over UDP 53 / DoH
- Recursive resolver walks root → .com → authoritative if not cached; answers carry a TTL
- A and AAAA queried in parallel
How it fails
What the failure looks like from inside real software.
- Starting with TCP congestion control and running out of time before mentioning HTTP.
- Saying "DNS resolves the name" with no idea that the browser, OS and resolver each cache it separately.
- Placing TLS before TCP, or omitting SNI and then being unable to explain how one IP serves many certificates.
- Describing routing as "the packet goes to the server" and being unable to say what changes at each hop.
- Having no failure story at any layer — an answer that would not help during an outage.
Follow it through every layer
This lesson is one node of a longer journey. Zoom out, then zoom back in.