1. Layered Architecture
OSI (7): Physical → Data Link → Network → Transport → Session → Presentation → Application
TCP/IP (4): Network Access → Internet → Transport → Application
Why layers? Separation of concerns, modular design, easier debugging.
2. Transport Layer — TCP vs UDP
TCP
- Connection-oriented, reliable
- Flow control, congestion control
- Ordered delivery
- Uses: HTTP, SSH, FTP, email
UDP
- Connectionless, unreliable
- Low overhead, no ordering guarantee
- Uses: DNS, video streaming, VoIP, gaming
3-way handshake: SYN → SYN-ACK → ACK
4-way termination: FIN/ACK exchange
3. Network Layer & Routing
IP addressing: IPv4 (32-bit), IPv6 (128-bit), subnetting, CIDR
Routing algorithms
- Distance Vector (Bellman-Ford, RIP) — count to infinity problem
- Link State (Dijkstra, OSPF) — flooding LSAs
- Path Vector (BGP) — inter-AS
Congestion control (TCP): Slow Start, Congestion Avoidance, Fast Retransmit, Fast Recovery
4. Application Layer
- HTTP/HTTPS — request/response, methods GET/POST, status codes
- DNS — hierarchical name resolution (recursive/iterative)
- SMTP/IMAP/POP3 — email
- FTP — file transfer
- HTTPS — TLS handshake, certificates, encryption