Data Encapsulation in computer networking is about adding a bit of additional information to the data packet and preparing the information for being delivered in the network. Using Data Encapsulation beside other protocols provides a flawless data exchange possibility between stations.
The data is encapsulated by adding specific information to the main data at each OSI layer. Each layer adds its own information to data and passes the result to the next layer. The technical term for this additional information is PDU. We’ll learn more about PDUs next.
Protocol data unit (PDU)
Protocol Data Units contain the control information that are sticking to the main part of data at each layer. The information is attached to the header of data field but can also be at the end of the data field or trailer.
Encapsulating PDUs is done by attaching them to the data at each layer in the OSI reference model. Each Protocol Data Unit has a name depending on the type of the information the header contains.
The Encapsulated data can only be opened by the same layer when the packet gets to the destination. Once the encapsulated packet is opened, it passes to the adjacent layer where the PDU information is detached from the packet and the remaining data is forwarded to the higher layer.
OSI model and PDUs
The layers of the OSI model are basically defined for reducing the complexity of data exchange process. The OSI model is then divided into two general categories: Upper layers, and Data Flow layers.
The upper layers (also known as Application Layers) are the 7th, 6th, and 5th layers of the OSI model. These are directly related to the user interface. Data Flow layers consist of the 4th, 3rd, 2nd, and 1st layers because they cope with how the data flows across the network.
The PDUs on each layer in the second category (Data Flow) has a different name. On Transport layer, it’s called “Segment”. When in the Network layer, it’s called “Pakcet”. The PDU that is produced by Data Link layer will be called “Frame” and finally, the PDU inside the Physical layer is called “Bit”.
Transport layer encapsuation
The Application layer user data is converted for transmission on the network. The data stream is then pushed down towards the lower layer, which is the Transport layer. Here, a virtual circuit will be set up to the destination.
The data stream is then broken down and the control information is attached to the Transport layer’s header within the data field. Each segment is sequenced so that the data stream can be put back together on the destination exactly as transmitted.
Network layer encapsulation
Each segment is then handed to the Network layer for logical addressing through a routed protocol, for example IP.
The network layer adds its own header to the segment and then data will be passed to the next lower layer (Data link).
At this stage, the data packet has logical addresses of the source and the destination within itself.
Data link layer encapsulation
After the Network layer added the logical address (IP) to the data, it will transfer it to the Data Link for the physical address (MAC) to be added.
In this layer, a header and a trailer will be added to both ends of the Frame. Now the header contains the MAC address and the trailer holds the information related to flow control.
Each layer-3 device (router) adds its own layer 2 headers to the data. This means that layer 2 header (MAC address) of the current router will be changed by the next router.
On the destination side, the receiving unit synchronizes the digital signal and extracts 1s and 0s from it. At this point, the station will build the frames and perform to additional processes to ensure that the data integrity is intact.
- Run a Cyclic Redundancy Check (CRC) which means to check if the data has arrived error-free.
- Run Frame Check Sequence (FCS) which takes care of the correct sequence numbers of the received frames.
If both checks pass, the packet is taken out of the frame and the rest of the frame is discarded. This process is known as De-capsulation. The packet then will be transferred to the Network layer, where the IP address is checked.
If the IP address found inside the packet matches the IP address of the receiving station, the Segment is detached from the packet and the rest is discarded.
The data is processed at the Transport layer that rebuilds the data stream and acknowledges to the transmitting station that it has received the segments successfully. It then transfers the data stream to the upper layers (Session, Presentation and Application).