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.
You have not marked these as done yet. Read on anyway if they feel familiar; come back to them if something here does not land.
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.Reference · showHide
- 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.Reference · showHide
Check yourself
Answer out loud or on paper first, then compare. These come from the interview questions linked to this lesson.
What happens when you type a URL into your browser and press Enter? Take it as deep as you can.
Show a strong answerHide the answer
First the browser parses the URL: scheme (
https), host (engineer-atlas.dev), an implied port (443), path and query. It checks HSTS and its own caches — if it has a fresh cached response it may not touch the network at all. Then it needs an IP for the host: the browser cache, the OS resolver cache (and/etc/hosts), then a recursive resolver (from DHCP or configured, e.g.1.1.1.1) which, on a miss, walks root →.devTLD → the authoritative nameserver and caches the answer for its TTL. BothA(IPv4) andAAAA(IPv6) are asked for; the browser races them (Happy Eyeballs) and prefers IPv6 when it connects first.With an address, the OS opens a TCP connection: it consults the routing table (longest-prefix match — is the destination on-link or via the default gateway?), resolves the gateway’s MAC via ARP (IPv4) or Neighbor Discovery (IPv6), and sends a
SYN. Every router on the path does the same lookup and forwards; the destination repliesSYN-ACK, the clientACKs — one round trip before any data. If the SYN is dropped by a firewall the client just retransmits until it times out; if nothing listens the server’s kernel sendsRSTand you get "connection refused" instantly.For HTTPS, the TLS handshake runs next: the client sends its supported versions, cipher suites, a key share and the hostname (SNI); the server picks parameters, returns its key share and certificate chain; the client validates the chain up to a root it trusts, checks the name and dates, and both derive the session keys. TLS 1.3 does this in one round trip; a resumed session can send data in the first flight. Then the browser sends the HTTP request — over HTTP/2 if ALPN negotiated it, as a stream on that one connection — with headers, cookies, and compression preferences.
On the server side the packet is usually received by a load balancer or reverse proxy (which may terminate TLS), routed to an application process, which reads the request from its socket, does its work (database, cache), and writes a response. The response travels back, the browser parses status and headers (redirect? cache it? set cookies?), decompresses the body, starts parsing HTML progressively, discovers stylesheets, scripts and images, and issues more requests — reusing the same connection — while building the DOM, computing styles and layout, and painting.
What matters is that each rung has its own failure: DNS returns
Full interview question, with follow-ups and red flags →NXDOMAINor a stale address; the route is missing; the SYN is dropped (timeout) or refused (RST); the certificate expired at midnight; the proxy returns502because the upstream is down. "The site is down" is never one thing.Describe what happens to an HTTP request as it goes down the stack on the sender and up on the receiver. What does each layer add and why?
Show a strong answerHide the answer
The application writes an HTTP message — text headers and a body — into a socket. TCP treats it as a byte stream, splits it into segments no larger than the MSS (typically 1460 bytes on Ethernet without options), and prefixes each with a header carrying source and destination ports (which process), a sequence number (where these bytes belong in the stream), an acknowledgement number, flags and the receive window. TCP’s header solves TCP’s problem: reliable ordered delivery between two processes.
IP wraps each segment with source and destination IP addresses, a TTL/hop limit, a protocol number (6 = TCP) and, for IPv4, a header checksum and fragmentation fields; IPv6 has a fixed 40-byte header and pushes rarely used fields into extension headers. IP’s job is getting the packet to the right host across many networks; it neither knows nor cares what is inside. The link layer (Ethernet) adds source and destination MAC addresses and a frame check sequence — its problem is getting the frame across one physical segment to the next hop.
On the wire the frame is bits. At each router the Ethernet header is stripped and a new one written with the next hop’s MAC — so MAC addresses change at every hop while the IP addresses stay constant end to end (unless NAT rewrites them). The IP TTL is decremented. On the destination host the process reverses: the NIC checks the frame, IP verifies the address and hands the payload to TCP by protocol number, TCP finds the socket by the 4-tuple and reassembles the byte stream, and the application
Full interview question, with follow-ups and red flags →read()s an HTTP message identical to what was written.Where can this fail so that the user sees "connection timed out" rather than an error page?
Show a strong answerHide the answer
Any step where nothing answers: no route, SYN dropped by a firewall, host down, MTU black hole. A refusal or an HTTP error means something *did* answer.
Full interview question, with follow-ups and red flags →