Interneturldnsroutingtcptls

What Happens When You Press Enter

Between pressing Enter on https://engineer-atlas.dev and seeing a page, a name becomes an address, an address becomes a path, a path carries a connection, the connection is secured, and only then does HTTP say a word — and each step has its own way of failing.

ConceptualBrowser

The problem

You typed a *name*, engineer-atlas.dev. The network only moves packets between numeric addresses over physical links, with no guarantee any packet arrives. How does the browser turn a name into a rendered page, and why does it take so many steps?

The whole ladder, once

Everything in the Networking domain is a zoom into one of these rungs. Read them once as a story: the browser has a URL; the URL names a host; the host has to become an IP address; the IP address has to be reachable through a chain of routers; once reachable, the two machines need a transport that turns unreliable packets into a reliable stream; the stream has to be encrypted and authenticated; and only then can HTTP ask for / and get bytes back that the browser turns into pixels.

Each rung is a separate mechanism with a separate failure. "The site is down" is never one thing: it is DNS returning nothing, or a route that black-holes, or a SYN with no SYN-ACK, or a certificate that expired at midnight, or a 502 from a proxy whose upstream died. The rest of the domain exists so that you can tell those apart in under a minute.

https://engineer-atlas.dev — the overview ladder
  1. Enter URLthe browser receives `https://engineer-atlas.dev`
    ↓
  2. Parse URLscheme `https`, host `engineer-atlas.dev`, port 443 implied, path `/`
    ↓
  3. DNS lookupname → IP address(es), via caches and resolvers
    ↓
  4. Choose destination IPIPv6 or IPv4? which of several answers? (Happy Eyeballs)
    ↓
  5. Routingeach router picks a next hop by longest-prefix match
    ↓
  6. Establish transportTCP three-way handshake, or QUIC over UDP
    ↓
  7. TLSkey agreement + certificate check; the name is verified here
    ↓
  8. HTTP request`GET / HTTP/2` with headers, inside the encrypted stream
    ↓
  9. Servera process behind a load balancer or proxy accepts, reads, computes
    ↓
  10. HTTP responsestatus, headers, body — streamed back over the same connection
    ↓
  11. Browserparse HTML, fetch sub-resources (repeat the ladder), render

From a string to an address

Enter URL / parse URL. The browser splits https://engineer-atlas.dev into a scheme (https, which fixes the default port 443 and the requirement for TLS), a host (engineer-atlas.dev), and a path (/, since none was given). Before touching the network it checks its own caches: an HSTS list that may force HTTPS, a cached HTTP response that may still be fresh, an existing open connection to the same origin that can be reused. Failures here are silent and cheap: a typo becomes a search, a stale cache becomes an old page.

DNS lookup. The host name is not an address. The browser asks the OS resolver, which asks a recursive resolver (your ISP’s, or 1.1.1.1, or a corporate one), which walks root → .dev TLD → the authoritative server for engineer-atlas.dev and returns A (IPv4) and AAAA (IPv6) records with a TTL. Most of the time the answer comes from a cache in a fraction of a millisecond; a cold lookup across the hierarchy costs tens of milliseconds. It fails as NXDOMAIN (the name does not exist), SERVFAIL (the resolver could not get an answer), a timeout (UDP port 53 blocked, resolver down), or, most insidiously, a stale cached answer pointing at a server that moved yesterday. See DNS: Why Names Need a Distributed Database and DNS Failure Modes: What Each One Looks Like.

Choose destination IP. DNS may return several addresses of two families. The browser races them: try IPv6 first, and if no connection is established within ~250 ms start IPv4 in parallel (Happy Eyeballs, RFC 8305). Whichever connects first wins. A broken IPv6 path on your network is why some sites feel "slow to start" by exactly a quarter of a second.

From an address to a path

Routing. Your machine does not know where engineer-atlas.dev’s server is. It knows one thing: whether the destination is on its own subnet (then deliver directly) or not (then hand the packet to the default gateway). The gateway does the same with a bigger table, and so on through your ISP, across an exchange point, into the hosting provider’s network. Every router independently looks up the destination prefix and forwards to a next hop — nobody holds the whole path. A packet across a continent crosses 10–20 routers in ~30–80 ms; across an ocean ~150 ms.

Routing fails by black-holing (a router has no route and drops silently, or a firewall drops without a reply), by loops (a misconfiguration that the TTL eventually catches), and by asymmetry (outbound and return paths differ, which is normal but confuses debugging). The symptom is almost always a timeout, never an error — see Why Can’t I Connect? and traceroute: Discovering the Path Hop by Hop.

