OSI Model - 7 Layers Explained

Hitesh Sungar
5 min readJun 15, 2024

--

OSI Model (Open System Interconnection):

It is a conceptual framework developed by ISO (International Organization for Standardization) in 1984.

It describes how information flows between computers on a network. It’s made up of seven layers, each with its own job.

Imagine it as a team where everyone has a specific role to play. From the layer where you see and interact with apps to the layer handling the physical cables, each part ensures smooth communication between devices.

7 Layers of OSI:

Summary of 7 Layers of OSI Model

1. Application Layer: It provides an interface for users to access network resources and do tasks such as browsing the web, sending emails, and transferring files.

Functions:

  • User Interaction & inputs: It allows users to interact with the network and input commands.
  • Transferring & accessing files: Facilitates the transfer and access of files between devices.
  • Remote hosting: Enables hosting and accessing resources on remote servers.

Protocol: HTTP, SMTP, FTP, DNS, SSH

Attacks: SQL Injection attack, XSS, Phishing attack, Misconfiguration

Example: Sender selects an image to send on WhatsApp, and the receiver gets the image and notification.

2. Presentation Layer: It acts like a translator between different systems or applications by ensuring that data is presented in a format that both the sender and receiver can understand.

Functions:

  • Translation: Converts data into a format understandable by the application layer.
  • Encryption/Decryption: Secures data by converting it into a secure format for transmission and back again for reception.
  • Data Compression: Reduces the size of data to optimize network bandwidth usage.

Protocol: SSL, TLS, AFP

Attacks: Cracking encryption, Phishing attack with malicious file format, data misinterpretation

Example: Encryption applied to an image for secure transfer, with decryption at the receiver’s end.

3. Session Layer: It is responsible for establishing, managing & terminating communication sessions between the application on different devices.

Functions:

  • Session Establishment, Management & Termination: Sets up, oversees, and ends communication sessions between applications on different devices.
  • Adding checkpoints: Marks progress points to help resume communication if interrupted and ensure data stays intact.
  • Error recovery: Manages error detection and correction during a session.
  • Dialog Control: Controls data flow and prevents collisions in data communication.

Protocol: NetBIOS, RPC, Socks

Attacks: Session hijacking, Session Spoofing, Session timeout manipulation.

Example: WhatsApp manages the session between sender and receiver, allowing either to terminate it.

4. Transport Layer: This Layer acts as an intermediary between the hardware and software layers. It is the heart of the OSI Model, responsible for providing reliable data transfer services that are error-free, and sequential, and ensure no loss or duplication of data between devices on the network.

Functions:

  • Process to Process Delivery (Port Addressing): Ensures data is delivered to the correct application process.
  • End-to-End Connection Between Hosts: Provides a reliable connection between two network endpoints.
  • Segmentation & Reassembly: Breaks data into segments for transmission and reassembles them at the destination.
  • Multiplexing & Demultiplexing: Combines multiple data streams into one and separates them at the receiver’s end.
  • Data Congestion, Correction, & Integrity: Manages data flow to prevent congestion and ensures data integrity through error checking.

Protocols: TCP, UDP, SCTP

Attacks: SYN flood, UDP flood, teardrop attack

Example: WhatsApp image split into smaller segments for reliable transfer with sequence numbers and error checking.

5. Network Layer: It is used for logical handling & routing of data packets. This layer determines the most efficient path for data to travel from the source to the destination. It ensures that data packets are forwarded to the correct destination by reading the routing information in the packet headers.

Functions:

  • Logical Addressing & Routing: Determines the best path for data to travel across the network using IP addresses.
  • Packet Forwarding to Next Hop: Forward data packets to the next network device on the route.
  • Fragmentation & Reassembly: When data packets exceed the network’s Maximum Transmission Unit (MTU) size, fragmentation divides them into smaller pieces for transmission. These pieces are later reassembled at the destination.
  • Error Handling, Flow, and Congestion Control: Manages errors, data flow, and network congestion.
  • NAT & Logical Subnetting: Translates private IP addresses to public ones and organizes the network into subnets.

Protocols: IP, ICMP, IPSEC, IGMP

Attacks: IP spoofing, ICMP flood, routing table overflow, IP fragmentation

Example: Determining the best route for data to reach the recipient using IP addresses.

6. Data Link Layer: This Layer is responsible for ensuring reliable and error-free data delivery between network nodes. It achieves this by encapsulating data into frames, verifying their integrity during transmission, and detecting and correcting any errors that may occur.

Functions:

  • Physical Addressing: Uses MAC addresses to identify devices on a local network.
  • Error Detection & Correction: Detects and corrects errors in data frames.
  • Flow Control: Manages the rate of data transmission between devices.
  • Encapsulation: Adds headers and metadata to data packets for transmission.

Protocols: ARP, PPP, Ethernet, VLAN, L2TP

Attacks: MAC Spoofing, ARP Spoofing, MAC Flooding

Example: Adding the image data packets into frames which will add MAC addresses for delivery of data.

7. Physical Layer: It deals with the physical transmission of data which is in the form of bits. The frames that are received from the data link layer are converted into bits for transmission over the medium in this layer. Depending on the type of physical medium, the physical layer may represent the bits as either; light signals, electrical signals, or waves for transmission over wireless media.


Functions:

  • Physical Topology: Defines the physical layout of network devices and cables.
  • Synchronization: Aligns the data transmission rate between sender and receiver.
  • Transmission Mode: Determines the direction of signal flow (simplex, half-duplex, or full-duplex).
  • Signal Encoding: Converts data into signals suitable for the transmission medium.

Attacks: Jamming, Wiretapping, Hardware failures, External drive insertion

Protocols: Protocols don’t strictly apply to the Physical Layer. This layer focuses on transmitting raw data bits as electrical, optical, or wireless signals. It involves different types of media like coaxial, twisted pair, USB, etc.

Example: Ethernet cables used in home and office networks. These cables transmit raw electrical signals between devices like computers, routers, and switches, enabling the transfer of data at specified speeds

Conclusion:

OSI model provides a structured way to understand how data travels across a network. By breaking down the communication process into seven distinct layers, it simplifies the complex task of transmitting information from one device to another. Whether you’re a beginner or an experienced professional, having a solid grasp of the OSI model is essential for effectively designing, implementing, and troubleshooting network systems. With this foundational knowledge, you can build strong and secure networks that allow smooth communication across different platforms and technologies.

--

--