How the Internet works

From the book, chapter 1 of 36

One Click, Twelve Milliseconds

The opening as the audiobook reads it. 70 seconds, narrated by a synthetic voice.
Read what the voice says

Part one. Orientation. Chapter one. One Click, Twelve Milliseconds. It is a weekday evening, and someone on a sofa types www.example.net into a browser. The browser has never visited the site.

The server is about twelve milliseconds away, measured as a round trip. Before the first byte of the page comes back, the laptop does four things. It resolves a name, opens a TCP connection, negotiates TLS 1.3, and sends an HTTP/2 request. Each of the last three steps waits for one of those round trips.

The primary sources for this chapter are the host requirements of 1989, RFC 1122 and RFC 1123. The third is the ISO reference model for Open Systems Interconnection, or OSI. Two papers carry the design argument. Saltzer, Reed, and Clark wrote the 1984 paper on end-to-end arguments, and David Clark the 1988 account of the Internet's design philosophy. Three informational RFCs on architectural principles complete the list.

It is a weekday evening, and someone on a sofa types https://www.example.net/ into a browser that has never visited the site. The server is about 12 ms away, measured as a round trip. Before the first byte of the page comes back, the laptop resolves a name, opens a TCP connection, negotiates TLS 1.3, and sends an HTTP/2 request, and each of the last three steps waits for one of those round trips.

What happens between the click and the first byte?

Some of the work is done before the click. The laptop holds an IPv4 lease for 192.168.1.23 from the home router and the IPv6 address 2001:db8:a001:1::23, and its ARP cache already maps the router's address 192.168.1.1 to a MAC address. Finding the Neighbor: ARP, ICMP, and DHCP and IPv6: The Second Attempt show how it got there. For what follows, the scenario fixes three numbers: a round trip of about 4 ms to the resolver, one of 12 ms to the server, and 5 ms for the server to produce the page. The table ignores the laptop's own processing time.

Step The laptop sends The answer Arrives
DNS A, AAAA, and HTTPS queries to 198.51.100.53 Cached answers, NODATA for HTTPS 4 ms
Round trip 1 TCP SYN to port 443 SYN-ACK 16 ms
Round trip 2 ACK, then the ClientHello ServerHello up to the server's Finished 28 ms
Round trip 3 Finished, then the HTTP/2 GET / Response headers with alt-svc 45 ms
Next connection QUIC Initial to UDP port 443 QUIC Initial and Handshake packets

Table: The first exchanges of the scenario, with the time after the click at which each answer arrives

The browser starts with the name. It asks the ISP's resolver at 198.51.100.53 for the A, AAAA, and HTTPS records of www.example.net, and the A query leaves from UDP port 53124 with message ID 0x7a2b. The resolver sits inside AS64500, and in the scenario it answers from its cache: 192.0.2.80 and 2001:db8:c000:80::80, each with a TTL of 300 seconds. The HTTPS query gets NODATA, a NOERROR response with no record of that type (RFC 2308, Section 2.2), because www.example.net publishes none. An HTTPS record with h3 in its alpn list (RFC 9460, Section 7.1) would let the browser try QUIC on the first connection, which HTTP/3: The Web on QUIC takes up. Without one, the browser starts with TCP. DNS: The Namespace and the Wire Format decodes the query byte by byte, and Resolvers, DNSSEC, and Encrypted DNS follows a resolver with an empty cache through the tree.

Both ends have IPv6 addresses. RFC 8305, Section 3 has a dual-stacked client send the AAAA query first. The answers are then sorted by the rules of RFC 6724, Section 6, which put the IPv6 address ahead of the IPv4 one (RFC 8305, Section 4), and the two families race (RFC 8305, Section 5). A browser on this laptop would usually connect over IPv6. This book follows the IPv4 twin of the connection on purpose, because NAT, fragmentation, and most of the history live there; Living with Two Protocols shows the race.

