OSI stands for Open system interconnection model. Now before reading this article, you are supposed to have a basic understanding of Networking. If you know basics of networking, you must know that two majour parts of networking are being considered. Application layer where you make certain requests and you get response. Also a internal part of networking which users has less to no information about can also be termed as Internet part.
Now In OSI model we basically focus on that inner part of internet or networking. And see different layers in which networking between devices occurs. Hence OSI sets an standards for how people or any server etc communicate with each other. What are the different layers involved, How each layer contribute in transfering data from one device of network A to other device of network B.
7 Layers of OSI model :
- Application layer
- Presentation layer
- Session layer
- Transport layer
- Network layer
- Data link layer
- Physical layer
It is sorted in highest to lowest manner. That means data starts transfering from Application layer and reaches to physical layer via different other layers. And each layer has certain task that it performs that we will see in details.
Application layer :
These are basically installed softwares in your device which you use to build connection with other device. For example : Whatsapp, messaging app etc. This layer basically can be understood as the user interface for networking because most of the time users are dealing with this layer only.
Its existence just helps in sending data to presentation layer. It contains some data given by the user and send it to the presentation layer in raw form. Suppose you written to your freind : “Hi how are you ?” So application layer will just help in taking this data to presentation layer.
Now this was the last user interface layer. Else every process will be internally. If you remember in starting I talked about internet part in networking which works internally. So these next some layers will be those.
Presentation layer :
As the name suggests presentation of data coming from application layer is the majour concern in this layer. Again user has no idea whats going on here. It basically converts that data(char, int, float etc) into machine representable binary format i.e 0 and 1. It changes ASCII(American Standard Code for Information Interchange), EBCDIC (System dependent data) to an independent form. This process of converting raw data to machine representable binary data is know as translation.
Also encryption of data is also taken into consideration for security purposes so that complete data should be transfered from presentation layer to session layer securily. It also provide data abstraction and hides irrelevant data from the user. Data compression also happens here keeping speed and memory optimization.
Keeping data encryption and security in mind, we use SSL protocols i.e Secure Sockets Layer protocols. Protocols can be understood as the rules of communication between devices in different networks.
After converting data coming from application layer and compressing it, it sends data to Session layer with proper security and using SSL protocols.
Session layer :
Session layer protocols basically helps in setting up and managing the connections between devices and it enables sending and recieving of data followed by termination of the connected sessions.
Authentication and authorization is the main stuff this layer deals with. Also this layer assumes that layers below session layers will perform its work if I do the session establishment.
Transport layer :
Transport layer takes care that data establised in the session layer should be transfered to the correct IP-address. It has its own protocols of how data will be transferred like ‘UDP’(User datagram protocol) and ‘TCP’(Transmission Control Protocol).
Lets discuss some internal working of Transport layer :
Segmentation
The data received from session layer will be divided into segments (small data units ). Every segment will contain the source and destination PORT number and the sequence number.
Sequence no -> Reassemble the segments in the correct order.
Flow Control
Transport layer controls the amount of data that is being transferred. Flow control works on error control. Some data package got lost or get corrupted. It adds checksome to every data set to check the data received is complete or not. Connection oriented transmission occurs here and TCP protocol is used for that reason.
While in connection less transmission also takes place using protocols like UDP which is faster because does’nt provide any feedback if data is lost or not.
After performing all these above task, our data will move to network layer.
Network layer :
It works for the transmission of the recieved data segments from one computer to another computer that is located in a different network.
Till transportation layer, we were talking about our own network in which our device is located. But when it comes to network layer, we need to deal with other networks. That is where routers comes into the picture.
Function of Network layer :
- Logical addressing : Ip addressing done in the network layer is logical addressing.
- Network layer assigns the senders and recievers IP address to every segment and it forms an IP packet. So that every data packet reaches the correct destination. Also it perform routing. Moving one data packet from source to destination.
- Load balancing also happens here.
DataLink Layer :
It allows to communication directly with the computers and hosts. Recieve data packet from the network layer and this data packet contains the IP address of both the sender and the reciever.
This layer actually doing this one addressing :
→ Physical addressing.
Here in physical addressing basically the idea is, which application to send this data to? (Known as physical addressing)
For example : Suppose you sent a message to your friend. Now data will travel through these paths and come to network layer where data will be sent to datalink layer. Now In the network of receiver’s side, there might be too many devices connected. Now suppose you sent some confidential word it sent it to his fathers computer.
That is where physical addressing helps. Which device this should be sent to. This is something done at Data link layer. One address, you may know about is MAC address. (Read more about it on google if you want).
Now Mac addresses of sender and reciever are assigned into the data packet to form a frame.
Frame : Data unit of the Data link layer.
Mac : Mac address is a 12 digit alpha numeric number of the network interface of your computer.
Data link layer perform 2 functions :
- Allows the above layers of OSI model to access these frames.
- Also controls how the data is placed and recieved from the media using media access control.
Media Access Control : Used to get the frame ON and OFF media like error detection and stuff.
Physical Layer :
It contains of hardware section and here you actually have some wires or mechanical mediums. It transmits the bits from electrical signals. It doesnt have packets, segments etc.
You work with cables etc. Data that you get from the above is in the form of 0’s and 1’s. Physical layer will transport it over wires and local media. It can be electrical signal.
Recieves signal at receivers section convert it into bits pass it to the data link layer as a frame and frame will be moved to higher layers.