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.com resolves to 203.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:

  1. 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 UP state, but has no IP address assigned (0.0.0.0).
  2. 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 destination 255.255.255.255.
    • Link: Ethernet frame with source MAC = laptop MAC → broadcast destination FF:FF:FF:FF:FF:FF.
  3. 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)
  4. DHCPREQUEST (Broadcast): The laptop broadcasts acceptance: "I accept the offer from server 192.168.1.1 for IP 192.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.
  5. DHCPACK (Unicast/Broadcast): The router confirms the lease and registers the client's hostname and MAC address.
  6. 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.

  1. Browser checks its DNS cache: empty.
  2. OS checks its DNS cache and /etc/hosts: empty.
  3. OS sends a DNS query (UDP, source port ~54000, destination 8.8.8.8:53) via the IP stack.
  4. IP layer decision: 8.8.8.8 is not on the local /24 → route to default gateway 192.168.1.1.
  5. 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.
  6. 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.
  7. 8.8.8.8 performs recursive resolution (root → .com TLD → example.com authoritative) and returns: A record 203.0.113.10 (illustrative), TTL 3600.
  8. 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:

  1. IP routing decision: 203.0.113.10 is not on the local /24 → send to default gateway 192.168.1.1.
  2. ARP: gateway's MAC is already in cache from step 1 — no new ARP needed.
  3. 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.
  4. 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.
  5. 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.
  6. SYN-ACK: server responds. NAT router translates dst 1.2.3.4:40001 back to 192.168.1.50:54321. Browser receives SYN-ACK.
  7. 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:

  1. ClientHello: browser sends supported cipher suites, TLS version 1.3, client random, ECDH key share (X25519 public key).
  2. 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).
  3. 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).
  4. 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

  1. Server decrypts the TLS record, parses the HTTP/2 HEADERS frame, reads the request.
  2. Server reads /index.html from disk or cache.
  3. Server sends back HTTP/2 HEADERS (status 200, content-type: text/html, content-encoding: br) + DATA frames with brotli-compressed HTML body.
  4. Browser decompresses, parses HTML, builds the DOM.
  5. 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.
  6. As JavaScript loads, it may fire XHR or fetch() calls for API data — more HTTP requests over the same or new connections.
  7. Eventually the Critical Rendering Path completes: DOM + CSSOM → Render Tree → Layout → Paint. Page appears.

Layer summary: one GET request end-to-end

LayerWhat happens on this requestPDUChanges at each hop?
ApplicationHTTP/2 GET request; TLS encrypts it; HPACK compresses headersHTTP messageNo (end-to-end)
Transport (TCP)Segments the message; adds ports (54321→443), seq/ack numbers, checksumSegmentNo (end-to-end)
Internet (IP)Adds src/dst IPs (192.168.1.50 → 203.0.113.10 illustrative); TTL decremented at each routerPacketTTL decrements; NAT rewrites src IP/port at border
Link (Ethernet)Wraps in frame; MAC addresses are next-hop onlyFrameYes — 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_L
Dst: FF:FF:FF:FF:FF:FF
Src: 0.0.0.0
Dst: 255.255.255.255
UDP Src: 68
Dst: 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_L
Dst: FF:FF:FF:FF:FF:FF
(EtherType 0x0806)
ARP Payload:
Sender IP: 192.168.1.50
Target 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_L
Dst: MAC_R_LAN
Src: 192.168.1.50
Dst: 8.8.8.8
UDP Src: 54000
Dst: 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_L
Dst: MAC_R_LAN
Src: 192.168.1.50
Dst: 203.0.113.10
(TTL = 64)
TCP Src: 54321
Dst: 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_WAN
Dst: MAC_ISP
Src: 198.51.100.1
Dst: 203.0.113.10
(TTL = 63)
TCP Src: 40001
Dst: 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

SymptomLikely layerDiagnosis
Can ping by IP but not by nameDNS (Application)dig example.com; check /etc/resolv.conf; check DNS reachability
DNS resolves but can't connectTCP (Transport) or IP routingtraceroute; check firewall rules; check port 443 with nc -zv
Connection established but hangsTLS or server-sidecurl -v https://…; check certificate validity; check server logs
High latency, variableIP routing / queuing delayping -c 100 for jitter; mtr to find the high-latency hop
Packet loss but link appears upPhysical or queuingping -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?

MAC addresses are link-local: each router decapsulates the frame, looks at the destination IP, then re-encapsulates with new src/dst MACs for the next hop. IP addresses remain constant end-to-end (unless NAT rewrites the source).

2. How many round trips are needed for a brand-new HTTPS connection (cold DNS, TLS 1.3)?

Cold start: ~1 RTT for DNS query/response + 1 RTT for TCP three-way handshake (SYN/SYN-ACK counted as one RTT before data) + 1 RTT for TLS 1.3 = at least 3 RTTs before the first byte of HTTP response. Cached DNS + QUIC/HTTP3 can reduce this to 1–2 RTTs.

3. You can ping a server by IP but not by hostname. Which layer is most likely the problem?

Successful ping-by-IP confirms IP connectivity is working. Failure by hostname points to DNS resolution. Check with 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?

Because the client has no assigned IP address yet, it uses 0.0.0.0 as the source IP. It broadcasts to the entire local subnet using the limited broadcast address 255.255.255.255 over UDP port 67.

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?

Per RFC 2131, the renewal timer T1 defaults to 50% of the lease duration (0.5 × 24 hours = 12 hours). The client sends a unicast DHCPREQUEST to the issuing server. If unacknowledged, it waits for timer T2 (87.5% = 21 hours) before broadcasting a rebind request to any available DHCP server.

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?

At the home NAT router boundary: (1) Source and Destination MACs are rewritten for the next link-layer hop (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.