OSI Model

Overview

The Open Systems Interconnection (OSI) model is a conceptual framework used to understand and standardize the functions of a telecommunication or computing system without regard to its internal structure and without regard to the technology implemented.

Core Concepts

  • The 7 Layers:
    • Physical Layer: Transmission of raw bit streams over a physical medium (cables, radio waves).
    • Data Link Layer: Node-to-node data transfer (MAC addresses, Ethernet).
    • Network Layer: Routing data between different networks (IP addresses, Routers).
    • Transport Layer: End-to-end communication, error recovery, and flow control (TCP, UDP).
    • Session Layer: Managing sessions between applications (Session establishment, teardown).
    • Presentation Layer: Data representation, encryption, and decryption (SSL/TLS, JPEG, ASCII).
    • Application Layer: The interface for end-user applications (HTTP, DNS, FTP, SMTP).
  • Encapsulation: The process of adding headers (and sometimes trailers) to data as it moves down the stack.
  • Decapsulation: The reverse process of removing headers as data moves up the stack.

Code Examples

[ Application ] -> Data
[ Presentation ] -> Data + Header
[ Session ] -> Data + Header
[ Transport ] -> Segment
[ Network ] -> Packet
[ Data Link ] -> Frame
[ Physical ] -> Bits

Use Cases

  • Troubleshooting: Identifying which layer a network failure is occurring at (e.g., “It’s a Layer 1 issue” meaning the cable is unplugged).
  • Interoperability: Ensuring different vendors’ hardware can communicate using standardized protocols.

Gotchas

  • TCP/IP Model vs. OSI: In practice, the TCP/IP model is used more often, which collapses the Session, Presentation, and Application layers into a single Application layer.
  • Complexity: The OSI model is a reference, not a strict implementation. Some layers may be omitted or combined in certain protocols.

Related Notes