Photo by Jordan Harrison on Unsplash
From Physical to Application: Exploring the Layers of the OSI Model
๐ Introduction
Have you ever wondered, how data travels across the internet, seamlessly reaching to it's destination? Behind the scenes, a framework called the OSI (Open Systems Interconnection) model plays a vital role in this process. In this article, I'll explain 7 layers of OSI modal and to make things more relatable I'll also explain an example of sending a POST (JSON) request through these layers.
โ๏ธ What is OSI Modal?
The OSI (Open Systems Interconnection) model is a conceptual framework that helps understand how different computer systems communicate with each other over a network. It consists of seven layers, each with its specific functions and responsibilities. It serves as a universal guideline for network communication and allows different devices and software to understand and interoperate with each other, even if they are from different manufacturers or use different technologies. Basically, it promotes standardisation and ensures that network components can work together seamlessly.
๐ง Layers of OSI Modal
There are 7 layers in OSI Modal, and each layer describes a specific network component:
๐ก Layer 1: Physical
Imagine the physical layer as the foundation of the OSI model. It deals with the actual transmission of bits over a physical medium, such as cables or wireless signals. This layer focuses on the electrical, mechanical, and functional aspects of data transmission, ensuring that the information is transmitted reliably from one point to another.
๐ Layer 2: Data Link
The data link layer comes into play when data needs to be transmitted over a local network. Its primary responsibility is to establish a reliable link between two adjacent nodes, ensuring error-free communication. Here, data is divided into frames, and mechanisms like error detection and correction are implemented to maintain data integrity.
๐ Layer 3: Network
At the network layer, the focus shifts to routing and addressing. This layer facilitates the transmission of data packets across multiple networks, utilizing logical addresses (such as IP addresses) to identify source and destination devices. It determines the best path for data transmission, making sure packets arrive at their intended destination.
๐ Layer 4: Transport
The transport layer ensures the reliable delivery of data between two hosts. It takes data from the session layer, breaks it into smaller chunks (segments), and adds sequence numbers to them. This way, if any segment gets lost during transmission, it can be retransmitted. It also manages flow control to prevent overwhelming the receiving device.
๐ค Layer 5: Session
Think of the session layer as the coordinator of communication sessions between applications. It establishes, manages, and terminates connections, allowing data exchange between applications on different devices. This layer handles session establishment, synchronization, and checkpointing to ensure the orderly flow of data.
๐ฅ๏ธ Layer 6: Presentation
The presentation layer takes care of data formatting and encryption. It transforms the data received from the application layer into a format that the network can understand. This layer also handles data compression, encryption, and decryption, ensuring secure and efficient transmission of information.
๐ฑ Layer 7: Application
Finally, we reach the application layer, which directly interacts with users and application programs. It provides services that enable users to access network resources and perform specific tasks. This layer encompasses protocols like HTTP, FTP, SMTP, and more, allowing users to send requests and receive responses.
โก๏ธ Example
Let's imagine you're using a web application to submit a form containing JSON data to a server. As a user, you enter the required information and click the submit button. Here's how the OSI layers come into play:
The application layer prepares the JSON data, encapsulating it within an HTTP POST request.
The presentation layer encrypts and formats the data into a suitable representation for transmission.
The session layer establishes a session with the server, ensuring the connection is ready for data exchange.
The transport layer breaks the data into smaller segments, adds sequence numbers, and manages their reliable delivery.
The network layer adds the necessary routing information (source and destination IP addresses) to the segments.
The data link layer encapsulates the segments into frames and performs error detection and correction.
The physical layer transmits the frames over the physical medium, such as Ethernet cables or wireless signals, to the server.
๐ Summary
We explored the seven layers of the OSI model, gaining some understanding of the unique responsibilities of each layer. We also went through a practical example of POST JSON request to understand how the request goes from each layer of OSI Modal.
If you found this article helpful, please give it a like and share it with your friends and colleagues!