Data Encapsulation in the OSI Model

Before you start

Objectives: learn how data travels between OSI layers, how is data transformed and how do we refer to data at different layers.

Prerequisites: you should know function of each layer of the OSI model.

Key terms: data, layer, network, segment, bits, osi, port, session, source, destination, address, frame, model, packet, transport


Data Flow and Encapsulation

Data flow occurs when two devices are connected in a network with some kind of shared transmission medium. An application running on the source device creates some kind of data. This happens at theApplication layer.

Application Layer

Image 181.1 – Application Layer

In our case the application needs to add encryption to that data. This will be done at the Presentation layer.

Presentation Layer

Image 181.2 – Presentation Layer

At the Session layer it appends the Session ID. At this point the information is still one block of data.

Session Layer

Image 181.3 – Session Layer

Next, data goes down to the Transport layer. The Transport layer breaks the data into blocks of data which we call Segments. Every Segment also gets the Port number to identify which upper layer application needs to receive the data on the destination device.

Transport Layer

Image 181.4 – Transport Layer

The Segment is then passed to the Network layer. The Network layer takes the Segment, which includes the Port number, and appends the source and destination IP address. At that point the Segment becomes a Packet.

Netowrk Layer

Image 181.5 – Network Layer

The Packet is then passed to the Data Link layer where the source and destination MAC addressand the CRC is added. At this point we have a Frame.

Data Link Layer

Image 181.6 – Data Link Layer

The Frame then is sent to the physical device where it is translated into some kind of a signal, whether it’s electrical, radio wave, light or other signal. This Frame then becomes some kind of a signal that represents a series of zeros and ones. This is why at the Physical layer we often call it Bits. The Network Interface Card (NIC) prepares those signals and sends it out on the transmission medium.

Physical Layer

Image 181.7 – Physical Layer

Decapsulation at the Destination Device

The destination device receives series of bits and interprets them as a Frame. It then examines the MAC addresses and CRC. If everything is OK, it removes MAC addresses and the CRC, and passes the data up to the Network layer. At this point the IP addresses within the packet are examined. If the IP addresses are OK, they are removed and the Packet is forwarded up to the Transport layer where the Segment is then examined. The Port number is looked at and the Segment gets forwarded up the to the appropriate application specified by the Port number. At this point the Session ID is used, any encryption may be removed, and the data in its original form is presented to the application that needs to interpret it.

Remember

Data flows down through the layers of the OSI model and is transformed at each layer. On the source machine, data is broken down into Segments, which are then transformed into Packets, then Frames and then Bits. On the receiving device the Bits are converted back to Frames, back to Packets, back into Segments, and then Segments are reassembled into the original data. Encryption, formatting and session numbers are added to the data at the upper layers. At the middle layers data is broken down into Segments associated with a Port number, then given the IP address. At the lower levels packets are transformed into Frames that include the source and destination MAC address. Frames are transformed into Bits for transmission through the network.