Tuesday, 14 November 2017

Encapsulation and Layered Communication


As data is passed from the user application down the virtual layers of the OSI model, each layer adds a header (and sometimes a trailer) containing protocol information specific to that layer. These headers are called Protocol Data Units (PDUs), and the process of adding these headers is called encapsulation. Note that in the TCP/IP protocol suite only the lower layers perform encapsulation, generally.



For example, a Transport layer protocol such as TCP will add a header containing flow control, port numbers, and sequencing. The Network layer header contains logical addressing information, and the Data-link header contains physical addressing and other hardware specific information. 


The PDU of each layer is identified with a different term:--



For example:--



Ø Transport Segments

Ø Network Packets

Ø Data-Link Frames

Ø Physical Bits


Each layer communicates with the corresponding layer on the receiving device. For example, on the sending device, source and destination hardware addressing is placed in a Data-link header. On the receiving device, that Data-link header is processed and stripped away (decapsulated) before being sent up to the Network and other upper layers.



Network devices are commonly identified by the OSI layer they operate at; or, more specifically, what header or PDU the device processes. 


For example, switches are generally identified as Layer-2 devices, as switches process information stored in the Data-Link header of a frame, such as Ethernet MAC  dresses. Similarly, routers are identified as Layer- 3 devices, as routers process logical addressing information in the Network header of a packet, such as IP addresses.



Encapsulation Illustrated




The following illustrates how basic encapsulation occurs with the TCP/IP stack, which typically performs encapsulation only at the lower layers: 

During encapsulation on the sending host:-- 

v Data from the user application is handed off to the Transport layer.
     v The Transport layer adds a header containing protocol-specific
     v information, and then hands the segment to the Network layer.
     v The Network layer adds a header containing source and destination
 v logical addressing, and then hands the packet to the Data-Link layer.
 v The Data-Link layer adds a header containing source and destination
 v physical addressing and other hardware-specific information.
 v The Data-Link frame is then handed off to the Physical layer to be
 v transmitted on the network medium as bits.

During De-capsulation on the receiving host, the reverse occurs:

v The frame is received from the physical medium.
v The Data-Link layer processes its header, strips it off, and then hands it off to the Network layer.
 vThe Network layer processes its header, strips it off, and then hands it off to the Transport layer.
 v The Transport layer processes its header, strips it off, and then hands
 v the data to the user application.