OSI Model
Course Contents
1. Introduction
The OSI (Open Systems Interconnection) model is a reference framework created by the ISO in the 1980s to describe how devices communicate over a network, step by step, from one layer to the next.
Its strength lies in its layered structure, which divides the communication process into seven distinct layers, each with specific responsibilities.

While the OSI model is essential for understanding network communication and troubleshooting, it is mainly a theoretical reference. In real-world networking, the TCP/IP model has become the standard, as it defines the actual protocols used to transfer data between devices.
2. Encapsulation and Decapsulation
The OSI model is built on seven layers, each with its own role in the communication process.
To understand how data actually travels across a network, you need to know two key processes: encapsulation and decapsulation.
Encapsulation
When you send data (for example, a file or a message), it moves down the OSI layers on your device.
At each step, the layer adds specific information such as addresses or port numbers, so the data can reach its exact destination.

- Layer 7 – Application: Creates the original data to send.
- Intermediate layers: Add headers (and sometimes trailers) containing control and addressing information.
- Layer 1 – Physical: Converts the final frame into signals (electrical pulses, light, or radio waves) and transmits them over the network medium.
Decapsulation
When the data arrives at its destination, the process is reversed, it moves up the OSI layers on the receiving device.

- Layer 1 – Physical: Turns incoming signals into bits.
- Intermediate layers: Remove their respective headers/trailers and interpret the information.
- Layer 7 – Application: Delivers the original data to the application that requested it.
Why It Matters
- Encapsulation: Ensures the data is packaged with all the details needed to reach its destination.
- Decapsulation: Ensures the receiving device can interpret the data correctly and forward it to the right service.
3. OSI’s Seven Layers
The OSI model is made of seven layers, each with a specific function.
Let’s look at them from the top (closest to the user) down to the bottom (closest to the physical network).
Layer 7 – Application
The Application Layer is where you, the user, interact directly with the network through applications such as web browsers, email clients, or messaging apps.
When you access https://pingmynetwork.com
, this layer initiates the request using the correct protocol.

Key points:
- Closest to the end user.
- Manages application-level protocols such as HTTPS, HTTP, FTP, and SMTP.
Layer 6 – Presentation
The Presentation Layer ensures that data is formatted correctly for the receiving application. It translates data between the application format and the network format, and can also handle encryption.

Key points:
- Translates and formats data for the application.
- Encrypts and decrypts data for secure communication (e.g., TLS/SSL for HTTPS).
- Example: Encrypting a message before sending it, then decrypting it upon receipt.
Layer 5 – Session
The Session Layer manages the start, maintenance, and closure of communication sessions between devices.

Key points:
- Establishes, maintains, and terminates communication sessions.
- Allows multiple applications to run and communicate at the same time.
Upper Layers Overview
Layers 7, 6, and 5 are known as the Upper Layers. They focus on preparing data for transmission.

The lower layers (4–1) are responsible for actually delivering the data across the network.
Layer 4 – Transport
The Transport Layer ensures end-to-end delivery of data between devices.
It splits large data streams into smaller segments and adds a Layer 4 header containing delivery details.

KeKey points:
- Segmentation: Divides large data into smaller segments.
- Delivery methods: Uses TCP for reliable transmission and UDP for faster, connectionless delivery.
- Host-to-host communication: Identifies services using port numbers (e.g., TCP 443 for HTTPS).
Example:
When streaming a video, TCP ensures all segments arrive in order without loss, while UDP favors speed, even if some segments are lost.
Layer 3 – Network
The Network Layer manages logical addressing and routing so data can travel between networks.

Key points:
- Adds source and destination IP addresses.
- Selects the best route for data delivery.
- Routers operate here.
- Segment + Layer 3 header = packet.
Analogy:
Like a postal service choosing the most efficient path for a package, the Network Layer selects the best route for the data.
Layer 2 – Data Link
The Data Link Layer handles node-to-node communication within the same local network using MAC addresses.

Key points:
- Framing: Adds a Layer 2 header and trailer to create a frame.
- Uses MAC addresses to identify devices on the same network.
- Includes error detection with a Frame Check Sequence (FCS).
- Switches operate here.
Layer 1 – Physical
The Physical Layer handles the actual transmission of raw bits over the network medium.

