Introduction to the OSI Model

In order to understand computer networks and how they work, we first need to learn about the OSI Model.

The OSI Model is a standard that defines a set of steps that should be followed when two nodes in a network want to communicate. If you ever decide to create a device or an operating system, and you want it to connect to your network or to the Internet, then you have to implement the OSI model.

A Little Bit of History

Before the OSI model was developed, proprietary solutions were the norm and network devices were not compatible with each other. This was a serious issue, since not only solutions from different vendors were not inter-operable, but this has also slowed down the development of computer networks and internet itself.

The OSI Model (Open Systems Interconnection Model) was therefore developed as a proposed solution for this problem. Its main goal was to standardize the communication between different devices through a network.

Unfortunately, the timing the OSI model was released could not be any more inappropriate. At that time, manufacturers have already started to implement a suite of protocols that was later standardized in the commonly known TCP/IP model. That’s why modern networks and internet are using the TCP/IP suite of protocols that follows the TCP/IP model rather than the OSI Model.

Despite their differences, there are still some similarities between the two models. That’s why, even if not implemented, you will still encounter today the OSI Model as often as the TCP/IP, if not more. It is used as a reference and a great teaching tool for associating different network functions and protocols with their corresponding layers.

I think we’ve had enough history for the day. Let’s go ahead and break down the OSI Model.

OSI Model Layers

In the good old days, if you want to communicate with a person, you would send him a letter. This process would basically follow these steps:

  1. You write your message on a paper.
  2. Next,you put the paper in an envelope.
  3. You take the envelope to a post office.
  4. The post office then takes your envelope to the recipient.
  5. The recipient opens the envelope.
  6. And finally, the recipient reads your transmitted message.

Here is another, simpler, way to represent this process.

Letter delivery process

As you can see, when sending a letter, the process starts from the higher layer (Paper) to the lower layer (Post Office). The lower layer transmits the message. And finally, when received, the message goes from the lower layer to the higher layer.

Now to go back to our topic, the OSI model is based on this same logic. The only difference is that it has 7 layers instead of 3.

OSI Model layers
The layers of the OSI Model

Suppose that Alice wants to send a message to Bob. How will that work?

If you understood the post office example, then you shouldn’t have a hard time figuring this one out. It’s simple. Just like a letter, when data is transmitted from Alice to Bob, it goes through each of the 7 layers of the model.

Application Layer

Communications start and end with this layer. This one does not have any specific role.It is the interface between the user (Sender/receiver) and the underlying layers. You can think of it as the paper in our post office analogy. All other layers below it are there to provide services to it.

Presentation Layer

The presentation layer is the one responsible for encoding/decoding, compressing/decompressing and presenting the data in an acceptable format for the application layer.

Session Layer

The session layer is responsible for setting up, maintaining and tearing up a logical connection between the two communicating machines.

Note: You do not have to worry a lot about the presentation and session layers, as these two are only present in the OSI model, and are not part of the TCP/IP model. We’ll talk about this later in this chapter.

Transport Layer

The transport layer has an important role in managing end-to-end communications.

Network Layer

The network layer is responsible for moving packets between different nodes from source to destination. It is the one responsible for finding the best way that the packets can go through to get to their destination.

Data Link Layer

The Data-Link layer connects machines within a single network. When data needs to go beyond a local network, then it is the network layer that deals with the routing.

Physical layer

This layer deals with encoding and decoding the bits for transmission through a physical medium (Twisted-pair cables, fiber optics, wireless communications…). Network cards and cables are parts of this layer.

Encapsulation and Decapsulation

Now that we are familiar with each of the 7 layers, let’s go ahead and see what happens when Alice sends a message to Bob.


  1. Alice sends the message through an application. The application layer sends the data down to the presentation layer.
  2. The presentation layer encodes the payload (data) into a predefined format for transmission through the network, and adds a presentation layer header before sending it down to the session layer. This header will allow the presentation layer of Alice to communicate with that of Bob.
  3. The session layer adds its own header to the payload. This header will contain the information necessary for the two machines to maintain the session.
    • Note that the payload and header in each layer becomes the payload of the layer below it.
  4. Following the same logic, the transport layer will add its header to the payload and send it down to the network layer.
  5. Another header is then added by the network layer.
  6. The data-link layer adds the last header, along with a trailer after the payload.
  7. Finally, the physical layer of Alice transmits the resulting payload to the physical layer of Bob.

This process is called encapsulation. As you can see, each layer encapsulates the data provided to it by the layer above it.

OSI Model Encapsulation
The process of encapsulation


Bob will then receive the packet by following the same process, but in reverse order. This time, this process is called, unsurprisingly, decapsulation.

  1. The physical layer of Bob will receive the packet sent by the physical layer of Alice.
  2. The data-link layer of Bob will then read the header that was added by the data-link layer of Alice. This header will be removed and the payload is then sent to the layer above.
  3. The network layer will read the header and send the packet to the transport layer.
  4. Well… You can see where I’m going with this.

Each layer will do the same until the payload arrives at the application layer. At this stage, Bob is able to retrieve the same message that Alice sent.

The process is as simple as this. Of course, there are a lot of protocols and mechanisms in play, but in a high-level, this is how computer networking works.

OSI Model vs TCP/IP Model

Before we end this chapter, you should at least know the layers of the TCP/IP model and how they relate to the OSI Model.

The TCP/IP Model

As you can see in the figure, there are two main differences worth mentioning.

  • First, the application, presentation and session layers are all merged into the application layer.
  • And second, the network access layer combines both the physical layer and the data link layer of the OSI Model.

Now that you have a high-level understanding of the working principle of computer networks, I think you are ready to cover each layer in more detail. In the next chapter, we’ll start with the physical layer.


1 thought on “Introduction to the OSI Model

Leave a Reply

Your email address will not be published. Required fields are marked *