Loading a web page sends a request through many layers of infrastructure, from a client device to a data center and back, typically in under 100 milliseconds. This is a bottom-up map of how that works, starting from raw bits on a wire and moving up through DNS, TLS, and HTTP.
The OSI model divides network communication into seven layers. Each layer passes data to the one above or below it.
| Layer | Name | What it does | Examples |
|---|---|---|---|
| 7 | Application | User-facing app interface | HTTP, DNS, FTP, SMTP |
| 6 | Presentation | Encoding, encryption, compression | TLS, JPEG, ASCII |
| 5 | Session | Opens/manages sessions between hosts | NetBIOS, RPC |
| 4 | Transport | End-to-end delivery, ports, reliability | TCP, UDP |
| 3 | Network | Logical addressing and routing | IP, ICMP, ARP |
| 2 | Data Link | Physical addressing on local network | Ethernet, MAC addresses |
| 1 | Physical | Raw bits over a medium | Cables, radio waves, fiber |
Layers 3, 4, and 7 matter most in practice. Layer-4 firewalls filter on ports. Layer-7 WAFs inspect HTTP content.
| TCP/IP Layer | OSI Layers |
|---|---|
| Application | 5, 6, 7 |
| Transport | 4 |
| Internet | 3 |
| Network Access | 1, 2 |
Data moving down the stack is encapsulated with a header. Moving back up the stack, each layer strips its own header off.
TCP is connection-oriented and begins with a three-way handshake before data flows:
TCP guarantees delivery, ordering, and error checking. Lost packets are retransmitted. It is used by HTTP, SSH, FTP, and SMTP.
UDP is connectionless. It has no handshake, no delivery guarantee, and no ordering, which makes it fast. It is used by DNS, DHCP, streaming, VoIP, and gaming.
TCP does not assume the network is reliable. The sender maintains a congestion window, a limit on unacknowledged bytes in flight.
Modern Linux systems use CUBIC; older systems use New Reno.
IPv4 addresses are 32 bits, written in dotted decimal notation (192.168.1.10), and consist of two parts:
The subnet mask defines the boundary between the two.
/24 (255.255.255.0) reserves 24 bits for the network and 8 bits for hosts.
| CIDR | Subnet Mask | Usable Hosts |
|---|---|---|
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /30 | 255.255.255.252 | 2 |
Each subnet reserves the network address (all host bits 0) and broadcast address (all host bits 1).
Private ranges (not routable on the public internet):
| Range | CIDR |
|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 |
Network Address Translation lets multiple devices share one public IP. The router maintains a translation table mapping internal ip:port pairs to the external address. Outbound traffic receives the public IP; responses are translated back.
DHCP automatically assigns IP addresses to devices, using UDP ports 67 (server) and 68 (client).
DORA process:
ARP resolves an IP address to a MAC address on the local network.
When a device needs to reach 192.168.1.5, it broadcasts a request asking which device owns that IP. The owner responds with its MAC address, and the pairing is cached in the ARP table.
arp -a
ARP includes no authentication, so any device can claim any IP. This enables ARP spoofing, where an attacker poisons nearby ARP caches to intercept traffic.
ICMP handles error reporting and diagnostics at the network layer and is not used for data transfer.
ping - sends ICMP Echo Requests to measure reachability and round-trip time.traceroute - increments the TTL to map each hop to a destination.ICMP is often rate-limited or blocked at firewalls.
DNS (Domain Name System) maps human-readable domain names to IP addresses. It is a hierarchical, distributed database, and no single server holds all the answers.
.com, with more than 130 million domains.Registering example.com involves the registrar notifying Verisign, which adds an NS record to the .com zone, making the domain resolvable.
Root (.)
└── TLD (.com, .org, .io)
└── Domain (google.com)
└── Subdomain (mail.google.com)
.com. They know which nameservers are authoritative for each domain.Resolving mail.google.com proceeds as follows:
8.8.8.8..com TLD nameservers..com TLD and receives Google's authoritative nameservers.mail.google.com.Recursive resolvers perform the lookup on behalf of the client. Authoritative servers answer with the actual records and do not forward requests.
Google returns multiple A records (IPv4) and AAAA records (IPv6). Browsers often race both in parallel using Happy Eyeballs, connecting through whichever responds first.
Every DNS record has a TTL (Time to Live) in seconds. Resolvers cache results until the TTL expires, then re-query. A lower TTL before a migration allows faster propagation; a higher TTL reduces load on nameservers.
| Record | Purpose |
|---|---|
| A | Domain → IPv4 address |
| AAAA | Domain → IPv6 address |
| CNAME | Alias from one name to another |
| MX | Mail server for the domain (with priority) |
| TXT | Arbitrary text - SPF, DKIM, domain verification |
| NS | Authoritative nameservers for the domain |
| PTR | Reverse lookup - IP → domain name |
| SOA | Zone metadata - primary NS, admin email, serial, refresh intervals |
| SRV | Service location - host, port, priority, weight |
| CAA | Which CAs are allowed to issue certs for the domain |
Standard queries use UDP port 53, which is fast and low overhead. TCP port 53 is used for:
DNSSEC adds cryptographic signatures to DNS records so resolvers can verify that a record actually came from the legitimate zone owner.
DNSSEC prevents cache poisoning but does not encrypt queries; that function belongs to DNS over HTTPS or TLS.
Standard DNS is transmitted in plaintext, so anyone on the path, such as an ISP or router, can see every domain being queried.
Both encrypt the query itself; the destination IP address remains visible.
Cache poisoning - injecting a forged record into a resolver's cache so victims are directed to an attacker-controlled IP. DNSSEC prevents this; randomized source ports and bailiwick rules reduce exposure.
DNS hijacking - compromising a registrar account or nameserver to change authoritative records. Registry locks and two-factor authentication on registrar accounts help prevent this.
DNS amplification - sending spoofed queries using the victim's IP as the source. The resolver sends large responses to the victim, a technique used in DDoS attacks.
DNS tunneling - encoding data inside DNS queries and responses to exfiltrate data or tunnel command-and-control traffic through firewalls that permit DNS.
dig google.com # basic A record lookup
dig google.com MX # query specific record type
dig @8.8.8.8 google.com # query a specific resolver
dig +trace google.com # follow the full resolution chain
dig -x 8.8.8.8 # reverse lookup (PTR)
nslookup google.com # simpler alternative to dig
whois google.com # registrar and registration info
HTTPS requires a TLS handshake over the TCP connection:
TLS 1.3 completes this exchange in one round trip; TLS 1.2 requires two.
The browser sends a GET request through the encrypted tunnel:
GET / HTTP/2
Host: www.google.com
User-Agent: ...
Accept: text/html
Accept-Encoding: gzip, br
Cookie: ...
HTTP/2 multiplexes multiple requests over a single TCP connection. HTTP/3 runs over QUIC (UDP), eliminating TCP head-of-line blocking entirely.
If the browser has a cached copy and previously received an ETag, it sends an If-None-Match header. The server responds with 304 Not Modified and no body, and the browser serves the cached version.
The server's response includes headers such as Strict-Transport-Security (HSTS), which instructs the browser to enforce HTTPS-only connections for future visits without waiting for a redirect.
Visiting https://example.com proceeds as follows:
example.com to an IP address.| Step | What happens |
|---|---|
| 0ms | Enter pressed |
| ~1ms | HSTS checked |
| ~5ms | DNS resolved (cache hit) or ~50–100ms (full resolution) |
| ~6ms | ARP resolves gateway MAC |
| ~15ms | TCP connection established |
| ~25ms | TLS handshake complete (TLS 1.3) |
| ~30ms | HTTP GET sent |
| ~70ms | First byte received (TTFB) |
| ~100ms+ | Page renders |