OSI Model


The OSI Model: A Complete Breakdown

The OSI model is a conceptual framework that standardizes the functions of a telecommunication or computing system. It divides the communication process into seven distinct layers, each responsible for specific tasks related to data transfer. The model helps in understanding how different networking protocols and technologies interact.

The Seven Layers of the OSI Model

Layer 1 - Physical Layer        -Hubs
Layer 2 - Data Link Layer -Switches
Layer 3 - Network Layer -Routers
Layer 4 - Transport Layer -Firewalls*
Layer 5 - Session Layer
Layer 6 - Presentation Layer
Layer 7 - Application Layer

The Seven Layers of the OSI Model

  1. Physical Layer (Layer 1)
  • Function: Handles the physical connection between devices and the transmission and reception of raw bit streams over a physical medium (e.g., cables, wireless).
  • Key Concepts:
    • Media: Includes cables (copper, fiber optic), wireless signals.
    • Connectors and Pinouts: RJ45 for Ethernet, BNC connectors for coaxial cables.
    • Standards: IEEE 802.3 (Ethernet), IEEE 802.11 (Wi-Fi).
  • PDU (Protocol Data Unit): Bits
    • Data at the Physical Layer is transmitted as raw electrical, optical, or radio signals.
  • Example: When you connect an Ethernet cable to your computer, the Physical Layer handles the electrical signals transmitted over the cable.

  1. Data Link Layer (Layer 2)
  • Function: Provides node-to-node data transfer and error detection/correction. It ensures that frames are transmitted to the correct device on a local network.
  • Key Concepts:
    • MAC Addresses: Unique identifiers for network interfaces.
    • Frames: Data packets at this layer are called frames.
    • Protocols: Ethernet (IEEE 802.3), PPP (Point-to-Point Protocol).
  • PDU: Frames
    • The Data Link Layer encapsulates the packet from Layer 3 into frames. Each frame includes MAC addresses for source and destination, as well as an error-checking mechanism.
  • Example: A switch forwards Ethernet frames to the correct device using MAC addresses within a local area network (LAN).

  1. Network Layer (Layer 3)
  • Function: Responsible for packet forwarding, including routing through intermediate routers. It determines the best path for data to travel from the source to the destination.
  • Key Concepts:
    • IP Addresses: Logical addresses assigned to devices.
    • Routing: The process of determining the optimal path for data to travel between networks.
    • Protocols: IPv4, IPv6, ICMP (Internet Control Message Protocol).
  • PDU: Packets
    • The Network Layer encapsulates transport segments into packets, including the source and destination IP addresses.
  • Example: A router uses IP addresses to route packets between different networks, such as from your home network to a website on the internet.

  1. Transport Layer (Layer 4)
  • Function: Provides reliable data transfer services to the upper layers. It ensures complete data transfer with error recovery, segmentation, and flow control.
  • Key Concepts:
    • Segmentation and Reassembly: Breaking large messages into smaller segments and reassembling them at the destination.
    • Ports: Identifiers for specific services or applications (e.g., HTTP uses port 80).
    • Protocols: TCP (Transmission Control Protocol), UDP (User Datagram Protocol).
  • PDU: Segments (TCP) or Datagrams (UDP)
    • TCP encapsulates data into segments, adding sequence numbers and acknowledgment numbers for reliable delivery. UDP uses datagrams, which are simpler and don’t guarantee delivery.
  • Example: When you access a website, TCP ensures that all the segments of the web page are received and reassembled correctly.

  1. Session Layer (Layer 5)
  • Function: Manages and maintains sessions between applications. It establishes, maintains, and terminates communication sessions.
  • Key Concepts:
    • Sessions: Continuous exchanges of information between devices.
    • Synchronization: Establishing checkpoints and recovery points during data transmission.
    • Protocols: SMB (Server Message Block), RPC (Remote Procedure Call).
  • PDU: Data
    • The Session Layer does not add headers or footers but manages sessions and handles connections.
  • Example: When you log into a remote server, the Session Layer ensures the session is maintained and not interrupted.

  1. Presentation Layer (Layer 6)
  • Function: Translates data between the application and network layers. It handles data encryption, compression, and translation between different data formats.
  • Key Concepts:
    • Data Translation: Converting data from one format to another (e.g., from EBCDIC to ASCII).
    • Encryption and Decryption: Securing data for transmission and decrypting received data.
    • Compression: Reducing the size of data to make transmission more efficient.
  • PDU: Data
    • The Presentation Layer processes data, including translating and encrypting, but does not encapsulate it further.
  • Example: SSL/TLS protocols encrypt the data transmitted between a web browser and server for security.

  1. Application Layer (Layer 7)
  • Function: Provides services directly to end-user applications. It facilitates communication between software applications and lower-layer network services.
  • Key Concepts:
    • Protocols: HTTP, FTP, SMTP, DNS.
    • User Interfaces: The point of interaction between the user and the software.
  • PDU: Data
    • The Application Layer uses data created by applications like web browsers or email clients, transmitting it to the lower layers for transport.
  • Example: When you send an email using an email client, the SMTP protocol handles the message transfer between your client and the email server.

Example Scenario: Sending an Email through the OSI Model

Let’s break down the process of sending an email and how it moves through each layer, with associated PDUs:

  1. Application Layer (Layer 7):
    Your email client uses SMTP to send the email.
    PDU: Data
  2. Presentation Layer (Layer 6):
    The email content is encrypted using TLS for security.
    PDU: Data
  3. Session Layer (Layer 5):
    A session is established between your email client and the email server.
    PDU: Data
  4. Transport Layer (Layer 4):
    The email is segmented into TCP segments, each with a sequence number for reassembly.
    PDU: Segments
  5. Network Layer (Layer 3):
    Each segment is encapsulated into packets with source and destination IP addresses.
    PDU: Packets
  6. Data Link Layer (Layer 2):
    Packets are encapsulated into frames with source and destination MAC addresses.
    PDU: Frames
  7. Physical Layer (Layer 1):
    Frames are converted into bits and transmitted as electrical or radio signals over the network.
    PDU: Bits

The email traverses multiple layers, networks, routers, and switches, each handling the data according to its respective OSI layer, until it reaches the recipient’s email server. The process is then reversed to deliver the email to the recipient’s inbox.


Summary of OSI Model PDUs

LayerPDU NameExample
Layer 7 – ApplicationDataSending an email using SMTP
Layer 6 – PresentationDataEncrypting data using TLS
Layer 5 – SessionDataMaintaining a session for file transfer (FTP)
Layer 4 – TransportSegments/DatagramsBreaking up data into TCP segments for web traffic
Layer 3 – NetworkPacketsRouting an IP packet through a network
Layer 2 – Data LinkFramesForwarding an Ethernet frame on a local network
Layer 1 – PhysicalBitsTransmitting bits over a physical medium (e.g., cable)

By understanding both the functions and the PDUs for each layer, you can troubleshoot network problems, design efficient systems, and grasp how data travels across networks from one device to another.