Day 3 — CS Fundamentals December — About Networking — The OSI Model

Yashvardhan Kukreja
7 min readDec 4, 2019

--

Networking is one of those vast areas which covers a huge range of topics and concepts extremely crucial for a software engineer to know about.

So, I have decided that for the next couple of days (3–5), I’ll be writing articles around the topic of Networking and hence, will be covering some very crucial topics associated with it.

Here, I am writing about OSI model as it is one of the most, probably the most fundamental topic in networking as it discusses how exactly two computers communicate over the internet.

Let’s dive in!

Introduction — The rise of the need of OSI Model

So, the most basic form of making two computers communicate with each other is two connect them with a LAN cable and the NIC or the Network Interface Card in each computer allows sending and receiving data through LAN cable.

But a problem arises when the computers are different in terms of, say, Operating System.

So, to tackle this problem of establishing network and communication across different kinds of computers and architectures, an organisation ISO said, “Let’s create a one-for-all model which every computer on the internet will obey so as to communicate/network and hence, every computer vendor has to create their services and products in relation to that model.”

So, basically, this model would be making all the computers capable of networking without worrying about the other computer’s operating system or network architecture.

Hence, A 7-layered OSI model was created.

So, what is OSI Model?

It is basically a conceptual model or framework with a bunch of protocols which defines how computers communicate over a network.

This model is composed of 7-layers and every layer is composed of a bunch of protocols for dealing with some type of data transmission over the network.

Sorry for my not-so-good draw.io skills XD

How does it work?

So, the OSI model divides data transmission between two devices, over a network, into 7 groups of functionalities or the so-called “layers” which are hierarchically arranged.

And, the higher layers are dependent on the lower layers meaning Layer 1 / Lowest Layer is independent and Layer 2 / Second Lowest Layer is dependent on Layer 1 and so on.

I will be explaining the individual layers and I hope that would help you visualise how data flows or moves through the OSI model.

The Layers

1). Layer 7 — Application Layer

It is used by applications like chrome, firefox, skype, etc. which are the entrypoint to use internet services. These applications are dependent on the protocols of application layer to communicate over the internet.

The protocols are HTTP, HTTPS, FTP, SNMP, etc. This layer is the entrypoint from the user to the internet.

2). Layer 6 — Presentation Layer

This layer takes data from application layer and processes it into another form for proceeding the further data transmission.

  • So, the application layers sends data in the form of general characters and numbers. The presentation layer translates that data into machine-understandable binary code.
  • Then, this binary code is compressed using compression algorithms which makes the data transmission much faster due to lighter data.
  • Then, the compressed data is encrypted (or decrypted if the computer is the receiver) so as to make things secure ;)

3). Layer 5 — Session Layer

This layers helps in setting up connections when data transmission is required and closing the connections when the data transmission is not required.

  • Hence, it maintains and manages the network sessions through APIs. It is responsible for mechanisms like authentication and authorization involved over the network.
  • Also, the computer over a network receives files on the server (like image, video, etc.) in the form of network packets. So, session layer also keeps a track of which file corresponds to which network packet.

4). Layer 4 — Transport Layer

Here, the data received from the session layer is divided into segments. Segments have details like sequence number, port number, etc. so as to make sure that the right segment reaches the right application (role of port number)in the right order (role of segment number).

  • Also, transport layer helps in error control where it makes sure that the corrupted data is re-transmitted and hence, makes sure that the receiver receives all the data rightfully.
  • Also, transport layer makes sure to not cause network congestion which means sending data so fast and high that it becomes difficult for the receiver to process it. This is called flow control.

For example, let the sender sends data at a rate of 100MBps but the receiver can process it at a rate of 50MBps only. So, the receiver uses the transport layer to tell sender, “Dude! Chill down! I cannot process data at such a high rate. Send me data at a rate of 50MBps.

Also, if the sender sends data at a rate of 1MBps, then the receiver uses the transport layer to tell sender, “Common man! I am not that tired. I can handle data upto a rate of 50MBps so please send data faster”.

5). Layer 3 — Network Layer

Everything associated with IP addressing and path determination is done by this layer.

  • Every computer on the network has a unique IP address and hence, Network Layer adds sender and receiver IP addresses to the data segment from session layer. This creates a network packet and makes sure that every network packet reaches the rightful destination.
  • Network layer also makes sure to choose the best possible and fastest path for the network packet to be transmitted from sender to receiver.

The IP addressing done here at the network layer where sender and receiver IP addresses are attached to segment is called Logical Addressing.

6). Layer 2 — Data Link Layer

Data Link Layer performs physical addressing where it adds MAC addresses of the sender and receiver to the network packet coming from network layer.

This converts the network packet into a frame.

This entire operation is performed by Network Interface Card or NIC.

It is responsible for accessing the media and controls how data is sent and received from the media (like LAN cable).

So, multiple computers can be connected to a single media like a LAN cable. Now, if they are simultaneously sending data frames to it, there might be a chance of data collision hence, corrupting the data.

So, data link layer deals with this and makes sure such corruptions don’t happen by keeping an eye on the media when it is free and when it is not.

7). Layer 1 — Physical Layer

Now, understand this that the data up until now is in the form of binary code but transmission of data “across” the network through wires/air requires data to be in form of signals.

Hence, physical layer converts that data into signal form for data transmission.

Also, at the receiver side, it converts the received signal form into binary format for the further layers to process the data.

And finally, on the receiver side, the received data propagates from Layer 1 -> Layer 7 by similar operation and finally, the Layer 7 or the application layer makes sure that the user “sees” the received data the right way.

That’s it!

Thanks a lot for reaching till here!

I hope you understood everything in this article and considering the amount of jargon involved in this article, it is totally okay to also not understand the article fully.

But chill! Give this article another read and believe me, you will be able to visualise things much more clearly.

Stay tuned for another article which is going to come tomorrow associated with some other interesting CS fundamental.

Find me on

LinkedInhttps://www.linkedin.com/in/yashvardhan-kukreja-607b24142/

GitHubhttps://www.github.com/yashvardhan-kukreja

Email — yash.kukreja.98@gmail.com

Adios!

--

--

Yashvardhan Kukreja

Software Engineer @ Red Hat | Masters @ University of Waterloo | Contributing to Openshift Backend and cloud-native OSS