Data Encapsulation and De-encapsulation in Networking

FTC disclaimer: This post contains affiliate links and I will be compensated if you make a purchase after clicking on my link.

When we send data from one computer to another computer or from one node to another node, data at the sender side is encapsulated, and the receiving side is de-encapsulated.

The process of encapsulation and de-encapsulation took place and was implemented during OSI and TCP/IP model.

The functionality of encapsulation and de-encapsulation adds security and reliability to the data transmission between two nodes in networking.

Here, we will look at how encapsulation and de-encapsulation are implemented in OSI and TCP/IP models.

What is Data encapsulation in networking?

Data encapsulation is adding additional information and functionality to the previously received data in the networking model.

Moreover, Data encapsulation takes place in the various layer of the OSI and TCP/IP model.

Additionally, the protocol at a different layer of the OSI and TCP/IP model adds information to the header or the footer of the data.

Adding information in the data encapsulation is starting from the application layer to the physical layer.

Moreover, every layer in the OSI and TCP/IP model takes the previous layer’s data and encapsulates it with additional information and functionality.

The information and functionality could be data sequencing, flow control, error detection and control, routing information, congestion control, and much more.

What is Data De-encapsulation in networking?

De-encapsulation is the process in which it removes the encapsulated data to obtain the original data.

In order words, data de-encapsulation is the reverse of the encapsulation process.

The data de-encapsulation takes place in the receiving end from the physical layer (or network interface layer) to the application layer of the OSI or TCP/IP model.

Encapsulated data term OSI and TCP IP model

Encapsulated data term at OSI and TCP/IP model

In data de-encapsulation, the added header and footer are removed and pass the data to the next layer.

So, the encapsulation and de-encapsulation of data take place at the sender and receiving end.

Further, it is carried out at each layer of the OSI or TCP/IP model, and the pass data has different terms at each layer.

The different term for data at each layer depends on the functionality and protocol at each layer.

The information in the Application, Presentation, and Session layer of the OSI model and Application layer of the TCP/IP model is termed Data, which is received as user input.

The Transport Layer of the OSI or TCP/IP model is term as Segment.

Further, the information in the Network layer and Data Link Layer of the OSI or TCP/IP model is called Packet and Frame.

Lastly, the Frame received in the Physical layer (or Network Interface layer) is converted into a format of Data Bits or Bits (0’s and 1’s).

Further, the bits are transmitted over physical medium as an electrical signal, pulses, or radio signals, so that the attached media can carry.

Let’s look into the encapsulation and de-encapsulation process.

Encapsulation and de encapsulation process

Encapsulation process at the sender side.

Step 1: Process of user data

The application, presentation, and session layer of the OSI model and the application layer of the TCP/IP model will take user data in the data stream.

Further, it will process data stream with encryption and by applying a session to the data stream.

Moreover, the header to the data is application-specific which can be added if needed. For instance, HTTP adds a header to the outgoing data.

Additionally, encapsulation describes the header and trailers added by the layer, not by application-specific.

So that, the encapsulation process does not have any particular term in the application layer (application, presentation, and session layer) of the TCP/IP model (OSI model).

Step 2: Transform data into segments

The data stream received from the application layer is further segmented into multiple small chunks.

Each chunk of data is encapsulated with an appropriate header, and this small piece of data and the header are known as segment or data segment.

The header contains the sequence information so that it can be re-assembled at the receiving end.

Step 3: Formation of packets

The segments, which received from the Transport layer of the OSI and TCP/IP model are encapsulated with IP information in the header, and it is called a packet or data packet.

The data packet contains addressing and routing information of both the source and destination device to deliver the data properly.

Step 4: Packets to Frame

The packets received from the Network layer of the OSI and TCP/IP model are further processed by adding a header and trailer to it, and it is termed Frame or Data Frame.

The header of the Frame contains the switching and control information that tells which hardware it belongs to.

Furthermore, the trailer of the Frame contains error detection and drops the corrupted data packages.

Step 5: Transmission of data Frame

The data Frame or Frame received from the Data Link Layer of the OSI and TCP/IP model is further encapsulated by converting it into data signals.

The data bits or bits converted into data signals such as electric signals, fiber optics pulses, and radio waves will depend on the physical medium (Cable, fiber optics, and wireless medium).

encapsulation and de encapsulation process in the OSI model

encapsulation and de encapsulation process in the TCP IP model

The de-encapsulation process at the receiving end

Step 1: Received Data Bits or Bits

The physical layer of the OSI and TCP/IP model will receive Data Bits or Bits through a physical medium in the form of the data signal.

The encoded signals are de-encapsulated to form a data frame and pass it to the upper layer or Data Link Layer.

Step 2: Data Frame is checked and transformed to Packets

The Data Frame received from the Physical Layer (or Network Interface Layer) of the OSI (or TCP/IP) model is first checked whether it is received to the correct hardware or not.

Further, it is checked for error detection, and if found, it is requested for retransmission.

It is de-encapsulated to form data packets and handed over to the upper layer or Network Layer (or Internet Layer) if everything is correct.

Step 3: Received Data Packets changed to Segments

The Data Packets received from the Network layer (or the Internet Layer) of the OSI (or TCP/IP) model are further de-encapsulated to form segments.

It will first check the header whether the packet is routed to the correct destination or not. If it is not routed to the correct destination, then the packet will be discarded.

If everything is correct, it will only de-encapsulate to segments and forward to the upper layer or Transport layer.

Step 4: Segments reassembled to form data

The Segments received to the Transport layer from the Network Layer (or Internet Layer) of the OSI (or TCP/IP) model are again de-encapsulated.

Before de-encapsulation, it will first check the header of the segments. If the segments are in the correct order, then they will be re-assembled to form data streams.

The data stream is further forwarded to the upper layer or Application Layer.

Step 5: Application-specific data is separated

The data stream received from Transport Layer is further de-encapsulated in the Application, Presentation, and Session layer of the OSI model and Application layer of the TCP/IP model.

The de-encapsulation process will understand the application-specific data, and it will forward to that particular application.

This is how the encapsulation and de-encapsulation process works in the OSI model (or TCP/IP model) between two different nodes or computers in a network.