OSI Model
OSI 7 layers overview
- A conceptual model to reason about networking, from physical signals up to application data.
- Layers: 1 Physical, 2 Data Link, 3 Network, 4 Transport, 5 Session, 6 Presentation, 7 Application.
Physical -> Application layer breakdown
- L1 Physical: bits on wire/radio (cables, Wi‑Fi PHY, optics).
- L2 Data Link: frames on a local segment (Ethernet, MAC addresses, switching).
- L3 Network: packets across networks (IP addressing/routing).
- L4 Transport: end-to-end transport (TCP/UDP ports, reliability).
- L5 Session: session management (often folded into app/TLS in practice).
- L6 Presentation: encoding/serialization, encryption (often TLS, JSON, Protobuf).
- L7 Application: protocols like HTTP, DNS, SSH.
What happens at each layer in real systems
- Your browser sends HTTP (L7) over TLS (L6-ish) over TCP (L4) over IP (L3) over Ethernet/Wi‑Fi (L2/L1).
- Debugging: pick the layer where symptoms begin (e.g., DNS issue vs TCP timeout vs HTTP 500).
Encapsulation & decapsulation
- Each layer wraps the payload with its own header (and sometimes trailer): encapsulation.
- On receive, headers are removed in reverse: decapsulation.
- Example: HTTP message → TCP segment → IP packet → Ethernet frame.
Why OSI matters in debugging
- Helps isolate failures: “Is it name resolution (DNS/L7), connectivity (IP/L3), handshake (TCP/L4), or app (HTTP/L7)?”
- Guides tool choice:
ping/traceroute (L3), tcpdump (L2+), curl (L7).