Protocol Stack
November 2025
Layers
- Application
- Transport
- Network
- Link
- Physical
Application
HTTP, IMAP, SMTP, DNS
Transport
TCP
- Reliable
- Has flow control
- Congestion control
UDP
- Less Reliable
- No flow control, etc
Network
IP, routing protocols
Link
Ethernet, 801.11 (WiFi), PPP
Physical
Bits on the wire
HTTP
HTTP older then v3 uses TCP
- Client initiates TCP connection on port 80
- Client accepts TCP connection
- HTTP messages are exchanged
- TCP connection is closed
HTTP is stateless in the sense that the server maintains no information about prevoius requests
Persistence
There is non-persistent and persistent HTTP, in persistent HTTP a single TCP connection is opened and multiple objects can be sent over a singel TCP connection.
Persistence was introduced in HTTP 1.1
Methods
There are 4 HTTP request messages
- GET - GET a resource from the server
- POST - Generally used to create a resource
- HEAD - Request headers of a response if it were to be requested with GET
- PUT - Often used to replace/update an object
HTTP/2
HTTP1.1 introduced multiple, pipelined GETs over a single TCP connection:
- Server uses FCFS scheduling for responses
This isn’t super-ideal, and as such HTTP/2 increased server flexibility for sending responses:
- Transmision order now based on client-specified priority (not locked to FCFS)
- push unrequested objects to clients
- objects can be divided into frames, avoid HOL blocking (head of line blocking caused by TCP retransmission of large objects)
HTTP/3
Based on QUIC, it adds security, pipelining and runs over UDP
Email consists of 3 main protocols:
- SMTP handles the delivery and storage of emails on servers
- IMAP handles messages stored on the server (retrieval, deletion, etc)
- POP3 handles message downloading (often deletes messages once they are downloaded)
HTTP is often used for web-interfaces to mailservers
DNS
DNS is an incredibly large distributed database
- Handles trillions of queries/day
- Physically decentralied
- “bulletproof”
Root Name Servers
- If no other server can resolve a name, the query is forwarded to a root name server
- DNSSEC provides integrity
- There are 13 “root servers” but they are actually replicated in the hundreds across their respective countries
- ICANN manages them
Hierarchy
- When you make a DNS request…
- First a local server is queried and answers if it can, otherwise…
- It queries a root DNS server…
- Which may query a TLD DNS server…
- Which may query the authoritative DNS server for that domain…
Responses are often cached for faster subsequent queries, cached items last for the TTL specified in the record
DNS Records
| type | description |
|---|---|
| A | Used to store an IPv4 address associated to a (sub)domain |
| NS | Used to specify an authoritative nameserver for a (sub)domain |
| CNAME | Used to specify a “canonical name” for a (sub)domain |
| MX | Used to specify an SMTP server associated with a (sub)domain |