Lessons in this course (12)

1. OSI and TCP/IP models — layers of a network

Basic★ Must knowLesson 1 of 12
OSI layerTCP/IP layerWhat it doesExamples
7 ApplicationApplicationData your app understandsHTTP, HTTPS, DNS, SMTP, FTP, SSH
6 PresentationApplicationEncoding, encryption, compressionTLS, UTF-8, gzip
5 SessionApplicationSessions between apps(handled by TLS/HTTP today)
4 TransportTransportEnd-to-end delivery between portsTCP, UDP, QUIC
3 NetworkInternetAddressing and routing between networksIP (v4/v6), ICMP (ping), routers
2 Data linkLinkDelivery on the local network (frames, MAC addresses)Ethernet, Wi-Fi, switches, ARP
1 PhysicalLinkBits on the wire/airCables, fibre, radio

Encapsulation: your HTTP request is wrapped in a TCP segment (adds ports), then an IP packet (adds IP addresses), then an Ethernet/Wi-Fi frame (adds MAC addresses). Each router unwraps to layer 3, decides the next hop, and wraps again. The receiver unwraps in reverse order.

text
[ Ethernet header | IP header (src/dst IP) | TCP header (src/dst port) | HTTP: GET /orders ... | trailer ]

Interview tip: Asked "which layer?": a switch works at layer 2 (MAC), a router at layer 3 (IP), a load balancer at layer 4 (TCP/UDP) or layer 7 (HTTP — can route by URL/header), a firewall at 3–4 (WAF at 7).