👁 Preview — Study, Practice and Revise are open; mock tests and the rest of the syllabus unlock on subscription. Unlock all · ₹4,999
← Back to Network Fundamentals
Study mode

OSI model

Introduction to the OSI Model

Imagine you want to send a letter to a friend living in another city. You write the letter, put it in an envelope, write the address, and hand it over to the postal service. The postal service then takes care of delivering your letter through various stages until it reaches your friend. Similarly, in computer networks, data must travel from one device to another through multiple steps and processes. To manage this complex communication, a standardized framework called the OSI Model was created.

The Open Systems Interconnection (OSI) Model is a conceptual framework that standardizes the functions of a telecommunication or computing system into seven distinct layers. Each layer has a specific role in the process of sending and receiving data across a network. This layered approach helps different types of hardware and software to communicate effectively, even if they come from different manufacturers or use different technologies.

Before the OSI model was developed, there was no common language or structure for network communication, which made interoperability difficult. The OSI model provides a universal set of rules and guidelines, allowing diverse systems to work together seamlessly.

In this chapter, we will explore each of the seven layers of the OSI model, understand their functions, and see how they work together to enable smooth communication between computers and other devices.

OSI Model Layers

The OSI model divides network communication into seven layers, each building upon the one below it. These layers are:

7. Application User Interface, HTTP, FTP 6. Presentation Data Translation, Encryption 5. Session Connection Management 4. Transport Reliable Delivery, TCP, UDP 3. Network Routing, IP 2. Data Link Frames, MAC, Ethernet 1. Physical Bits, Cables, Signals

1. Physical Layer

The Physical Layer is the lowest layer of the OSI model. It deals with the physical connection between devices, such as cables, switches, and electrical signals. This layer is responsible for transmitting raw bits (0s and 1s) over a physical medium.

Example: Think of this layer as the actual postal trucks and roads that carry your letters. It does not understand the content of the letter; it just moves the envelope from one place to another.

Key functions: Defines electrical signals, data rates, connector types, and physical topology.

2. Data Link Layer

The Data Link Layer packages raw bits from the Physical Layer into frames, which are structured packets of data. It also handles error detection and correction to ensure data integrity during transmission between two directly connected devices.

Example: This is like the postal worker who checks the address on the envelope and ensures it is correctly labeled before sending it out.

Protocols: Ethernet, Wi-Fi (IEEE 802.11), MAC addresses.

3. Network Layer

The Network Layer is responsible for determining the best path for data to travel across multiple networks. It handles logical addressing (such as IP addresses) and routing.

Example: Similar to the postal sorting center that decides which route the letter should take to reach the destination city.

Protocols: Internet Protocol (IP), ICMP.

4. Transport Layer

The Transport Layer ensures reliable data transfer between end systems. It manages flow control, error recovery, and segmentation of data into smaller units.

Example: Like a courier service that guarantees your letter arrives safely and in the correct order, even if it was split into multiple packages.

Protocols: Transmission Control Protocol (TCP), User Datagram Protocol (UDP).

5. Session Layer

The Session Layer establishes, manages, and terminates communication sessions between applications. It controls dialogues (connections) and synchronizes data exchange.

Example: Imagine two people on a phone call who start, maintain, and end their conversation properly.

Functions: Session establishment, maintenance, and termination.

6. Presentation Layer

The Presentation Layer translates data between the application layer and the network format. It handles data encryption, compression, and formatting.

Example: Like a translator who converts your letter into a language your friend understands or encrypts it for privacy.

Functions: Data translation, encryption, compression.

7. Application Layer

The Application Layer is the closest to the end user. It provides network services directly to applications such as web browsers, email clients, and file transfer programs.

Example: This is you writing the letter and reading the reply.

Protocols: HTTP, FTP, SMTP, DNS.

Data Encapsulation Process

When data is sent from one device to another, it passes through each OSI layer, starting at the Application Layer and moving down to the Physical Layer. At each layer, additional information called headers (and sometimes trailers) is added to the data. This process is called encapsulation.

On the receiving side, the data moves up through the layers, and each layer removes its corresponding header/trailer in a process called decapsulation.

This layered encapsulation ensures that each layer can perform its specific function independently and that data is properly packaged for transmission.

