Skip to content
Documentation Background

A web request, end to end

Almost every network fault shows up as “the page does not load.” This page follows one request from a laptop that has just been plugged in, through each protocol in order, so you can tell which stage broke. The addresses are examples: a LAN of 192.168.1.0/24, a gateway at 192.168.1.1, a DNS resolver at 198.51.100.53, and a web server at 203.0.113.10.

sequenceDiagram
    participant H as Laptop
    participant S as Switch
    participant G as Gateway and DHCP server
    participant D as DNS resolver
    participant W as Web server
    H->>S: 1. DHCP discover (broadcast)
    S->>G: flooded
    G->>H: 2. DHCP offer and ack (address, gateway, DNS)
    H->>G: 3. ARP for the gateway
    H->>D: 4. DNS query for app.example.com
    D->>H: answer 203.0.113.10
    H->>W: 5. TCP SYN, SYN-ACK, ACK
    H->>W: 6. TLS handshake
    H->>W: 7. HTTP request
    W->>H: HTTP response

A new host has no IP address and does not know who the gateway or DNS server is. It broadcasts a DHCP request. Each header layer is filled in with what the host does know:

LayerSourceDestination
EthernetThe laptop’s own MACff:ff:ff:ff:ff:ff (broadcast)
IP0.0.0.0255.255.255.255
UDPPort 68 (client)Port 67 (server)
DHCPDiscover or request message

The switch floods the frame out of every other port. As a side effect it learns that the laptop’s MAC is on the port it came from. The gateway, running the DHCP server (or a relay, covered in networking services), passes the payload up through IP and UDP to the DHCP process. The reply carries an address from its pool, the subnet mask, the default gateway, and the DNS server. It is sent back as a unicast frame to the laptop’s MAC, and since the switch has learned that MAC, it goes straight to the right port.

The laptop installs the address, adds a route to the gateway, and records the DNS server.

Terminal window
# What DHCP gave the host
ip addr show eth0 | grep inet
ip route show default
resolvectl status | grep -A1 'DNS Servers'
# Watch the exchange
sudo tcpdump -ni eth0 -e 'port 67 or port 68'
If it failsLikely cause
Address 169.254.x.xNo DHCP reply: server down, wrong VLAN, relay missing
Address but no routeThe lease lacks a gateway option
Wrong DNSStale or rogue DHCP server, or a bad option on the real one

To send anything outside 192.168.1.0/24, the laptop must put the gateway’s MAC in the frame. It broadcasts an ARP request for 192.168.1.1, and the gateway replies. (ARP explains the exchange.)

Terminal window
ip neigh show 192.168.1.1
# 192.168.1.1 dev eth0 lladdr 00:11:22:aa:bb:01 REACHABLE

If this shows FAILED or INCOMPLETE, the fault is at layer 2: the port, the VLAN, or the gateway itself.


The application asks the resolver library for app.example.com. The query is a UDP datagram to port 53 on the DNS server. It is addressed (at layer 3) to the DNS server, but framed (at layer 2) to the gateway, since the resolver is off-subnet. The gateway forwards it. The reply carries the A and AAAA records.

Terminal window
dig app.example.com +short
# 203.0.113.10
# See which server answered and how long it took
dig app.example.com | grep -E 'SERVER|Query time'
If it failsLikely cause
NXDOMAINThe name does not exist, or a search-domain mistake
TimeoutResolver unreachable, UDP/53 blocked, or resolver overloaded
Wrong addressStale cache, split-horizon view, or a CDN returning a regional address. See split horizon

With the address known, the client opens a TCP connection to 203.0.113.10 port 443. The destination MAC is still the gateway. The SYN crosses the internet, using routes built by the protocols in routing protocols. At the server, the SYN is delivered to the listening socket, and the operating system creates a connection socket for this client.

Terminal window
# Watch just the handshake
sudo tcpdump -ni eth0 'host 203.0.113.10 and tcp[tcpflags] & (tcp-syn|tcp-ack) != 0'
What you seeMeaning
SYN, then SYN-ACK, then ACKHealthy
SYN repeated, no replyPacket dropped by a firewall or routing fault. Retries back off 1, 2, 4 seconds
SYN answered by RSTReachable host, nothing listening on that port
Handshake completes but data stallsOften MTU or PMTU trouble

For HTTPS, the next step is the TLS handshake (how it works): agree on parameters, verify the server’s certificate, derive session keys. The browser then writes an HTTP request into the encrypted stream, and the server’s reply travels back as a series of TCP segments.

Terminal window
# One command that shows each stage with timings
curl -so /dev/null -w \
'dns %{time_namelookup}s connect %{time_connect}s tls %{time_appconnect}s first-byte %{time_starttransfer}s total %{time_total}s\n' \
https://app.example.com/
# dns 0.012s connect 0.045s tls 0.110s first-byte 0.190s total 0.205s

The timings are cumulative, so subtract the previous figure to get each stage’s own cost. A large DNS number points at the resolver, a large gap from connect to TLS at certificate or handshake problems, and a large gap before first byte at the application or the backend.


LayerProtocolJob in this exchange
ApplicationDHCP, DNS, HTTPConfiguration, name lookup, the request itself
SecurityTLSEncrypts and authenticates the session
TransportUDP, TCPDatagrams for DHCP and DNS, a reliable stream for HTTP
NetworkIP, ICMPEnd-to-end addressing and routing
LinkEthernet, ARPHop-by-hop delivery on each segment

The stages give an order of attack. Start at the bottom, and stop at the first stage that fails.

StepCheckCommand
LinkCable and speedip link, ethtool eth0
AddressLease and routeip addr, ip route
GatewayARP and pingip neigh, ping -c3 192.168.1.1
Beyond the gatewayRoutingping 203.0.113.10, mtr 203.0.113.10
NameDNSdig app.example.com
PortTCPnc -vz 203.0.113.10 443
Secure sessionTLSopenssl s_client -connect app.example.com:443
ApplicationHTTPcurl -v https://app.example.com/

The same sequence applies inside Kubernetes and cloud networks. A pod gets an address from the CNI instead of DHCP, a Service name resolves through cluster DNS, and the connection passes through a kube-proxy or eBPF layer, but the order of stages is unchanged.