For senior engineers, the Open Systems Interconnection (OSI) model isn't just a textbook diagram; it's a mental framework for isolation. When a microservice times out or a packet drops, knowing exactly which layer is responsible is the difference between a 5-minute fix and a 5-hour outage.
The 7 Layers & PDUs
Data moves down the stack (Encapsulation) and up the stack (Decapsulation). At each layer, a Protocol Data Unit (PDU) is formed.
| Layer | Name | PDU | Function & Examples |
|---|---|---|---|
| 7 | Application | Data | High-level APIs. HTTP, DNS, SSH, gRPC. |
| 6 | Presentation | Data | Encoding/Encryption. SSL/TLS (often grouped here), JSON serialization. |
| 5 | Session | Data | Session state. RPC mapping, NetBIOS. |
| 4 | Transport | Segment/Datagram | End-to-end reliability/flow control. TCP, UDP, Ports. |
| 3 | Network | Packet | Routing/Addressing. IP (IPv4/IPv6), ICMP, IPSec. |
| 2 | Data Link | Frame | Node-to-node transfer. Ethernet, MAC addresses, VLANs, ARP. |
| 1 | Physical | Bit | The wire/signal. Fiber, Copper, WiFi radio waves. |
Encapsulation in Action
When your application sends an HTTP GET request:
- L7: Construction of the HTTP payload.
- L4: TCP header added (Source Port: 54321, Dest Port: 80). PDU: Segment.
- L3: IP header added (Source IP: 192.168.1.5, Dest IP: 93.184.216.34). PDU: Packet.
- L2: Ethernet header (Source MAC, Gateway MAC) and FCS trailer added. PDU: Frame.
- L1: Frame serialized into electrical pulses on the wire.
Troubleshooting with tcpdump
We can verify this encapsulation by inspecting PDUs directly.