graph TD    A[Application Layer: Data] --> B[Presentation Layer: Add Formatting]    B --> C[Session Layer: Add Session Info]    C --> D[Transport Layer: Add TCP/UDP Header]    D --> E[Network Layer: Add IP Header]    E --> F[Data Link Layer: Add Frame Header & Trailer]    F --> G[Physical Layer: Convert to Bits & Transmit]    G --> H[Physical Layer: Receive Bits]    H --> I[Data Link Layer: Remove Frame Header & Trailer]    I --> J[Network Layer: Remove IP Header]    J --> K[Transport Layer: Remove TCP/UDP Header]    K --> L[Session Layer: Remove Session Info]    L --> M[Presentation Layer: Remove Formatting]    M --> N[Application Layer: Data Delivered]

Formula Bank

Formula Bank

Frame Size Calculation
\[ \text{Frame Size} = \text{Payload Size} + \text{Header Size} + \text{Trailer Size} \]
where: Payload Size = size of actual data in bytes; Header Size = size of header in bytes; Trailer Size = size of trailer in bytes

Worked Examples

Example 1: Identifying OSI Layers for Common Protocols Easy
Classify the following protocols into their respective OSI layers: HTTP, TCP, IP, Ethernet.

Step 1: Understand the function of each protocol.

HTTP: Used by web browsers to request and receive web pages. It interacts directly with user applications, so it belongs to the Application Layer (Layer 7).

TCP: Provides reliable data transfer and flow control. It segments data and ensures delivery, so it belongs to the Transport Layer (Layer 4).

IP: Responsible for logical addressing and routing packets across networks, so it belongs to the Network Layer (Layer 3).

Ethernet: Defines frame formats and physical addressing (MAC addresses) for local area networks, so it belongs to the Data Link Layer (Layer 2).

Answer:

  • HTTP - Application Layer (7)
  • TCP - Transport Layer (4)
  • IP - Network Layer (3)
  • Ethernet - Data Link Layer (2)
Example 2: Troubleshooting Network Issues Using OSI Model Medium
A user cannot access a website. Ping to the website's IP address is successful, but the website does not load in the browser. Identify which OSI layer(s) might be causing the problem.

Step 1: Ping success indicates that the Network Layer (Layer 3) is working correctly because IP packets are reaching the destination.

Step 2: Since the website does not load, the problem may be at the Application Layer (Layer 7) or Transport Layer (Layer 4). For example, HTTP (Layer 7) or TCP (Layer 4) might be blocked or malfunctioning.

Step 3: Check if the browser can resolve the domain name (DNS resolution). If DNS fails, the issue is at the Application Layer.

Answer: The problem likely lies at the Application Layer or Transport Layer, not the Network Layer.

Example 3: Encapsulation and Decapsulation Example Medium
Explain the encapsulation process when sending an email from one computer to another, mentioning what happens at each OSI layer.

Step 1: At the Application Layer (Layer 7), the email client creates the message using SMTP protocol.

Step 2: The Presentation Layer (Layer 6) formats the message, possibly encrypting or compressing it.

Step 3: The Session Layer (Layer 5) establishes a session between sender and receiver to manage the communication.

Step 4: The Transport Layer (Layer 4) segments the message and adds TCP headers to ensure reliable delivery.

Step 5: The Network Layer (Layer 3) adds IP headers to route the segments through the network.

Step 6: The Data Link Layer (Layer 2) frames the packets with Ethernet headers and trailers for local network delivery.

Step 7: The Physical Layer (Layer 1) converts the frames into electrical signals and transmits them over the cable.

Answer: Each layer adds its own header/trailer to the data, preparing it for transmission and ensuring proper delivery and interpretation at the receiving end.

Example 4: Comparing OSI and TCP/IP Models Easy
Map the OSI model layers to the TCP/IP model layers and give an example protocol for each.

Step 1: Understand that the TCP/IP model has four layers: Application, Transport, Internet, and Network Interface.

Step 2: Map OSI layers to TCP/IP layers:

  • OSI Layers 7 (Application), 6 (Presentation), and 5 (Session) correspond to TCP/IP's Application Layer. Example: HTTP.
  • OSI Layer 4 (Transport) corresponds to TCP/IP's Transport Layer. Example: TCP.
  • OSI Layer 3 (Network) corresponds to TCP/IP's Internet Layer. Example: IP.
  • OSI Layers 2 (Data Link) and 1 (Physical) correspond to TCP/IP's Network Interface Layer. Example: Ethernet.

