OSI Model is a standard of how computers/servers/people communicate with each other.
The Open Systems Interconnection (OSI) model describes seven layers that computer systems use to communicate over a network. It was the first standard model for network communications, adopted by all major computer and telecommunication companies in the early 1980s.
The OSI Model
There are seven layers in the standard OSI Model.
- Application Layer
- Presentation Layer
- Session Layer
- Transport Layer
- Network Layer
- Data-Link Layer
- Physical Layer
Each of these layers have different ways of working, different sets of protocols, which define them differently from each other.
Let us take a brief look on all the layers one by one.
The application layer is implemented in Software. It is the layer which is used to interact with the applications.
Mainly, applications reside in the Application Layer.
Let us take an example of sending a message.
As the sender, we will interact the the application layer, and send the message.
The application layer sends the message to the next layer in the OSI Model, which is the Presentation Layer.
There are several protocols in the Application Layer. (about which we will discuss in the upcoming posts)
The data from the application layer is forwarded to the presentation layer. The presentation layer receives the data in a different form (in a form of words, characters, letters, numbers, etc) & converts them into machine representable binary format. This process is known as Translation. Here, the ASCII characters are converted into EBCDIC.
Now before the converted data is sent further, it goes under encoding and encryption processes. The data is encrypted in order to preserve it for the actual receiver, which means, changing the data so that it is only readable to person that it was sent to.
SSL (Secure Socket Layer) Protocol are used for the encryption and decryption processes.
The presentation layer also provides abstraction and assumes that following layers will take care of the data that is forwarded to them by the presentation layer. It also plays a role in compression of the data. The compression can be lossy or lossless, depending on various other factors that are beyond the scope of this post.
The session layer helps in setting up and managing connections.
It enables the sending and receiving of data followed by the termination of connected sessions.
Authentication (username, password, etc) is done before a session is established, followed by authorization (permissions etc).
E.g:- online shopping from the forem shop
A session is created between your computer and the forem shop's server.
The main work of this layer is to establish a session.
Alike the previous layers, the session layer also assumes that after it's work is done, the data will be correctly handled by following layers.
Data transportation is done by the transport layer.
It has its own set of protocols of how the data will be transferred.
The data received here by the session layer is divided into smaller data units called segments. This process is known as
Segmentation. Every segment will contain the source's and the destination's port number and a sequence number.
The port numbers are used to identify the application on which the data needs to be sent at. Note that the data is transferred in chunks. Therefore, it is required to assemble it back together. Therefore, sequence numbers are used to reassemble the segments into correct order.
The transport layer also take care of the Flow Control, i.e, it controls the amount of data being transferred. E.g:- let's say that the server is sending the data at 40mbps, but the client has a receiving speed of 20mbps. This is not possible, hence the transport layer will tell the sender to 'slow down'.
Transport layer also accounts for error control. That is the data loss, data corruption, etc. It makes use of a thing known as Checksum. The transport layer adds a checksum to every data segment in order to check whether the sent data is received correctly or not. (If you want to learn more about these topics, just wait till the next post on TCP/IP is up 😄 )
Data is now transferred to the Network layer.
Note that these four layers- Application, Presentation, Session, and Transport, are all a part of our own network.
The layers which are going to be discussed now are used to communicate with devices in a different network.
The network layers helps to communicate with other networks.
It works for the transmission of received data segments from one computer to another, that is located in a different network.
Router lives in the network layer.
The function of the network layer is to do the Logical Addressing (IP Addressing). It assigns the sender's and receiver's IP address to each data packet to make sure it is received at the correct destination. The network layer then performs Routing (moving one data packet from source to destination) of the data packets.
So the main motto of this layer is the addressing and moving the data packets.
Load-Balancing to make sure that no overloading takes place also happens in the network layer.
The data is now transported to the data link layer.
The data link layer allows us to directly communicate with other devices (computers and hosts).
It receives the data packets (containing IP address of the sender and the receiver) from the network layer and does the Physical Addressing (MAC Addressing), i.e, assigns MAC addresses of the sender and receiver to a data packet in order to form a frame.
This layer consists of all the Hardware and Mechanical stuff like wires etc.
The Physical layer transfers bits by electrical signals, radio signals, etc.
The data received by the preceding layers are in the form of 0s and 1s. The physical later converts this data and transports it over to local media (wires, electrical signal, light signal (in case of optical fiber cables), radio signal (in case of wifi), etc).
Note that the Physical layer works at the receiver's end and transports the received signal to the data link as a frame (by again converting it back to bits). The frame is moved to the higher layers and ultimately the required data is received at the application layer, which is the software.
In this post, we went through the different layers of the OSI Model and how they function.
The OSI Model is more conceptual in nature.
It is the TCP/IP Model that is used for practical scenarios.
The following posts of this series will focus on the deep dive of each layer, The TCP/IP Model, and the various protocols that are being used in the transfer of data.
Thanks for reading 🌸