From a path to a conversation

Establish transport. IP delivers packets, not conversations: they can be lost, reordered, duplicated. TCP builds a reliable, ordered byte stream on top with a three-way handshake (SYN → SYN-ACK → ACK, one round trip), sequence numbers and retransmission. HTTP/3 instead uses QUIC over UDP, which folds the transport and TLS handshakes into one round trip. Failure: SYN sent, nothing returned → connection timed out (a firewall, a dead host, a wrong route). SYN sent, RST returned → connection refused (the host is up but nothing listens on 443).

TLS. The stream is plaintext and unauthenticated; anyone on the path (the coffee-shop access point, your ISP) could read or alter it. TLS 1.3 performs a key agreement in one round trip and the server presents a certificate chaining to a root your browser trusts; the browser checks the name on it matches engineer-atlas.dev. Failures are loud and specific: NET::ERR_CERT_DATE_INVALID (expired), ERR_CERT_COMMON_NAME_INVALID (wrong name), a handshake alert on a protocol mismatch. See Why TLS Exists and Certificates and the Chain of Trust.

HTTP request. Only now does the browser send GET / with Host, Accept, User-Agent, cookies and a few dozen other headers — a few hundred bytes after roughly 2–3 round trips of setup. On HTTP/2 this is one stream on a multiplexed connection; on HTTP/1.1 it is the one request the connection can carry at a time.

The server, and the way back

Server. The packet arrives at an address that is very likely not the application at all but a load balancer or reverse proxy, which terminates TLS, picks a healthy backend, and opens (or reuses) a second connection to it. The backend process is blocked in accept() or epoll_wait(); the kernel wakes it, it reads the request, runs your code, perhaps queries a database, and writes a response. Failures here have their own vocabulary: 502 (the proxy could not reach the backend), 503 (overloaded or in maintenance), 504 (the backend took too long), 500 (your code threw).

HTTP response and browser. 200 OK, headers, then the body, flowing back through the same connection and the same routers in reverse. The browser starts parsing HTML before the body has finished arriving, discovers stylesheets, scripts and images, and runs the ladder again for each — usually on the same connection, sometimes to new hosts (a CDN), which means new DNS, new TCP, new TLS. A page that "loads slowly" with an idle server is usually dozens of these round trips, not compute; see Where the Time Goes: The Request Timeline.

  • Round trips are the currency: DNS (0–1), TCP (1), TLS 1.3 (1), request/response (1). At 150 ms RTT that is ~600 ms before the first byte of HTML, before any server work.
  • Every rung is cached to avoid repeating it: DNS caches, connection reuse, session resumption, HTTP caches, CDNs.

Key points

  • A URL names a host; the network moves packets between addresses. DNS bridges the gap, and it is the first thing that can fail.
  • No router knows the whole path. Each one does a longest-prefix lookup and forwards; the path emerges hop by hop.
  • IP is best-effort. TCP (or QUIC) turns packets into a reliable stream; TLS turns the stream into a private, authenticated one; HTTP is the last layer, not the first.
  • Each rung fails differently: NXDOMAIN, timeout, connection refused, certificate error, 502/504. Learn which symptom belongs to which rung.
  • Round trips, not bandwidth, dominate the time to first byte. Caching at every layer exists to avoid repeating rungs.
  • What you connect to is usually a load balancer or proxy, not the application process.

Why does this exist?

Mechanisms are answers to constraints. Open each question before reading the answer.

▸Why not just address servers by name and skip DNS?

Routers forward on fixed-length numeric prefixes that aggregate; names are variable-length, hierarchical in the wrong direction, and owned by different people than the networks that carry them. DNS decouples "what is it called" from "where is it right now", which is what lets a site move hosts without every client changing.

▸Why so many round trips before the first byte?

Each layer solves one problem and refuses to trust the layer below: DNS finds the address, TCP establishes reliability, TLS establishes identity and secrecy. QUIC and TLS 1.3 exist precisely to fold these into fewer trips.

▸Why does "the site is down" need a whole domain to debug?

Because the same user-visible symptom — a spinner — is produced by at least six mechanically different faults in six different systems owned by different people, and the fix for each is different.

Press Enter