Round trip 1 is the TCP handshake. In the IPv4 connection the SYN leaves 192.168.1.23:51514 for 192.0.2.80:443 about 4 ms after the click, the home router rewrites its source to 198.51.100.77:40001 on the way out, and the SYN-ACK arrives one round trip later. Those 12 ms are the twelve milliseconds of the chapter title, and TCP: The Connection takes the exchange apart.

Round trip 2 belongs to TLS 1.3. The ClientHello follows the laptop's ACK at once. It names www.example.net in the Server Name Indication extension (RFC 6066, Section 3) and offers h2 in the ALPN extension (RFC 7301). The server answers with one flight: ServerHello, then EncryptedExtensions, Certificate, CertificateVerify, and Finished, all encrypted after the ServerHello (RFC 9846, Section 2). TLS 1.3: The Handshake walks through that flight, and Certificates and the Web PKI asks why the laptop believes the certificate.

Round trip 3 carries the request. Behind its own Finished message, the laptop sends the 24-octet HTTP/2 connection preface (RFC 9113, Section 3.4), a SETTINGS frame, a WINDOW_UPDATE frame, and a HEADERS frame for GET /. The response headers include alt-svc: h3=":443", an offer to serve the same origin over HTTP/3 on UDP port 443 (RFC 7838, Section 3; RFC 9114, Section 3.1.1). The first byte of HTML arrives three round trips (36 ms) after the SYN left, plus the 5 ms the server needs to produce it. With the DNS lookup in front, that is about 45 ms after the click.

The browser then opens a second connection in the background; until its handshake completes, the next request may still use the open HTTP/2 connection. The new connection's first packet is a QUIC Initial from UDP port 53901, in a datagram whose UDP payload is padded to at least 1200 bytes (RFC 9000, Section 8.1). QUIC combines the transport and the cryptographic handshake (RFC 9000, Section 7), so this connection is ready one round trip sooner. The browser knows about HTTP/3 only from the alt-svc field of the first response. How it chooses between the two transports is a question for HTTP/3: The Web on QUIC, and the packet itself belongs to QUIC: A Transport in Userspace.

Try it: curl reports when each phase of a transfer ended. These lines come from evidence/ch01-curl-timing.txt, captured on 12 November 2026 against the real www.example.net, which is not the scenario's server. All times are seconds since the start of the transfer.

$ f2='dns=%{time_namelookup} tcp=%{time_connect} tls=%{time_appconnect}'
$ f2="$f2 first_byte=%{time_starttransfer} http=%{http_version}\n"
$ f3='dns=%{time_namelookup} first_byte=%{time_starttransfer} http=%{http_version}\n'
$ curl -so /dev/null --http2 -w "$f2" https://www.example.net/
dns=0.013388 tcp=0.024890 tls=0.040086 first_byte=0.058360 http=2
$ curl -so /dev/null --http2 -w "$f2" https://www.example.net/
dns=0.002851 tcp=0.014578 tls=0.029068 first_byte=0.045420 http=2
$ curl -so /dev/null --http3-only -w "$f3" https://www.example.net/
dns=0.002612 first_byte=0.040542 http=3
$ curl -sI --http2 https://www.example.net/ | grep -i -e '^HTTP' -e '^alt-svc'
HTTP/2 200 
alt-svc: h3=":443"; ma=86400

In the five HTTP/2 runs of the evidence file, the TCP handshake took between 11.5 and 13.0 ms, close to the scenario's round trip, and TLS and the request took about 15 and 17 ms more. DNS cost 13.4 ms on the first run and about 2.5 ms after that. Over HTTP/3 the first byte arrived after 39.0 to 42.1 ms, against 44.7 to 48.1 ms for the later HTTP/2 runs. The gain of about 6 ms is half a round trip, and this chapter leaves the reason open. The real site also sends the scenario's alt-svc header, with a lifetime of one day (ma=86400).

The sample ends here. Chapter 1 goes on with the networks the packet crosses and with its 74 bytes, one field at a time.

Get the book or the audiobook Follow the packet on this site