What is Encapsulation in computer networking?

  • In computer networking, the term encapsulation is used to refer to the process of each layer at the sending computer adding its own header information, in the form of meta-data to the actual payload (data).
  • Each layer’s header information would be interpreted and acted upon by a peer layer in another machine.
  • Encapsulation is analogous to packing a letter inside an addressed envelope by the sender. Just like postal envelopes cannot be delivered to the intended recipient without an address, similarly without the encapsulation headers, data cannot be carried across the computer networks from the sending computer to the receiving computer. 
  • It is the primary means of communication between peer layers of different computers. For instance, : the Network layer Header (NH) containing the destination IP address, helps a packet to be routed to the correct receiving computer : the Datalink layer Header (DLH) containing the destination MAC address, helps a frame to be passed onto the correct next hop neighbor, during a packets hop by hop journey from the source computer to the receiving computer : the Transport layer Header (TH) containing the source port and the destination port helps the source and the destination computers to correctly multiplex/demultiplex data among different applications (like HTTP, FTP etc.).
  • Decapsulation is the reverse process of encapsulation, wherein each layer at the receiving computer, interprets the header information sent by its peer layer, takes the required action based on the information and finally removes the header, before passing on the data to the next higher layer. It is analogous to removing the letter from the envelope by the receiver.

The diagram given below illustrates a typical encapsulation and decapsulation process.

The process of encapsulation and decapsulation

The process of encapsulation and decapsulation

In the diagram,

  • at the sending end, the Application Protocol Data Unit(APDU) is encapsulated with a Transport layer Header (TH), a Network layer Header (NH) and a Datalink layer Header (DLH) by the Transport, Network and Datalink layers respectively.
  • Also, the APDU would typically have an application header (AH) and a protocol data unit (PDU). This is not explicitly shown in the above diagram. The AH would typically be added by the application protocol under operation (e.g. FTP, HTTP etc.).
  • Similarly, the physical layer may add its own encapsulation in the form of a prepended header and optionally an appended trailer to the frame coming from the datalink layer. This would be decapsulated by the peer physical layer implementation of a next hop neighbor, to whom the frame is destined for.
  • Typically each layer would only add encapsulation information pertinent to its layer. For e.g. NH would have information like source IP address, destination IP address etc., identifying the sending and receiving computers).
  • The data is then transmitted to the receiving computer through the physical layer(wired/wireless media).
  • At the receiving end, the data reaches the application layer after being decapsulated at different layers. Note that the headers are removed strictly only by peer layers (e.g. TH is only removed by the transport layer at the receiving end).
  • Also, encapsulation information would normally be prepended to the payload. The only exception to this rule may happen in the datalink and physical layers, where apart from a header, a trailer also may be added after the payload. In the diagram above, the data link layer at the sending end prepends a header (DLH) and also appends a trailer (DLT) to the payload that it receives from the higher layer. At the receiving end, the corresponding datalink layer removes both the header and the trailer, after interpreting the values inside them.

Leave a Reply

Your email address will not be published. Required fields are marked *

Current ye@r *