Encapsulation And Decapsulation in Computer Network, Encapsulation and Decapsulation in OSI model, Encapsulation And Decapsulation in Protocol Layering , Encapsulation and Decapsulation in TCP/IP Model

Encapsulation And Decapsulation in Computer Network, Encapsulation and Decapsulation in OSI model, Encapsulation And Decapsulation in Protocol Layering , Encapsulation and Decapsulation in TCP/IP Model.

Encapsulation and Decapsulation : 

One of the important concepts in protocol layering in the Internet is encapsulation/ decapsulation. 



We have not shown the layers for the link-layer switches because no encapsulation/ decapsulation occurs in this device In Figure , we show the encapsulation  in the source host, decapsulation in the destination host, and encapsulation and decapsulation in the router.

Encapsulation at the Source Host :

At the source, we have only encapsulation :


1.  At the application layer, the data to be exchanged is referred to as a message . A message normally does not contain any header or trailer, but if it does, we refer to the whole as the message. The message is passed to the transport layer


2.   The transport layer takes the message as the payload, the load that the transport layer should take care of. It adds the transport layer header to the payload, which contains the identifiers of the   source and destination application programs that want to communicate plus some more information that is needed for the end-to-end delivery of the message, such as information needed for flow error control, or congestion control. The result is the transport-layer packet, which is called the segment  (in TCP) and the user datagram (in UDP). The transport layer then passes the packet to the network layer.

3.  The network layer takes the transport-layer packet as data or payload and adds its own header to the payload. The header contains the addresses of the source and destination hosts and some more   information used for error checking of the header, fragmentation information, and so on. The result is the network-layer packet, called a datagram. The network layer then passes the packet to the data-link layer.

4. The data-link layer takes the network header, which contains the link link layer takes the network- layer packet as data or payload and adds its own header, which contains the link-layer addresses of the host or the next hop (the router).. The result is link- layer packet, which is called a frame. The frame is passed to the physical layer for transmission.

 Decapsulation and Encapsulation at the Router : 

At the router, we have both decapsulation and encapsulation because the router is connected to the  more link

1.  After the set of bits are delivered to the data-link layer , this layer decapsulates the datagram from the frame and passes it to the network layer.

2. The network layer only inspects the source and destination addresses in the datagram header and consults its forwarding table to find the next hop to which the datagram is to be delivered. The contents of the datagram should not be changed be the network layer in the router unless there is  a need to fragment the datagram if it is too big to be passed through the next link. The datagram is then passed to the data-link layer of the next link.

3. The data-link layer of the next link encapsulates the datagram in a frame and passes it to the physical layer for transmission

Decapsulation at the Destination Host : 

At the destination host, each layer only decapsulates the packet received, removes the payload, and delivers the payload to the next-higher layer protocol until the message reaches the application layer. It is necessary to say that decapsulation in the host involves error checking.

Addressing :

 Any communication that involves two parties needs two addresses: source address source address and destination address.

  • Although it looks as if we need five pairs of addresses, one pair per layer, we normally have only four because the physical layer does not need addresses; the unit of data exchange at the  physical layer is a bit, which definition cannot have an address.

The following Figure shows the addressing at each layer


  • As the figure shows, there is a relationship between the  layer, the address used in that layer, and the packet name at that layer.  
  • At the application layer, we normally use names to define the site that provides services, such as someorg.com, or the e-mail address, 
  • At the transport layer, addresses are called port numbers, and these define the application layer programs at the source and destination. Port numbers are local addresses that distinguish between several programs running at the same time.
  • At the network-layer, the addresses are global, with the whole Internet as the scope. A network-layer address uniquely defines the connection of a device to the Internet.
  • The link-layer addresses, sometimes called MAC addresses, are locally defined addresses, each of which defines a specific host or router in a network (LAN or WAN).

Multiplexing and Demultiplexing :

  • Since the TCP/IP protocol suite uses several protocols at some layers, we can say that we have multiplexing at the source and demultiplexing at the destination.
  • Multiplexing in this case means that a protocol at a layer can encapsulate a packet from several next-higher layer protocols (one at a time); demultiplexing means that a protocol can decapsulate and deliver a packet to several next--higher layer protocols (one at a time)

The following Figure shows the concept of multiplexing and demultiplexing at 3 upper layer .


  • To be able to multiplex and demultiplex, a protocol needs to have a field in its header to identify to which protocol the encapsulated packets belong.
  • At the transport layer, either UDP or TCP can accept a message from several application-layer  protocols. 
  •  At the network layer, IP can accept a segment from TCP or a user datagram from UDP. IP can also accept a packet from other protocols such as ICMP, IGMP, and so on
  • At the data-link layer, a frame may carry the payload coming from IP or other protocols such as  ARP

The OSI model : 



Although, when speaking of the Internet, everyone talks about the TCP/IP protocol suite, this suite is not the only suite of protocols defined.
  • Established in 1947, the International Organization for Standardization (ISO) is a multinational body dedicated to worldwide agreement on international standards. Almost three--fourths of  the countries in the world are represented in the ISO. An ISO standard that covers all aspects of network communications is the Open Systems Interconnection (OSI) model. It was first introduced in the late 1970s
  • An open system is a set of protocols that allows any two different systems to communicate regardless of their underlying architecture
  •  The purpose of the OSI model is to show how to facilitate communication between different systems without requiring changes to the logic of the underlying hardware and software.
  • The OSI model is not a protocol; it is a model for understanding and designing a network architecture that is flexible, robust, and interoperable.
  • The OSI model was intended to be the basis for the creation of the protocols in the OSI stack. The OSI model is a layered framework for the design of network systems that allows communication between all types of computer system. It consists of seven separate but related layers, each of which defines a part of the process of moving information across a network (see Figure above)

OSI versus TCP/IP : 

When we compare the two models, we find that two layers, session and presentation, are missing from the TCP/IP protocol suite. These two layers were not added to the TCP/IP protocol. suite after the publication of the OSI model. The application layer in the suite is usually considered to be the combination of three layers in the OSI model

Two reasons were mentioned for this decision :
  • First, TCP/IP has more than one transport--layer protocol. Some of the functionalities of the session layer are available in some of the transport-layer protocols
  • Second, the application layer is not only one piece of software. Many applications can be developed at this layer. If some of the functionalities mentioned in the session and presentation layers are needed for a particular application, they can be included in the development of that piece of software





Previous Post Next Post

Contact Form