Skip to main content

OSI Model

Context & Purpose

The Open Systems Interconnection (OSI) Model is a conceptual framework that standardizes the functions of a telecommunication or computing system into seven distinct abstraction layers. It exists to allow diverse communication systems to interoperate using standard protocols.

Mechanism / Architecture

The model splits communication into 7 layers, where each layer serves the one above it and is served by the one below it.

Flow Note: Data flows DOWN for transmission (Encapsulation) and UP for reception (Decapsulation).

Layer Breakdown & PDU (Protocol Data Units)

  1. Physical (PDU: Bits): Transmission of raw bit streams (Cables, Radio).
  2. Data Link (PDU: Frames): Node-to-node transfer (MAC, Ethernet).
  3. Network (PDU: Packets): Routing and addressing (IP, routers).
  4. Transport (PDU: Segments): End-to-end connections and reliability (TCP, UDP).
  5. Session (PDU: Data): Connection management between applications.
  6. Presentation (PDU: Data): Data formatting and encryption.
  7. Application (PDU: Data): Network process to application (HTTP, DNS).

Analysis & Trade-offs

Pros

  • Separation of Concerns: Engineers can focus on one layer (e.g., building a React app) without worrying about how bits are transmitted over wire.
  • Interoperability: Different vendors can build hardware/software that works together if they follow the standard.

Cons

  • Theoretical vs. Practical: The TCP/IP model is the standard implementation.

OSI vs. TCP/IP Comparison

OSI LayerTCP/IP LayerPDU
7. ApplicationApplicationData
6. PresentationApplicationData
5. SessionApplicationData
4. TransportTransportSegment / Datagram
3. NetworkInternetPacket
2. Data LinkNetwork AccessFrame
1. PhysicalNetwork AccessBit
  • Overhead: Strict adherence to all layers can introduce latency.

Real-world Usage

  • Troubleshooting: "Is it a Layer 1 issue?" (Is the cable plugged in?) vs "Is it a Layer 7 issue?" (Is the API returning 500?).
  • Load Balancers: L4 Load Balancers (HAProxy in TCP mode) vs L7 Load Balancers (Nginx, AWS ALB).

Interview Check

  1. What is the difference between an L4 and L7 Load Balancer?
    • L4 routes based on IP/Port (packet level). L7 routes based on HTTP headers/URL (application content). L7 is smarter but more resource-intensive.
  2. Where does SSL/TLS fit?
    • Historically Presentation (L6), but in practice, it wraps the Application data before Transport.