Key points:
- Defines the physical components such as cables, connectors, and wireless signals.
- Converts frames into bits (1s and 0s) for transmission over the medium.
Example:
The Physical Layer is like the road carrying vehicles (frames) to their destination.
De-encapsulation Process
When the data arrives at the receiving device, the reverse of encapsulation takes place, this is called decapsulation.
The data moves up through the OSI layers, with each layer removing the information that its counterpart added on the sender’s side.
Layer 1 – Physical
At the Physical Layer, the incoming electrical, optical, or radio signals are converted back into raw bits so the frame can start being reconstructed.

- Receives signals from the transmission medium.
- Converts them into raw bits for further processing.
Layer 2 – Data Link
The Data Link Layer takes the raw bits from Layer 1 and reassembles them into a complete frame before removing its own Layer 2 header.

- Groups bits into a frame.
- Removes the Layer 2 header (source/destination MAC addresses).
Layer 3 – Network
The Network Layer receives the packet from Layer 2 and removes its own Layer 3 header, which contains the source and destination IP addresses.

- Processes the packet for delivery.
- Removes the Layer 3 header containing IP addresses.
Layer 4 – Transport
The Transport Layer processes the segment and removes its Layer 4 header, which contains the port numbers and reassembly details for the data stream.

- Identifies the correct application service using port numbers.
- Removes the Layer 4 header.
- Handles reassembly of data segments if necessary.
Layers 5–7 – Upper Layers
Once the data has been processed by the lower layers, it moves into the upper layers of the OSI model: Session, Presentation, and Application. These layers ensure that the data is correctly prepared, formatted, and delivered to the application that requested it.
Layer 5 – Session
The Session Layer manages and terminates the communication session between the two devices. It ensures the session context is maintained until the transfer is complete.

- Maintains and controls dialog between devices.
- Ends the session once communication is complete.
Layer 6 – Presentation
The Presentation Layer ensures the data is in a usable format for the application. It may handle translation, compression, or encryption/decryption if necessary.

- Translates data between network and application formats.
- Decrypts or decompresses the data if required.
Layer 7 – Application
The Application Layer delivers the final, fully prepared data to the application software used by the end user (e.g., web browser, email client, file transfer tool).

- Passes the original data to the correct application.
- Ensures the information is ready for immediate use.
4. Adjacent-Layer and Same-Layer Interaction
The OSI model describes not only the responsibilities of each layer but also how layers interact.
There are two main types of interaction: adjacent-layer and same-layer.
Adjacent-layer interaction
This occurs between two layers next to each other on the same device.
Each layer either passes data down to the one below or receives data up from the one above.

- Example: The Transport Layer sends a segment down to the Network Layer.
- Allows the upper layer to rely on the lower layer for specific delivery functions.
Same-layer interaction
This occurs between the same OSI layer on two different devices.
It ensures that both devices understand the data in the same way.

- Example: The Transport Layer on one device communicates with the Transport Layer on another device to confirm segment delivery.
- Maintains consistency and compatibility in communication protocols.
5. PDUs (Protocol Data Units)
When an application needs to send data to another system, it starts at the Application Layer (Layer 7) of the OSI model.
As the data moves down through the layers, each one adds its own header containing information needed for addressing, delivery, and error checking.
The result of adding this control information to the original data is called a Protocol Data Unit (PDU).

PDU Types Across OSI Layers
Layer 4 – Transport
When the Transport Layer adds its header, the data becomes a segment.
- Contains port numbers and reliability information.
- Example: TCP or UDP segment.
Layer 3 – Network
When the Network Layer adds its header (including IP addresses), the PDU becomes a packet.
- Contains source and destination IP addresses.
- Routed across multiple networks.
Layer 2 – Data Link
When the Data Link Layer adds its header, the PDU becomes a frame.
- Contains source and destination MAC addresses.
- Includes an FCS for error detection.
Layer 1 – Physical
At the Physical Layer, the PDU is simply a bitstream (1s and 0s) transmitted over the medium.
- Represents the actual signals sent over copper, fiber, or wireless.
6. How to Remember OSI Layers
Memorizing the seven layers of the OSI model can be challenging at first.
Using mnemonics is a simple and effective way to make it easier.
From Layer 7 (Application) down to Layer 1 (Physical)
All People Seem To Need Data Processing

From Layer 1 (Physical) up to Layer 7 (Application)
Please Do Not Teach Students Pointless Acronyms
In the next course, we will explore the TCP/IP Model and see how it works alongside the OSI model in real-world networking. This will help you understand not just the theory, but also the protocols actually used every day on the internet.