Answer: The OSI model is more detailed with seven layers, while the TCP/IP model combines some layers but covers the same functions.

Example 5: Calculating Frame Size Including Headers and Trailers Hard
A data packet has a payload size of 1500 bytes. The Network Layer adds a 20-byte header, and the Data Link Layer adds a 14-byte header and a 4-byte trailer. Calculate the total frame size transmitted over the physical medium.

Step 1: Identify all sizes:

  • Payload Size = 1500 bytes
  • Network Layer Header = 20 bytes
  • Data Link Layer Header = 14 bytes
  • Data Link Layer Trailer = 4 bytes

Step 2: Calculate the total size at the Network Layer:

\[ \text{Network Layer Packet Size} = \text{Payload} + \text{Network Header} = 1500 + 20 = 1520 \text{ bytes} \]

Step 3: Calculate the total frame size at the Data Link Layer:

\[ \text{Frame Size} = \text{Network Layer Packet Size} + \text{Data Link Header} + \text{Data Link Trailer} = 1520 + 14 + 4 = 1538 \text{ bytes} \]

Answer: The total frame size transmitted over the physical medium is 1538 bytes.

Tips & Tricks

Tip: Use the mnemonic "Please Do Not Throw Sausage Pizza Away" to remember the OSI layers from Physical (1) to Application (7).

When to use: When memorizing the order of OSI layers for exams.

Tip: Relate each OSI layer to a step in the postal system (writing, packaging, addressing, routing, delivery) to understand its function better.

When to use: To grasp abstract concepts through analogy.

Tip: Focus on what each layer does rather than memorizing protocols alone; this helps in answering application-based questions effectively.

When to use: During problem-solving and conceptual questions.

Tip: Practice mapping common protocols (HTTP, TCP, IP, Ethernet) to OSI layers frequently to improve recall speed.

When to use: Before competitive exams for quick recall.

Tip: Remember that encapsulation adds headers/trailers as data moves down layers, and decapsulation removes them going up.

When to use: When solving questions related to data flow and frame size.

Common Mistakes to Avoid

❌ Confusing the order of OSI layers or mixing up layer functions.
✓ Use mnemonics and associate each layer with its primary function to avoid confusion.
Why: Students often memorize layers but forget their specific roles.
❌ Assigning protocols to incorrect OSI layers, e.g., placing IP in the Transport layer.
✓ Understand protocol responsibilities and layer definitions clearly before classification.
Why: Lack of conceptual clarity leads to misclassification.
❌ Ignoring the encapsulation process and its impact on data size calculations.
✓ Always consider headers and trailers added at each layer when calculating frame sizes.
Why: Students overlook additional data added during encapsulation.
❌ Assuming OSI and TCP/IP models are identical without differences.
✓ Study both models side-by-side to understand their distinct structures and purposes.
Why: Overgeneralization leads to incorrect answers in comparative questions.
❌ Memorizing protocols without understanding their practical applications.
✓ Focus on how protocols operate within layers and their real-world use cases.
Why: Pure memorization limits problem-solving ability.
OSI Model LayerTCP/IP Model LayerExample Protocol
Application (7,6,5)ApplicationHTTP
Transport (4)TransportTCP
Network (3)InternetIP
Data Link & Physical (2,1)Network InterfaceEthernet

Key Takeaways

  • The OSI model divides network communication into seven layers, each with specific functions.
  • Data encapsulation adds headers/trailers at each layer to prepare data for transmission.
  • Understanding layer functions helps in troubleshooting and protocol classification.
  • The OSI model and TCP/IP model serve similar purposes but differ in structure.
  • Mnemonics and analogies aid in memorizing and understanding the OSI layers.
Key Takeaway:

Mastering the OSI model is essential for understanding network communication and solving related problems in competitive exams.

✨ AI exam tools — try them free (included in every plan)
Tip: select any text above to Explain / Example / Simplify it.
Curated videos per subtopic
Top YouTube explainers, AI-ranked for your exam and language. Unlocks with subscription.
Unlock

Try Practice next.

Progress tracking is paywalled — subscribe to mark subtopics as understood and save your streak.

Go to practice →
Ask a doubt
OSI model · 10 free messages
Ask me anything about this subtopic. You have 10 free messages this session — chat history isn't saved in preview.