Encapsulation in the OSI Model

What is Encapsulation in Networking?
Encapsulation is the process of adding additional information (headers and sometimes trailers) to data as it passes through the layers of the OSI model for transmission across a network.
Each layer in the OSI model performs specific functions and adds its own protocol information, helping the receiving device understand how to handle the data.

Encapsulation in OSI Model (Layer-wise Breakdown)

OSI LayerData UnitEncapsulation Details
7. ApplicationDataUser initiates the data transfer (e.g., HTTP request, email content).
6. PresentationDataData is translated, encrypted, or compressed.
5. SessionDataSession info is added to establish and manage communication between source and destination.
4. TransportSegmentPort numbers are added. Ensures reliable delivery via TCP or fast delivery via UDP.
3. NetworkPacketIP addresses (source & destination) are added to the segment, forming a packet.
2. Data LinkFrameMAC addresses are added. A trailer (like Frame Check Sequence) may also be added for error detection.
1. PhysicalBitsThe frame is converted to 0s and 1s and transmitted through cables or wireless.

Step-by-Step Example of Encapsulation

Let’s say a user wants to send a message: "Hello" to another computer via email.

Encapsulation Process:

  1. Application Layer (Layer 7): Message “Hello” is created.
  2. Presentation Layer (Layer 6): Message is encoded, possibly encrypted.
  3. Session Layer (Layer 5): Session is established for sending data.
  4. Transport Layer (Layer 4): Adds port numbers (e.g., Port 25 for SMTP).
  5. Network Layer (Layer 3): Adds IP addresses (e.g., 192.168.0.1 to 192.168.0.5).
  6. Data Link Layer (Layer 2): Adds MAC addresses.
  7. Physical Layer (Layer 1): Converts data into electrical/optical signals or radio waves.

Final Output: Stream of bits sent across the network.

Decapsulation Process

At the receiving end, the reverse happens:

  1. Bits → Frame → Packet → Segment → Data
  2. Each OSI layer strips its corresponding header/trailer.
  3. Finally, the message “Hello” is delivered to the user.

Why Encapsulation Matters

  • Adds information necessary for routing, addressing, and error checking.
  • Allows modular communication between systems (each layer focuses only on its own task).
  • Enables interoperability between devices from different manufacturers.
  • Makes troubleshooting and packet analysis (e.g., using Wireshark) easier.

Tip to Remember the OSI Layers

From Layer 7 to Layer 1:

“All People Seem To Need Data Processing”

From Layer 1 to Layer 7:

“Please Do Not Throw Sausage Pizza Away”

Leave a Reply

Your email address will not be published. Required fields are marked *