Data Communication Components · Computer Networks

The OSI Reference Model


1. Introduction to Layered Architecture

The Open Systems Interconnection (OSI) model was developed by the International Organization for Standardization (ISO) in 1984 as a conceptual framework for understanding and standardizing network communications between heterogeneous computer systems.

Why Layering?

  • Modularity & Abstraction: Decomposes complex network tasks into 7 discrete, manageable layers.
  • Interoperability: Standardized interfaces allow hardware and software from different vendors to work together seamlessly.
  • Independent Evolution: Modifying or upgrading protocols in one layer does not affect adjacent layers as long as the interfaces remain intact.

2. The 7 Layers and Protocol Data Units (PDUs)

 Layer 7: APPLICATION    [ Data / Message ]         (HTTP, FTP, SMTP, DNS)
            |
 Layer 6: PRESENTATION   [ Formatted Data ]         (SSL/TLS, ASCII, JPEG)
            |
 Layer 5: SESSION        [ Dialog Data ]            (RPC, NetBIOS, Sockets)
            |
 Layer 4: TRANSPORT      [ Segment / Datagram ]     (TCP, UDP) - Port Addressing
            |
 Layer 3: NETWORK        [ Packet / Datagram ]      (IPv4, IPv6, ICMP) - Logical IP
            |
 Layer 2: DATA LINK      [ Frame ]                  (Ethernet, Wi-Fi, PPP) - MAC Addressing
            |
 Layer 1: PHYSICAL       [ Bits (0s & 1s) ]         (Cables, Radio Waves, Voltage)

Mnemonic to remember top-to-bottom: All People Seem To Need Data Processing.
Mnemonic to remember bottom-to-top: Please Do Not Throw Sausage Pizza Away.


3. Data Encapsulation and Decapsulation

When an application transmits data, it moves down through the protocol stack. Each layer prepends a Header (and the Data Link layer appends a Trailer) containing control information for its peer layer at the receiving host.

 Sender Host                                                        Receiver Host
+--------------+                                                   +--------------+
| Application  | -> [ Data ]                                  ->   | Application  |
+--------------+                                                   +--------------+
| Presentation | -> [ H6 | Data ]                             ->   | Presentation |
+--------------+                                                   +--------------+
| Session      | -> [ H5 | H6 | Data ]                        ->   | Session      |
+--------------+                                                   +--------------+
| Transport    | -> [ H4 | H5 | H6 | Data ]                   ->   | Transport    |
+--------------+    \____________________/
| Network      | -> [ H3 |    Segment    ]                    ->   | Network      |
+--------------+    \____________________/
| Data Link    | -> [ H2 |    Packet     | T2 ]               ->   | Data Link    |
+--------------+    \_________________________/
| Physical     | ->  0 1 1 0 1 0 0 1 0 1 1 1 0 1 0 0          ->   | Physical     |
+--------------+     ==========================                    +--------------+
                        [ Physical Medium ]
  • Encapsulation: Moving down the stack (Sender adds H7…H2H_7 \dots H_2 and T2T_2).
  • Decapsulation: Moving up the stack (Receiver strips headers after verifying integrity and routing).

4. Detailed Functionality of Each Layer

Layer 1: Physical Layer

  • Responsibility: Transmitting unstructured raw bit streams over a physical communication channel.
  • Key Functions:
    1. Physical Characteristics of Interfaces: Mechanical specifications of plugs/connectors (RJ-45) and transmission medium.
    2. Representation of Bits: Defines voltage levels, optical wavelengths, or RF modulation representing 0s and 1s.
    3. Data Rate (Signaling Rate): Transmission speed in bits per second (bps).
    4. Synchronization of Bits: Clock synchronization between sender and receiver.
    5. Line Configuration: Point-to-point or multipoint.
    6. Physical Topology: Mesh, Star, Bus, or Ring.
    7. Transmission Mode: Simplex, Half-Duplex, or Full-Duplex.
  • Hardware: Hubs, Repeaters, Cables (UTP, Fiber), Modems.

Layer 2: Data Link Layer (DLL)

  • Responsibility: Transforming a raw physical transmission facility into a reliable, error-free link for Hop-to-Hop (Node-to-Node) delivery.
  • Sublayers:
    • LLC (Logical Link Control): Manages frame synchronization, flow control, and multiplexing network layer protocols.
    • MAC (Media Access Control): Controls how devices share access to the physical transmission medium.
  • Key Functions:
    1. Framing: Packages network layer packets into discrete frames with headers and trailers.
    2. Physical Addressing: Adds sender and receiver MAC addresses (48-bit hex, e.g., AA:BB:CC:DD:EE:FF).
    3. Flow Control: Prevents a fast sender from swamping a slow receiver (Stop-and-Wait, Sliding Window).
    4. Error Control: Detects and retransmits damaged/lost frames via CRC (Cyclic Redundancy Check) and ARQ.
    5. Access Control: Resolves channel contention when two or more devices attempt to transmit simultaneously (CSMA/CD, CSMA/CA).
  • Hardware: Switches, Bridges, Network Interface Cards (NICs).

