OSI Model from a Developer's point of view

What is the OSI Model?

The OSI (Open Systems Interconnection) model is a conceptual framework that defines how data should be transmitted across a network in a reliable and structured way. It standardizes communication functions into seven distinct layers, each with specific responsibilities. This layered approach helps developers and network professionals understand and design systems that can communicate efficiently and securely.

Although all 7 layers are defined in the model, in real-world implementations some layers may be abstracted, combined, or omitted depending on the protocol or use case.

The 7 Layers of the OSI Model:

1. Application Layer

  • This is the layer closest to the end user.
  • It provides network services to applications (like web browsers or email clients).
  • Example: A browser sending a GET request to https://www.youtube.com/. It includes headers such as Content-Type, User-Agent, etc.

2. Presentation Layer

  • Responsible for data translation, encryption/decryption, and compression.
  • Example: If the request is HTTPS, this layer encrypts data using protocols like TLS.
  • Converts data into a format that the application layer can understand (e.g., JSON, XML).

3. Session Layer

  • Manages sessions (connections) between applications.
  • Establishes, maintains, and terminates communication sessions.
  • Example: Assigning a session ID so the server knows all requests belong to the same user session.

4. Transport Layer

  • Ensures reliable data transmission with error checking and flow control.
  • Breaks data into segments and attaches source and destination port numbers.
  • Examples of protocols: TCP (reliable), UDP (fast but unreliable).

5. Network Layer

  • Handles logical addressing and routing.
  • Adds source and destination IP addresses to packets.
  • Protocol: IP (Internet Protocol).

6. Data-Link Layer

  • Converts packets into frames and adds MAC addresses.
  • Responsible for physical addressing, error detection, and link control.
  • Uses ARP (Address Resolution Protocol) to map IPs to MACs.

7. Physical Layer

  • Converts all data into binary (1s and 0s).
  • Transmits it through the physical medium (e.g., Ethernet, Wi-Fi).
  • Handles hardware like cables, switches, and signal levels.

Additional Clarification:

  • Once data is converted into 1s and 0s by the Physical Layer, it is transmitted across the network.
  • Intermediate devices (like routers, switches) process only relevant layers (e.g., routers handle up to the Network Layer).
  • Tools like Wireshark can inspect packets on the network.
  • If data is unencrypted, it can be read directly. Even with encryption (like HTTPS), metadata (IP, port) remains visible.

Final Comments:

  • The OSI model is standardized; layers cannot be arbitrarily added or removed.
  • Real-world stacks (e.g., TCP/IP) may combine OSI layers (like Application + Presentation + Session).
  • The Presentation Layer is not always active — for plaintext protocols (like HTTP), it may do little or nothing.
  • ARP is often considered part of the Network Layer, but functionally interacts with Layer 2 (Data-Link).

© UNTITLED | Website created by Rupam Joshi