What is the OSI model and how it works?
OSI stands for Open Systems Interconnection model. This model is generally used to explain, the flow of data over a network or how exactly communication takes place over a network. Real-world networking uses the TCP/IP model which can be considered as a compact version of the OSI model.
OSI model consists of 7 layers:
These layers are nothing but a set of protocols that are used to establish communication over a network.
- Application layer
- Presentation layer
- Session layer
- Transport layer
- Network layer
- Data Link layer
- Physical layer
It is the topmost layer of the OSI model. It is used by network applications. The application layer facilitates functions like file transfer, web surfing, emails, virtual terminals, etc. To help out with these functions it uses a number of protocols like FTP, HTTP/S, SMTP, etc. In short, the application layer provides services for network applications with the help of protocols to perform user activities.
The presentation layer receives data from the application layer, which is generally in the form of characters and numbers. This layer performs three basic functions:
i) Translation: The data which is in the form of characters and numbers is converted to binary data.
ii) Data Compression: The size of binary data is compressed so as to reduce the time required for transmission of file or data packets.
iii) Encryption: Before transmitting the compressed binary data over the network, it is encrypted which enhances the security of data.
Compressed and encrypted data from the presentation layer is received at the session layer. The basic function of the session layer is to establish a connection with other devices (computer) over the network. After receiving the encrypted data session layer tries to establish a connection and if it fails then the process is terminated. The purpose is not only to establish a connection but also to maintain it and synchronise further communication.
Every session established by the session layer is unique which means that it can establish multiple connections from different endpoints simultaneously without all the data getting mixed up.
The transport layer has three basic functions, segmentation, flow control and error control.
i) Segmentation: The data received from the session layer is divided into small units called segments. Each segment contains the source port number, the destination port number and the sequence number. Port number helps to direct each segment to the proper application and the sequence number helps to align all the segments in the proper sequence to form the correct message.
ii) Flow control: The transport layer controls the amount of data being transported.
- If the network is sending data at a speed of 50 Mbps but your device can process only up to 10 Mpbs then with the help of the transport layer, your device can tell the network to send the data at a speed of 10 Mbps.
- Similarly, if the network is sending data at a speed of 5 Mbps but your device can process up to 10 Mbps then it can be communicated to the server to send data at a speed of 10 Mbps.
iii) Error control: If some segments of data don’t appear at the destination address, then the transport layer uses a scheme called ‘ Automatic Repeat Request’ to re-transmit the lost or corrupted data.
To perform the above functions, the transport layer uses two protocols TCP and UDP
- TCP (Transmission Control Protocol)
It facilitates connection-oriented transmission which means that the connection between computers is established and maintained for the duration of the request. A TCP connection makes sure that the two devices remain in constant communication. It makes sure that complete data is received at the receivers end. TCP is slower as compared to UDP. It is used in situations where accuracy is more important than speed (file transfer).
- UDP (User Datagram Protocol)
It facilitates connection-less transmission which means that packets of data are essentially thrown at the receivers end but it doesn’t care about whether the receiver is able to keep up with the data. UDP is faster as compared to TCP. It is used in situations where speed is more important than accuracy (video streaming).
The network layer is responsible for locating the destination of your request. The IP addresses of the sender and receiver are attached to the data packet. For example, the Internet is a huge network; when you want to request information from a webpage, it’s the network layer that takes the IP address for the page and figures out the best route to take. At this stage, we’re working with what is referred to as Logical addressing (i.e. IP addresses) which are still software controlled. Logical addresses are used to provide order to networks, categorising them and allowing us to properly sort them. Currently, the most common form of logical addressing is the IPV4 format
Data Link layer:
This layer focuses on the physical addressing of the transmission. In this stage, the MAC address of the sender and receiver is attached to the data packet. A physical address is nothing but the MAC ( Media Access Control ) address. Every network-enabled computer has a Network Interface Card (NIC) which has a unique MAC address. MAC addresses are set by the manufacturer which cant be changed by the user. While receiving data, the Data Link layer makes sure that it hasn’t been corrupted during transmission.
The physical layer is right down to the hardware of the computer. Up to the data link layer, the data is in the form of binary data. The function of the physical layer is to convert this binary data into signals and transmit them over local media. It can be an electric signal in the case of copper cable or LAN cable, a light signal in case of optical fibre and a radio signal in the case of air. The signal generated by the physical layer depends on the type of media used to connect the devices
Now, at the receivers end this complete process goes in the reverse direction (i.e. from the physical layer to the application layer). Finally, the application layer at the receivers end makes the data visible in the form of characters so that the receiver can get the proper message.
This was all about the OSI layer.
For any queries feel free to contact me on LinkedIn
Happy Learning !!