Application Layer
HTTP, DNS, DHCP, TLS — the protocols you actually use
01HTTP
Request/response protocol. Methods (GET, POST, PUT, DELETE, PATCH), status codes (2xx success, 3xx redirect, 4xx client error, 5xx server error), headers, body.
HTTP Request / Response
GET /index.html HTTP/1.1 Host: example.com Accept: text/html
HTTP/1.1 200 OK Content-Type: text/html Content-Length: 1256 <html>...
02HTTP versions
HTTP/1.1 keep-alive, HTTP/2 multiplexing + header compression (HPACK), HTTP/3 over QUIC (UDP) eliminating head-of-line blocking.
03DNS
The internet's phonebook. Hierarchical: root → TLD → authoritative. Recursive resolvers cache results with TTL. DNS is UDP port 53 (TCP for large responses/zone transfer).
DNS Resolution (tree walk)
- 1Browser asks recursive resolver: what is example.com?
- 2Resolver asks Root server. Root replies: ask the .com TLD server.
- 3Resolver asks .com TLD. TLD replies: ask the authoritative server for example.com.
- 4Resolver asks authoritative server. It replies: 93.184.216.34.
- 5Resolver caches the answer (TTL) and returns it to the browser.
04DHCP
Dynamic Host Configuration Protocol: DORA (Discover, Offer, Request, Acknowledge) assigns IP, subnet mask, gateway, DNS. Lease times control renewal.
05TLS
Transport Layer Security: handshake negotiates cipher suite and keys, then encrypts application data. Provides confidentiality, integrity, authenticity via certificates.
TLS 1.3 Handshake
- 1ClientHello: supported ciphers, random, SNI
- 2ServerHello: chosen cipher, certificate, random
- 3Client verifies cert, sends key share (ECDHE)
- 4Both derive session keys; Finished messages
- 5Application data encrypted with AES-GCM
06Email protocols
SMTP (send), POP3/IMAP (receive). Ports 25/587 (SMTP), 110 (POP3), 143/993 (IMAP). Modern email adds TLS and DKIM/SPF/DMARC for authenticity.
07SSH
Secure Shell: encrypted remote terminal (port 22). Replaces Telnet. Supports key-based auth, port forwarding, tunneling.