Putting It Together: A Complete Web Request
This chapter synthesises everything we've covered. You type https://www.example.com/index.html into a browser and press Enter. Here is what happens — at every layer — from keystroke to rendered page. This is one of the most commonly asked technical interview questions in networking, and understanding it deeply means you genuinely understand how the internet works.
Starting conditions (assumed)
- Your laptop: IP 192.168.1.50, subnet /24, default gateway 192.168.1.1, DNS server 8.8.8.8.
- All ARP caches are empty, all DNS caches are empty.
www.example.comresolves to203.0.113.10— an illustrative address from RFC 5737 TEST-NET-3 (documentation range, not a real server).
Step 0: Bootstrapping and host configuration (DHCP)
Before your browser can execute any DNS lookup or open a TCP socket, your computer must first acquire an identity on the local network. In technical discussions, engineers often assume that the client already has an IP address, default gateway, and DNS server. Here is what happens in the seconds prior when you connect an Ethernet cable or associate with a Wi-Fi network:
- Link-layer establishment: The physical link activates (Ethernet pulses detect carrier, or the Wi-Fi radio completes 802.11 association and the 4-way WPA2/WPA3 handshake). The network interface enters the
UPstate, but has no IP address assigned (0.0.0.0). - DHCPDISCOVER (Broadcast): The operating system's DHCP client broadcasts a request looking for any available DHCP server:
- Transport: UDP datagram with source port 68 (bootpc) → destination port 67 (bootps).
- Network: IPv4 packet with source IP
0.0.0.0→ limited broadcast destination255.255.255.255. - Link: Ethernet frame with source MAC = laptop MAC → broadcast destination
FF:FF:FF:FF:FF:FF.
- DHCPOFFER: The DHCP server (running on the local home router at
192.168.1.1) receives the broadcast and selects an available IP from its pool:- Offered IP:
192.168.1.50 - Subnet mask:
255.255.255.0(/24) - Default gateway (Router):
192.168.1.1 - DNS resolver:
8.8.8.8 - Lease duration: 86,400 seconds (24 hours)
- Offered IP:
- DHCPREQUEST (Broadcast): The laptop broadcasts acceptance: "I accept the offer from server
192.168.1.1for IP192.168.1.50." This is broadcast so that any other DHCP servers on the subnet know their tentative offers were declined and can release reserved IPs. - DHCPACK (Unicast/Broadcast): The router confirms the lease and registers the client's hostname and MAC address.
- Duplicate Address Detection (DAD) via Gratuitous ARP: Before binding the address, the laptop broadcasts a Gratuitous ARP request asking "Who has 192.168.1.50?". If no station replies within a short timeout, the IP is guaranteed unique on the local link.
The operating system binds 192.168.1.50/24 to the interface, installs a default route 0.0.0.0/0 via 192.168.1.1 in its kernel routing table, and writes nameserver 8.8.8.8 to /etc/resolv.conf. The laptop is now completely bootstrapped and ready to resolve names.
Step 1: DNS resolution
The browser needs an IP address for www.example.com.
- Browser checks its DNS cache: empty.
- OS checks its DNS cache and /etc/hosts: empty.
- OS sends a DNS query (UDP, source port ~54000, destination 8.8.8.8:53) via the IP stack.
- IP layer decision: 8.8.8.8 is not on the local /24 → route to default gateway 192.168.1.1.
- ARP lookup: no ARP entry for 192.168.1.1 → broadcast ARP request on the LAN. The gateway replies with its MAC, e.g.
aa:bb:cc:11:22:33. - Link layer: DNS query is wrapped: UDP segment → IP packet (src:192.168.1.50, dst:8.8.8.8) → Ethernet frame (src: laptop MAC, dst: gateway MAC). Sent to switch → switch forwards to gateway port → gateway forwards toward 8.8.8.8.
- 8.8.8.8 performs recursive resolution (root → .com TLD → example.com authoritative) and returns: A record
203.0.113.10(illustrative), TTL 3600. - DNS response arrives, OS caches it, browser caches it.
Time taken: typically 10–50 ms for a cold DNS lookup; <1 ms if cached.
Step 2: TCP connection to port 443
With 203.0.113.10 (our illustrative server IP) known, the browser opens a TCP connection to port 443:
- IP routing decision: 203.0.113.10 is not on the local /24 → send to default gateway 192.168.1.1.
- ARP: gateway's MAC is already in cache from step 1 — no new ARP needed.
- SYN: browser sends TCP SYN, src port ~54321 (ephemeral), dst port 443. The IP packet has src 192.168.1.50 and dst 203.0.113.10.
- NAT at the gateway: home router translates 192.168.1.50:54321 → public IP (e.g. 1.2.3.4):40001. Enters this mapping in its NAT table.
- Internet routing: packets traverse multiple ISP routers; routing tables determine the path; each router decrements TTL and forwards based on longest prefix match. MACs change at every hop; IP addresses stay constant.
- SYN-ACK: server responds. NAT router translates dst 1.2.3.4:40001 back to 192.168.1.50:54321. Browser receives SYN-ACK.
- ACK: browser sends ACK. TCP connection ESTABLISHED.
Time taken: one RTT for the handshake. London→New York ≈ 80 ms RTT.
Step 3: TLS 1.3 handshake
Because the URL is HTTPS, the browser now negotiates TLS over the established TCP connection:
- ClientHello: browser sends supported cipher suites, TLS version 1.3, client random, ECDH key share (X25519 public key).
- ServerHello + {Certificate + CertificateVerify + Finished}: server selects cipher suite, sends its certificate chain and its ECDH public key. Both sides independently compute the shared secret and derive the same session keys (HKDF).
- Browser verifies the certificate: checks it was signed by a trusted CA (from the OS/browser trust store), checks the hostname matches, checks it's not expired or revoked (OCSP stapling or CRL).
- Client Finished: browser confirms. Encrypted channel is open.
Time taken: 1 RTT (TLS 1.3). Total so far: DNS + TCP handshake + TLS handshake = roughly 3 RTTs from a cold start.
Step 4: HTTP/2 request
:method: GET :path: /index.html :scheme: https :authority: www.example.com accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-encoding: gzip, deflate, br accept-language: en-US,en;q=0.5 user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:120.0) …
This HTTP/2 HEADERS frame is encrypted inside the TLS record, which is a TCP segment, which is an IP packet, which is an Ethernet frame — four layers of encapsulation over the wire.
Step 5: Server response and page rendering
- Server decrypts the TLS record, parses the HTTP/2 HEADERS frame, reads the request.
- Server reads
/index.htmlfrom disk or cache. - Server sends back HTTP/2 HEADERS (status 200, content-type: text/html, content-encoding: br) + DATA frames with brotli-compressed HTML body.
- Browser decompresses, parses HTML, builds the DOM.
- HTML references CSS, JavaScript, images. Browser fires additional requests — each resource may be a new HTTP/2 stream on the same TLS+TCP connection (or a new QUIC stream on HTTP/3). Some resources may come from other origins (CDN, fonts, analytics), requiring new DNS+TCP+TLS for each distinct hostname.
- As JavaScript loads, it may fire XHR or fetch() calls for API data — more HTTP requests over the same or new connections.
- Eventually the Critical Rendering Path completes: DOM + CSSOM → Render Tree → Layout → Paint. Page appears.
Layer summary: one GET request end-to-end
| Layer | What happens on this request | PDU | Changes at each hop? |
|---|---|---|---|
| Application | HTTP/2 GET request; TLS encrypts it; HPACK compresses headers | HTTP message | No (end-to-end) |
| Transport (TCP) | Segments the message; adds ports (54321→443), seq/ack numbers, checksum | Segment | No (end-to-end) |
| Internet (IP) | Adds src/dst IPs (192.168.1.50 → 203.0.113.10 illustrative); TTL decremented at each router | Packet | TTL decrements; NAT rewrites src IP/port at border |
| Link (Ethernet) | Wraps in frame; MAC addresses are next-hop only | Frame | Yes — MACs change at every single hop |
Complete packet trace: Exact MAC, IP, and Port headers at every stage
Consider the journey of a client retrieving https://www.example.com. The client is a Laptop (IP: 192.168.1.50, MAC: MAC_L) connected to a Home Router (LAN IP: 192.168.1.1, LAN MAC: MAC_R_LAN; Public WAN IP: 198.51.100.1, WAN MAC: MAC_R_WAN). The ISP next-hop router has MAC MAC_ISP, the recursive DNS server is 8.8.8.8, and the web server is 203.0.113.10:
| Stage / Packet | Layer 2 (Ethernet Frame) | Layer 3 (IP Packet) | Layer 4 (Transport) | Notes & Rewriting |
|---|---|---|---|---|
| 1. DHCPDISCOVER (Laptop → Local LAN) |
Src: MAC_LDst: FF:FF:FF:FF:FF:FF |
Src: 0.0.0.0Dst: 255.255.255.255 |
UDP Src: 68Dst: 67 |
Limited broadcast. Laptop has no IP yet; searches for any DHCP server on the local link. |
| 2. ARP Request for Gateway (Laptop → Local LAN) |
Src: MAC_LDst: FF:FF:FF:FF:FF:FF(EtherType 0x0806) |
ARP Payload: Sender IP: 192.168.1.50Target IP: 192.168.1.1 |
(None — ARP operates directly over Link Layer) | Broadcast query: "Who has 192.168.1.1? Tell 192.168.1.50". Router replies unicast with MAC_R_LAN. |
| 3. DNS Query (Laptop → Home Router) |
Src: MAC_LDst: MAC_R_LAN |
Src: 192.168.1.50Dst: 8.8.8.8 |
UDP Src: 54000Dst: 53 |
Frame addressed to router's LAN MAC; IP packet addressed to remote DNS resolver 8.8.8.8. |
| 4. TCP SYN on LAN (Before NAT at Home Router) |
Src: MAC_LDst: MAC_R_LAN |
Src: 192.168.1.50Dst: 203.0.113.10(TTL = 64) |
TCP Src: 54321Dst: 443 |
Private LAN packet. Handed off to Home Router's internal switch port for forwarding to WAN. |
| 5. TCP SYN on WAN (After SNAT/PAT leaving Router) |
Src: MAC_R_WANDst: MAC_ISP |
Src: 198.51.100.1Dst: 203.0.113.10(TTL = 63) |
TCP Src: 40001Dst: 443 |
NAT Transformation: Src IP rewritten to public WAN IP; Src Port translated to 40001; TTL decremented by 1; L2 rewritten for ISP next hop; Checksums recalculated. |
Common things that can go wrong
| Symptom | Likely layer | Diagnosis |
|---|---|---|
| Can ping by IP but not by name | DNS (Application) | dig example.com; check /etc/resolv.conf; check DNS reachability |
| DNS resolves but can't connect | TCP (Transport) or IP routing | traceroute; check firewall rules; check port 443 with nc -zv |
| Connection established but hangs | TLS or server-side | curl -v https://…; check certificate validity; check server logs |
| High latency, variable | IP routing / queuing delay | ping -c 100 for jitter; mtr to find the high-latency hop |
| Packet loss but link appears up | Physical or queuing | ping -f (flood ping); check interface error counters with ip -s link show |
Key takeaways
- Step 0: DHCP (Discover → Offer → Request → Ack) assigns the host IP (0.0.0.0 → 192.168.1.50), default gateway (192.168.1.1), and DNS resolver (8.8.8.8); Gratuitous ARP validates absence of address conflicts.
- A single HTTPS page load involves: DNS lookup (3–50 ms cold), TCP handshake (1 RTT), TLS handshake (1 RTT), HTTP request/response — then dozens more for sub-resources.
- IP addresses stay constant end-to-end. MAC addresses change at every single hop.
- NAT at your home router rewrites the source IP+port transparently.
- Every layer you've studied participates in each and every request.
- Performance problems have a layer: DNS failures, routing failures, TCP connection failures, TLS errors, and application errors each have specific diagnostic tools.
Quick check — Chapter 6
1. In a typical HTTPS request from your laptop to a server on the internet, which part of the packet changes at every router hop?
2. How many round trips are needed for a brand-new HTTPS connection (cold DNS, TLS 1.3)?
3. You can ping a server by IP but not by hostname. Which layer is most likely the problem?
dig hostname or nslookup hostname.4. When a newly connected computer sends a DHCPDISCOVER message to obtain an IP configuration, what are the source and destination IPv4 addresses in the packet?
5. A DHCP server grants a laptop an IP address with a lease time of 24 hours (86,400 seconds). According to RFC 2131, at what elapsed time does the client first transition to the RENEWING state (timer T1) to extend its lease?
6. In the end-to-end web request scenario, your laptop (192.168.1.50, port 54321, MAC_L) sends a TCP SYN packet to a web server (203.0.113.10, port 443) through your home NAT router (LAN IP 192.168.1.1 / MAC_R_LAN; WAN IP 198.51.100.1 / MAC_R_WAN, which maps the flow to external port 40001). Which fields are modified when the home router forwards this packet onto the ISP WAN link?
MAC_R_WAN → MAC_ISP), (2) IPv4 TTL is decremented by 1 (e.g. 64 → 63), (3) Source IP and Source Port are rewritten by NAPT/PAT from private (192.168.1.50:54321) to public (198.51.100.1:40001), and (4) both IPv4 and TCP checksums are recomputed to reflect the modified header fields.