Data Encapsulation and De-encapsulation Explained
This tutorial explains how the OSI model and TCP/IP model encapsulate and de-encapsulate the data when it passes through the layers.
In a networking model, the term encapsulation refers to a process in which protocol information is added to the data. The term de-encapsulation refers to a process in which information added through the encapsulation process is removed.
Protocol information can be added before and after the data. If the information is added before the data, it is known as a header. If the information is added after the data, it is known as a trailer.
The following image explains the data encapsulation and de-encapsulation process.
The header and trailer added by a layer on the sending computer can only be removed by the peer layer on the receiving computer. For example, the header and trailer added by the Transport layer on the sending computer can only be removed by the Transport layer on the receiving computer.
Data encapsulated by a layer on the sending computer is de-encapsulated by the same layer on the receiving computer. This process is known as the same layer interaction.
The encapsulation process takes place on the sending computer. The de-encapsulation process takes place on the receiving computer. After doing the encapsulation, each layer uses a specific name or term to represent the encapsulated data.
The following table lists the terms used by the layers in both models to represent the encapsulated data.
|Term||OSI layer||TCP/IP layer|
|Frame||Data Link||Data Link|
Let’s understand each term and the data encapsulation process in detail.
This tutorial is the last part of the article "Networking reference models explained in detail with examples.". Other parts of this article are the following.OSI Model Advantages and Basic Purpose Explained
This tutorial is the first part of the article. It briefly explains why the OSI model was created and what the advantages of the OSI model are.OSI Seven Layers Model Explained with Examples
This tutorial is the second part of the article. It explains the seven layers of the OSI model in detail.Similarities and Differences between the OSI Model and TCP/IP Model
This tutorial is the third part of the article. It compares the OSI reference model with the TCP/IP model and lists the similarities and differences between both.TCP/IP Reference Model Explained
This tutorial is the fourth part of the article. It explains the five layers of the TCP/IP model in detail.
The upper layer (the Application layer in the TCP/IP model) or the layers (the Application, Presentation, and Session layers in the OSI model) create a data stream and transfer it to the Transport layer.
The upper layers do not attach headers and trailers to the data. But if required, the application that initiates the connection can add a header and trailer to the data. For example, browsers use the HTTP protocol to fetch websites from webservers. The HTTP protocol uses a header to transfer the data.
The encapsulation process describes the headers and trailers that are added by the layers. It does not describe application-specific headers and trailers. Since the upper layers do not add any header or trailer to the data, the encapsulation process does not use any particular term to refer to the encapsulated data in the upper layers.
SegmentThe Transport layer receives the data stream from the upper layers. It breaks the received data stream into smaller pieces. This process is known as segmentation. After segmentation, it creates a header for each data piece and attaches that header to the data piece. Headers contain the information that the remote host needs to reassemble all data pieces. Once the header is attached, a data piece is known as the segment. The Transport layer transfers segments to the Network layer for further processing.
The Network layer creates a header for each received segment from the Transport layer. This header contains the information that is required for addressing and routing, such as the source software address and destination software address. Once the header is attached, a segment is known as the packet. Packets are handed down to the Data link layer.
In the original TCP/IP model, the term packet is mentioned as the term datagram. Both terms are identical and interchangeable. A packet or a datagram contains a network layer header and an encapsulated segment.
The Data link layer receives packets from the Network layer. Unlike the Transport layer and Network layer which only create a header, it also creates a trailer along with the header for each received packet. The header contains information that is required for the switching, such as the source hardware address and destination hardware address. The trailer contains information that is required to detect and drop the corrupt data packages in the earliest stage of the de-encapsulation. Once the header and trailer are attached, a packet is known as the frame. Frames are passed down to the Physical layer.
The Physical layer receives frames from the Data link layer and converts them into a format that the attached media can carry. For example, if the host is connected through a copper wire, the Physical layer converts frames into voltages. And if the host is connected through a wireless network, the physical layer converts them into radio signals.
De-encapsulation takes place on the receiving computer. The de-encapsulation process is the opposite of the encapsulation process. In this process, the headers and trailers that are attached by the encapsulation process are removed.
The Physical layer picks encoded signals from the media and converts them into frames and hands them over to the Data link layer.
The Data-link layer reads the trailer of the frame and confirms that the received frame is in the correct shape. If the frame is in the correct shape, it reads the destination hardware address of the frame to determine whether the fame is intended for it.
If the frame is not intended for it, it will discard the frame. If the frame is intended for it, it will remove the header and the trailer from the frame. Once the data link layer’s header and trailer are removed from the frame, it becomes the packet. Packets are handed over to the Network layer.
The Network layer checks the destination software address in the header of each packet. If the packet is not intended for it, it will discard the packet. If the packet is intended for it, it will remove the header. Once the network layer’s header is removed, the packet becomes the segment. Segments are handed over to the Transport layer.
The Transport layer receives segments from the Network layer. From segment headers, it collects all necessary information, and based on that information it arranges all segments back to the correct order. Next, it removes the segment header from all segments and reassembles them in the original data stream. The data stream is handed over to the upper layers.
Upper layers convert the data stream in such a format that the target application can understand.
The following figure shows the encapsulation and de-encapsulation process in the OSI model.
The following figure shows the encapsulation and de-encapsulation process in the TCP/IP model.
That’s all for this article. If you like this article, please don’t forget to share it with friends through your favorite social site.
By ComputerNetworkingNotes Updated on 2021-05-20 05:46:24 IST
- The show ip route Command Explained
- Routing Decision Longest Match Explained
- Static Routing Configuration Guide with Examples
- IP Route command Explained with Examples
- Types of Static Routes Explained
- Static Routes and Static Routing Explained
- Configure DHCP Server for multiple VLANs on the Switch
- Connected Routes and Local Routes Explained
- Types of Routing and Types of Routes Explained