Encapsulation

The term encapsulation is used to describe a process of adding headers and trailers around some data. This process can be explained with the four-layer TCP/IP model, with each step describing the role of the layer.  For example, here is what happens when you send an email using your favourite email program (such as Outlook or Thunderbird):

  1. the email is sent from the Application layer to the Transport layer.
  2. the Transport layer encapsulates the data and adds its own header with its own information, such as which port will be used and passes the data to the Internet layer
  3. the Internet layer encapsulates the received data and adds its own header, usually with information about the source and destination IP addresses. The Internet layer than passes the data to the Network Access layer
  4. the Network Access layer is the only layer that adds both a header and a trailer. The data is then sent through a physical network link.

Here is a graphical representation of how each layer add its own information:

encapsulation

Each packet (header + encapsulated data) defined by a particular layer has a specific name:

  • Frame – encapsulated data defined by the Network Access layer. A frame can have both a header and a trailer.
  • Packet – encapsulated data defined by the Network layer. A header contains the source and destination IP addresses.
  • Segment – encapsulated data as defined by the Transport layer. Information such as the source and destination ports or sequence and acknowledgment numbers are included in the header.
NOTE
The term decapsulation refers to the process of removing headers and trailers as data passes from lower to upper layers. This process happens on the computer that is receiving data.

 

Data encapsulation in the OSI model
Just like with the TCP/IP layers, each OSI layer asks for services from the next lower layer. The lower layer encapsulates the higher layer’s data between a header (Data Link protocols also add a trailer).

While the TCP/IP model uses terms like segment, packet and frame to refer to a data packet defined by a particular layer, the OSI model uses a different term: protocol data unit (PDU). A PDU represent a unit of data with headers and trailers for the particular layer, as well as the encapsulated data. Since the OSI model has 7 layers, PDUs are numbered from 1 to 7, with the Physical layer being the first one. For example, the term Layer 3 PDU refers to the data encapsulated at the Network layer of the OSI model.

Here is a graphical representation of all the PDUs in the OSI model:

Encapsulation PDUs

upravnik