What is encapsulation in transport layer?

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.

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.

TermOSI layerTCP/IP layerDataApplicationApplicationDataPresentationDataSessionSegmentTransportTransportPacketNetworkNetworkFrameData LinkData LinkBitsPhysicalPhysical

Let’s understand each term and the data encapsulation process 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.

Segment

The 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.

Packet

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.

Frame

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.

Bits

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.

encapsulation and de-encapsulation in osi model

The following figure shows the encapsulation and de-encapsulation process in the TCP/IP model.

encapsulation and de-encapsulation in 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.

What is encapsulation process?

Encapsulation is a process in which active agents (e.g., antimicrobials or biocides) are surrounded by a coating to give small capsules with controlled migration.

What is meant by the term encapsulation?

In general, encapsulation is the inclusion of one thing within another thing so that the included thing is not apparent. Decapsulation is the removal or the making apparent a thing previously encapsulated.

What is the purpose of data encapsulation in routing?

Data encapsulation adds the protocol information to the data so that data transmission can take place in a proper way. This information can either be added in the header or the footer of the data. The data is encapsulated on the sender's side, starting from the application layer to the physical layer.

What is encapsulation and decapsulation?

Encapsulation adds information to a packet as it travels to its destination. Decapsulation reverses the process by removing the info, so a destination device can read the original data.