The OSI Reference Model and Seven Layers of OSI

The OSI Reference Model and Seven Layers of OSI. When Doret invented solid chocolates he needed a way to deliver it to people undamaged so he thought to cover it. He also decided that for good delivery why not to put covered chocolates in boxes and why not to even cover these boxes for better view! Of course he will label the box in order to reach its proper destination. When you buy the box, you first open its cover then the box itself then the cover of the piece of chocolate until you finally get your chocolate! Congratulations. If you got that then you understood what I want to say today. Yah, I’m not joking.
In network world our main aim is to deliver data transferred from one device (source) to the other (destination).The data we want to deliver is called packets.
But again, what is the data (or packets) transferred?

image

Consider the example of you chatting with your friend, then chatting is that data.
Another example is your surfing the web, the URL for example is a data sent, and the page is a data received.
Now think about OSI seven layers model in the same way; a way to cover packets for proper delivery and to reach undamaged no more. Now let’s dive into the technical details of these layers and how they work.
The OSI Reference Model consists of seven layers as shown.
image

Application layer:

This is the layer at which user communicates with the computer, or in other words it includes user’s programs such as IE (or any other browser), Yahoo, and Skype.
But to be honest, application layer just works as an interface between these programs and the protocols of the internet such as HTTP. If you don’t know what the protocol is, don’t worry as I will cover it later.

image

Presentation layer:

This layer just presents the Application layer and does data formatting.
Of course you wonder what is meant by data formatting!!
To answer this question, we will consider an example of you chatting with your friend through Yahoo or Skype. Of course computer won’t understand what you are writing, as it just knows (0’s and 1’s). Ya that’s the language of the computer.
So of course the function of this layer (which is next to the application layer) is to reformat the data got from the application layer, and that’s what it really does. Not just that, but it also takes care of another tasks such as compression and encryption of data.

image

 Session layer:

You are now doing both, browsing through Mozilla Firefox and chatting through Skype. Both are converted through Presentation layer to 0’s and 1’s. How they are separated?? … How to know that this data is of browsing and this is for chatting?!!
Actually, the answer of the first question is right here, in session layer … as it takes care of keeping data streams of different applications separate. But you will have to wait the answer of the second question in the other layers.

image

Transport layer:

When you send a message with a little kid to deliver it to someone, you do one of two things.
The first you send him and forget about him if the message is not important or the person you are sending him is not so very important.
The second is that you send him with an important message and ask him to call you from there to make sure that message is properly delivered.
And that’s exactly what happens in the world of networking. If the message is important we wait an “Acknowledgement” from the receiver and that’s what we call “Reliable communication”, or we don’t care about the message sent and we don’t wait for acknowledgements and that’s what we call “Unreliable communication”.

image

Transport layer is the layer that determines whether the communication is reliable or unreliable, through selecting the protocol if TCP or UDP (We will cover these protocols later).
This layer also establishes the connection between the two communicating hosts and determines what is called “window size” which is how many packets will the sender send for one Acknowledgement from the receiver.
Because of course if you received an Acknowledgement for each packet sent, communication will be slow and bandwidth will be greatly consumed.
In this layer I will answer the second question related by determining if data is of browsing of chatting. That’s because any application uses either TCP or UDP (determined by the application programmer) and each application uses specific “port number” and these are logical numbers assigned to applications to differentiate between them.

 Network layer:

You might have previously heard about “IP address” and actually this layer is its source.
This layers uses IP address (which is a logical address) to move packets from one network to the other, or from one LAN to the other.
The router specifically works on this layer as it understands the IP address labeled on the packet and delivers it from source to destination.

image

Data Link layer:

This layer works on the MAC address labeled on the packet. Unlike the IP address, MAC address is a real address, and it is the address burned on your Ethernet card so it called “built-in” address.
This address is used to move packets from on host to the other on the same LAN.
The switch specifically uses this address to move packets between hosts according to source and destination MAC addresses.

image

Physical layer:

This layer just does two things: send bits and receive bits and this is done in wired cables or wirelessly.
Now to get the full picture, let’s consider of you chatting with your friend.
Note that the following process is called “Data Encapsulation”.
Your IP address is 10.0.0.2 and your MAC address is aaaa.aaaa.aaaa
Your friend IP address is 172.16.0.4 and his/her MAC address is bbbb.bbbb.bbbb
When you say “hey” this is done in the chatting window (The application layer), it is then sent to the (presentation layer) to change its format to an acceptable format to the computer. Now you got a piece of “data”.
image

The session layer will go on its work and if any other application is used, it will separate it from this data.clip_image003

In transport layer and according to the application you are using, it will determine whether to use TCP or UDP, and then assign the port number used to the “data”.
Assuming using a source port of 2077 and destination is 50 then both of these port numbers will be labeled on the data, hence it will be called “segment”.
Going down to the network layer, both source and destination IP addresses (10.0.0.2 and 172.160.4) will be labeled on the frame, hence it will be called “packet” (and this the common name).
Down to the data link layer, both source and destination MAC address will be labeled on the packet (aaaa.aaaa.aaaa and bbbb.bbbb.bbbb), hence we will call it a “frame”. This frame is sent as 0’s and 1’s through cables or wirelessly (The physical layer). They pass routers and switches (or maybe nothing) until they arrive the destination, where it was recognized through its IP and MAC addresses.
The destination recollect 0’s and 1’s forming the segment à removes source and destination MAC address in its data link layer to become packet again à removes source and destination IP address in its network layer to become segment again à identifies the application used through its transport layer à reformat it to become a written text to be displayed on your application again “hey” … What a world !!

Summary of Layers

image

Let's Discuss