visit
Press Enter
Eleven steps hide behind one key. Warm visits skip three of them by caching and reusing.
🔒https://engineer-atlas.devSimulated
  1. ↓
  2. ↓
  3. ↓
  4. ↓
  5. ↓
  6. ↓
  7. ↓
  8. ↓
  9. ↓
  10. ↓
Enter URL: You press Enter; the browser decides this is a navigation, not a search, and starts a request.
this step
0 µs
elapsed
0 µs
total to pixels
181 ms
Timeline bar: width ∝ simulated ms; DNS / TCP / TLS are round-trip bound, the server and render are compute bound.
1/11 · Enter URL

How it fails

What the failure looks like from inside real software.
Reference · show
  • Stale DNS: the site moved, your resolver still caches the old address; some users see the old server for up to the TTL.
  • Connection timed out: SYN sent, nothing returns — a firewall dropping silently, a dead route, or a host that is off. Distinguish it from "connection refused" (a RST came back, so the host is reachable).
  • Certificate error the morning after: the certificate expired at 00:00 UTC; every client fails at once while the server itself is perfectly healthy.
  • 502 Bad Gateway: the proxy answered, the application behind it did not. The network and TLS were fine.
  • IPv6 half-broken: AAAA records exist, the IPv6 path is dead; Happy Eyeballs recovers after ~250 ms, so the site is "slow" rather than "down".
  • A fast server and a slow page: 30 sub-resources on 5 hosts, each paying DNS + TCP + TLS on a 150 ms RTT.

Follow it through every layer

This lesson is one node of a longer journey. Zoom out, then zoom back in.
Reference · show

Check yourself

Answer out loud or on paper first, then compare. These come from the interview questions linked to this lesson.

  1. What happens when you type a URL into your browser and press Enter? Take it as deep as you can.

    Show a strong 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 → .dev TLD → the authoritative nameserver and caches the answer for its TTL. Both A (IPv4) and AAAA (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 replies SYN-ACK, the client ACKs — 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 sends RST and 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 NXDOMAIN or a stale address; the route is missing; the SYN is dropped (timeout) or refused (RST); the certificate expired at midnight; the proxy returns 502 because the upstream is down. "The site is down" is never one thing.

    Full interview question, with follow-ups and red flags →
  2. ping api.example.com times out, but curl https://api.example.com/ returns 200 from the same machine. Explain how both can be true, and what ping actually proves in each direction.

    Show a strong answer

    ping sends an ICMP Echo Request (protocol 1 on IPv4, ICMPv6 type 128 on IPv6) and waits for an Echo Reply; curl opens a TCP connection to port 443 (protocol 6). These are different IP protocols, and every filter on the path — host firewall, cloud security group, network ACL, the load balancer’s own stack — decides about them separately. An AWS security group that allows TCP 443 and says nothing about ICMP drops the echo silently; Windows blocks incoming echo by default; many load balancer VIPs and anycast addresses never answer ICMP at all because nothing behind the VIP is a "host". The name may also resolve to a CDN or LB address that is not the machine running the service. So the ping proves nothing about the service, and the 200 proves the entire path — DNS, routing, TCP, TLS, HTTP — works. See ping: What an Echo Actually Proves and Firewalls.

    What ping *does* prove: a reply means IP-level reachability in both directions and gives an RTT and loss estimate *for ICMP*. A timeout means only that an echo did not come back — the host may be down, or the echo may be filtered outbound, at the destination, or on the return path, or rate-limited. Routers commonly process ICMP on a slow control-plane path and rate-limit it, so ping RTT and loss can look worse than the forwarding plane actually is. The reverse case is equally common: ping succeeds and the service is down — the host is up but nothing listens (connection refused), or the port is filtered (timed out), or TLS fails, or the process is hung and accepts connections it never answers. Each of those is a different layer (Why Can’t I Connect?).

    The right tools test the layer you care about: nc -vz host 443 or curl -v --connect-timeout 3 for TCP reachability, openssl s_client for TLS, curl -sS -o /dev/null -w "%{http_code}" for HTTP, mtr -T -P 443 or tcptraceroute to trace the path *using TCP to the real port* so ICMP filters do not produce * * * at every hop, and nmap -Pn to skip the host-discovery ping that would otherwise report "host down". A monitoring check that pings hosts is measuring a different thing from the service it is meant to watch.

    Full interview question, with follow-ups and red flags →
  3. Where can this fail so that the user sees "connection timed out" rather than an error page?

    Show a strong 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 →