Categories
Computer Networking

The OSI Model Explained

Today I will talk about the OSI model.
But first, I should define what a networking model is.

What is a Networking Model?

A networking model is a framework for understanding how different pieces of a network interact with one another.

If you want to know why and how this model was created, I have an article just on that.

OSI Model

It consists of 7 layers that define the different functions in a network.

Functions of OSI model's 7 layers.
Functions of OSI model’s 7 layers.

Before going into the details of each layer, you should know that network engineers usually work on layers 1 to 4 only. Layers 5 to 7 are application developers’ territory.

Layer 1: Physical Layer

  • The data at this layer is in the form of Bits (1s and 0s).
  • Define the specifications of the medium that transfers the data (cable specifications, max transmission distances, etc…).
  • Hardware: cables, repeaters, hub, plugs.

Layer 2: Data Link

  • The data at this layer is in the form of Frames.
  • Transfer data from one node to another within a network (node-to-node communication).
  • Detect and correct (if possible) physical layer errors.
  • Hardware: switch, NIC (Network Interface Cards).

Layer 3: Network

  • The data at this layer is in the form of Packets.
  • Transfer data between networks.
  • Forwarding and routing of data from source to destination.
  • Hardware: router, hosts.

Layer 4: Transport

  • The data at this layer is in the form of Segments.
  • Segment and reassemble data so that if one piece of data is not transmitted properly, it is not a big problem because the rest of the data will arrive safely.
  • Host-to-host communication.

Layer 5: Session

  • Establish, manage, and terminate sessions between hosts.

Layer 6: Presentation

  • Translate data in a format that applications understand.
  • Encryption, decryption, compression, and decompression of data.

Layer 7: Application

  • Work with software applications
  • Allow access to network resources
  • Process-to-process communication

Data Encapsulation/De-encapsulation

Let’s take the example of 2 PCs communicating.

Encapsulation and de-encapsulation process on the OSI model.
Encapsulation and de-encapsulation process on the OSI model.

When PC 1 sends data to PC2, this data goes through all of the layers that we see above:

  • First, the data is sent through layers 7, 6, and 5.
  • At layer 4, a header will be added to the data. The combination of the two is called a segment.
  • Layer 3 will also add its header. We now have a packet.
  • Layer 2 will add one header and one trailer (in front of the data). All of these combinations make a frame.

Finally, the data will be sent from the sender’s physical layer to the receiver’s physical layer in the form of bits.

PC2 will then follow the same process as PC1 but in reverse order: this is called de-encapsulation.

By the way, the combinations I talked about in the encapsulation process (data, segments, packets, frames, and bits) are known as PDUs (Protocol Data Units).

Adjacent-layer interaction and Same-layer interaction

When adjacent layers of the OSI model (in one device) interact with each other we call this adjacent-layer interaction.
Example: when the data is encapsulated/de-encapsulated.

When two same layers communicate, we call it same-layer interaction.
Example: when a web browser and a web server communicate (both at the application layer).

Resources:
Jeremy’s IT Lab: Free CCNA | OSI Model & TCP/IP Suite | Day 3 | CCNA 200-301 Complete Course
Practical Networking: OSI Model: A Practical Perspective – Part 1 – Networking Fundamentals – Lesson 2
OSI Model: The OSI-Model is a simple way