Layer 3: Network Layer

  • Responsibility: Delivering packets from Source-to-Destination (Host-to-Host) across multiple interconnected networks.
  • Key Functions:
    1. Logical Addressing: Assigns global IP addresses (IPv4: 32-bit, IPv6: 128-bit) that transcend local subnet boundaries.
    2. Routing: Determines the optimal path from source to destination using routing algorithms (OSPF, BGP, RIP).
    3. Packetizing & Fragmentation: Encapsulates transport segments; fragments large packets to conform to the Maximum Transmission Unit (MTU) of intermediate links.
  • Hardware: Routers, Layer 3 Switches.

Layer 4: Transport Layer

  • Responsibility: Reliable, End-to-End (Process-to-Process) delivery of complete messages between specific applications.
  • Key Functions:
    1. Service-Point (Port) Addressing: Uses 16-bit Port numbers (e.g., HTTP = 80, HTTPS = 443, DNS = 53) to direct data to the exact executing process.
    2. Segmentation and Reassembly: Divides application messages into segments with sequence numbers, reassembling them in exact order at the receiver.
    3. Connection Control:
      • Connection-oriented (TCP): 3-way handshake, guaranteed in-order delivery.
      • Connectionless (UDP): Fast, best-effort delivery without connection setup.
    4. End-to-End Flow & Error Control: Windowing mechanisms across the entire network path (unlike DLL which operates hop-by-hop).

Layer 5: Session Layer

  • Responsibility: Establishing, managing, synchronizing, and terminating dialogs between communicating systems.
  • Key Functions:
    1. Dialog Control: Decides whether communication is half-duplex or full-duplex.
    2. Synchronization & Checkpointing: Inserts checkpoints into long data streams. If a crash occurs at byte 8,000 in a 10,000-byte file, only bytes 8,001–10,000 need retransmission rather than the whole file.

Layer 6: Presentation Layer

  • Responsibility: Ensuring semantic and syntactic compatibility of exchanged data between different computer architectures.
  • Key Functions:
    1. Translation: Converts between different character encodings (e.g., EBCDIC to ASCII/UTF-8, endianness conversions).
    2. Encryption / Decryption: Secures confidential data before transmission (e.g., TLS/SSL).
    3. Data Compression: Reduces bit volume for efficient transmission (Lossless or Lossy).

Layer 7: Application Layer

  • Responsibility: Providing user interfaces and software applications access to network services.
  • Key Services:
    • Network Virtual Terminal (TELNET, SSH).
    • File Transfer, Access, and Management (FTAM, FTP, SFTP).
    • Mail Services (SMTP, IMAP, POP3).
    • Web Browsing (HTTP, HTTPS).
    • Directory Services (DNS, LDAP).

5. Summary: OSI vs. TCP/IP Model

OSI Layer (7 Layers) TCP/IP Layer (4/5 Layers) Primary Protocols Addressing Type Scope of Delivery
Application (7) Application Layer HTTP, DNS, SMTP, FTP Uniform Resource Identifier (URI) Application-to-Application
Presentation (6) (Merged into Application) SSL/TLS, JPEG, ASCII — —
Session (5) (Merged into Application) Sockets, NetBIOS, RPC Session ID —
Transport (4) Transport Layer TCP, UDP, SCTP Port Number (16-bit) Process-to-Process
Network (3) Internet Layer IPv4, IPv6, ICMP, ARP IP Address (32/128-bit) Host-to-Host (Source-to-Dest)
Data Link (2) Network Access / Link Layer Ethernet, Wi-Fi, PPP MAC Address (48-bit) Hop-to-Hop (Node-to-Node)
Physical (1) Physical Layer Cat6, 802.11 PHY, Optical Bits / Wavelength / Voltage Physical interface

6. Key Exam Questions & Core Distinctions

  1. Distinguish between Hop-to-Hop, Host-to-Host, and Process-to-Process Delivery:
    • Hop-to-Hop (Data Link Layer): Moves a frame from one intermediate device (node/router) to the next physical adjacent node using MAC addresses.
    • Host-to-Host (Network Layer): Moves a packet from the original sender host to the final destination host across multiple intermediate networks using IP addresses.
    • Process-to-Process (Transport Layer): Delivers data to the specific application/program running on the host using Port numbers.
  2. What is the function of checkpoints in the Session Layer?
    • Checkpoints allow long file transmissions to recover from mid-stream failures without re-transmitting the entire file from the start.
  3. Why did the TCP/IP model succeed over the OSI model commercially?
    • TCP/IP was implemented in Berkeley UNIX and widely tested before standardization, whereas the OSI model was designed theoretically by committee before extensive software implementation.
Free AppAndroid App

Coursify Android App

Generate AI courses, take quick quizzes between classes, and master complex engineering concepts on the go.

← All Computer Networks modules