Data Encapsulation and De-encapsulation Explained

This tutorial explains data encapsulation and de-encapsulation in detail with examples. Learn how data is encapsulated and de-encapsulated when it passes through the layers of OSI and TCP/IP models.

Advertisements

In networking model, the terms encapsulation and de-encapsulation refer to a process in which protocol information is added to the data and removed from the data when it passes through the layers.

Protocol information can be added before and after the data. If information is added before the data, it is known as header. If information is added after the data, it is known as trailer.

encapsulation and de-encapsulation process

Header and trailer added by a layer in the sending computer can be removed only by the peer layer in the receiving computer. For example, header and trailer added by the transport layer in the sending computer can be removed only by the transport layer in the receiving computer.

Advertisements

When data encapsulated by a layer of sending computer is processed by the same layer of receiving computer, it is known as the same layer interaction.

This tutorial is the last part of the article "Networking reference models explained in detail with examples". This article explains following CCNA topic.

Compare and contrast OSI and TCP/IP models

Other parts of this article are following.

OSI Model Advantages and Basic Purpose Explained

This tutorial is the first part of the article. It briefly explains the reasons why OSI model was created along with the advantages.

OSI Seven Layers Model Explained with Examples

This tutorial is the second part of the article. It explains the seven layers of OSI model in details.

Similarities and Differences between OSI and TCP/IP Model

This tutorial is the third part of the article. It compares OSI reference model with TCP/IP model and lists the similarities and differences between both models.

TCP/IP Reference Model Explained

This tutorial is the fourth part of the article. It explains the five layers of TCP/IP model in detail.

Encapsulation process takes place in the sending computer while the de-encapsulation process takes place in the receiving computer. After encapsulation, each layer uses a specific name or term to represent the encapsulated data.

Following table lists the terms used by layers in both models to represent the encapsulated data.

Term OSI layer TCP/IP layer
Data Application Application
Data Presentation
Data Session
Segment Transport Transport
Packet Network Network
Frame Data Link Data Link
Bits Physical Physical

Let’s understand each term in detail with step by step data encapsulation process.

Data

Advertisements

Upper layer (application layer in TCP/IP) or layers (application, presentation and session layers in OSI) create data stream and handed it down to the transport layer.

Upper layers don’t use header and trailer with data. But if require, the application that initiates the connection can add header and trailer with data. For example, browsers use HTTP protocol to fetch websites from webservers. HTTP protocol uses a header with data.

Since the use of header and trailer in upper layers is application specific, in encapsulation diagram and terms encapsulated data in upper layers is commonly referred as the data.

Segment

Transport layer breaks the received data stream from upper layers into smaller pieces. Next, it creates a header for each data piece. This header contains all necessary information about the piece that the transport layer in remote host needs to reassemble the data stream back from the pieces. Once header is attached, data piece is referred as segment. Once segments are created, they are handed down to the network layer for further processing.

Packet

Network layer creates a header for each received segment from transport layer. This header contains information that is required for addressing and routing such as source software address and destination software address. Once this header is attached, segment is referred as packet. Packets are handed down to the data link layer.

In original TCP/IP model the term packet is mentioned as the term datagram. Both terms packet and datagram refer to the same data package. This data package contains a network layer header and an encapsulated segment.

Frame

Data link layer receives packets from network layer. Unlike transport layer and network layer which only create header, it also creates a trailer with header for each received packet. The header contains information that is required for switching such as source hardware address and destination hardware address. The trailer contains information that is required to detect and drop corrupt data packages in the earliest stage of de-encapsulation. Once header and trailer are attached with packet, it is referred as frame. Frames are passed down to the physical layer.

Bits

Physical layer receives frames from data link layer and converts them a format that the attached media can carry. For example, if the host is connected with a copper wire, the physical layer will convert frames in voltages. And if the host is connected with a wireless network, the physical layer will convert them in radio signals.

De-encapsulation

De-encapsulation takes place in receiving computer. In de-encapsulation process, header and trailer attached in encapsulation process are removed.

Physical layer picks encoded signals from media and converts them in frames and hands them over to the data link layer.

Data link layer, first, reads the trailer of frame to confirm that the received frame is in correct shape. It reads rest of the frame only if the frame is in correct shape.

If frame is fine, it reads the destination hardware address of the frame to determine the fame is intended for it or not.

If frame is not intended for it, it will discard that frame immediately. If frame is intended for it, it will remove the header and the trailer from the frame. Once data link layer’s header and trailer are removed from the frame, it becomes packet. Packets are handed over to the network layer.

Network layer checks destination software address in the header of each packet. If packet is not intended for it, network layer will discard that packet immediately. If packet is intended for it, it will remove the header. Once network layer’s header is removed, packet will become segment. Segments are handed over to the transport layer.

Transport layer receives segments from network layer. From segment headers it collects all necessary information and based on that information it arranges all segments back in correct order. Next, it removes segment header from all segments and reassembles them in original data stream. Data stream is handed over to the upper layers.

Upper layers format data stream in such format that the target application can understand.

Following figure shows the encapsulation and de-encapsulation in OSI model.

encapsulation and de-encapsulation in osi model

Following figure shows the encapsulation and de-encapsulation in TCP/IP model.

encapsulation and de-encapsulation in tcp/ip model

That’s all for this article. If you have any suggestion, comment or feedback about this article, please mail me. If you like this article, please don’t forget to share it with friends through your favorite social site.

Advertisements

ComputerNetworkingNotes CCNA Study Guide Data Encapsulation and De-encapsulation Explained