OSI Model and protocols

OSI Model and protocols

Understanding OSI Model and protocols used in it

OSI (Open System Interconnection) is a conceptual framework that determine how the data will flow over the internet. This model divides the network communication into 7 different layers. Sending the data over the internet is not that simple as it sounds, it needs to go through various hardwares and software across the geographical location.

OSI model can be seen as universal language for computer networking. So that various networking devices can communicate with each other using standard protocols or rules of communication. OSI model is split in 7 layer stacked on top each other. Each layer has it's specific task, and it communicate with layer above and below of it. This provides a abstraction for higher layer to work independently without having to worry about the implementation details of lower layers.

Importance of OSI model

In modern internet we don't use OSI model very munch, but still the understanding of OSI model is very much important to understand the network communications. OSI model is also very useful for troubleshooting the network problem or issue. Whether it is one person who not able to connect to internet or the website being down for thousands of users, OSI model can help to break down the problem, if we are able to find the origin layer of the problem a lots of unnecessary work can be avoided.

7 layers of OSI model

Application Layer

Application Layer is only that interacts with data from the user. Software applications like browser or mail client relay on application layer to initiate communication, but note that this software applications are not part of the application layer. Application layer is responsible for the protocols and data manipulation. Application layer includes protocols like HTTP/HTTPS as well as SMTP (Simple Mail Transfer Protocol used by mail client).

Presentation Layer

Presentation Layer is responsible for making data presentable for application layer to consume. This layer is responsible for translation, encryption/decryption, compression of data. This layer also concern about the syntax of the data itself that application layer consumes or sends for example, HTML, JSON or CSV are modelling languages that determine the structure of data at presentation layer

Session Layer

Session Layer is responsible for opening and closing the session between two devices. This layer ensures that the session is kept open till all the data transfer is completed and the promptly closes it to avoid unnecessary resource usage. This also maintains a checkpoints, to resume the data transfer incase connection is lost in-between rather than having to transfer all the data from scratch. This layer uses protocols like NFS (Network File System) or SMB (Server Messaging Block)

Transport Layer

Transport Layer is responsible for end-to-end communication between two devices. Transport layer takes the data from Session Layer and splits them into smaller chucks know as segment and then sends it to the Network Layer. Transport Layer on receivers end is responsible for reassembling the segments into the data before transferring it to the Session Layer.

Transport Layer is also responsible for flow control and error control. Flow control ensures the optimal speed for transmission such that sender’s fast connection doesn't overwhelms the receiver's slow connection. It performs the error control by ensuring the data received is completed and requesting re transmission if it isn't. It uses a protocols like TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).

Network Layer

Network Layer is responsible for transfer data on two different networks. If two devices communicating are on same network this layer is not required. The network layer breaks the segments into smaller parts called packets on sender's device and reassembles them on receivers device. Network Layer is also responsible for finding the best physical path to transfer the data through routing across the network of devices. This layer may also manages flow control. It mainly uses Internet Protocol v4 (IPv4) or IPv6 as a main network layer protocols.

Data Link Layer is similar to the Network Layer except it provides us capability to transfer data from one physical device to another which are on same network. This layer takes a data packets from Network layer and breaks them into smaller parts called as frames. This layer also has flow control and error control in intra-network communication.

Physical Layer

Physical Layer is referred to the physical communication medium and the technologies used to communicate through the physical medium. The data communication happens through the various physical communication channels such as fiber optic cable, copper cable or even air. This layer also includes the technologies related to the channel such as bluetooth, WiFi or NFC, etc. This is the layer where data gets converted into the bit stream of 0s and 1s.

How data flows in OSI model?

The layers is OSI model are designed such that an application on one device can communicate to another application on another device no matter what is the complexity of the application or underlying systems. To achieve this various protocols are followed by the each layer of OSI model. Each layer is independent can only communicate with layer above and below of it only through the provided interface.

By chaining this layers and protocols we can transfer the data from any high level application to another, This follows the below process

  • Sender's application layer can pass the data down to the below layer.

  • Each layer adds its own headers and process the data as it passes on.

  • Data moves down to the all the layers until it is eventually transmitted through the physical communication medium.

  • At the other receivers end of the medium data move up through each layer by processing it using the relevant headers.

  • At last the application layer at receiver's end receives the unpacked data which will visible to the receiver.

Understanding data flow through email example

As we know in order to transfer human readable data through the internet it need to go down through the all the seven layers of OSI model on sender's end and then travel up at the receiver's end. Let's understand this with simple example of email.

Suppose you want to send email to your friend, you opened email client such as gmail and composed a mail with your message and hit send. Then gmail will pass this mail over to the Application Layer which will pick the SMTP protocol and pass the data down to the Presentation Layer. The Presentation Layer will compress the data and pass it to the Session Layer, which will initiate the communication session.

Then data will hit the Transport Layer which will broke the data into segments. This segments will further broken down into packets at Network Layer and further into frames at Data Link Layer. Data Link Layer will pass this frames to the physical layer which will convert them into the bitstream of 0s and 1s. Which them will be transmitted over the physical medium such as cable.

Once you friends computer receives this bitstream through the physical medium such as WiFi. The data will again flow through the same layers but in the reverse order. First, Physical Layer will convert this bit stream back into data frames as pass it to the Data Link Layer. Data Link Layer will assemble this frames into packets and this packets are further assembled into segments at Network Layer, which will be assembled into data at Transport Layer.

Transport Layer passes this data to receivers Session Layer, which will pass the data to Presentation Layer and ends the session. Presentation Layer will remove compression or encryption on the data and pass this raw data to the Application Layer. Application Layer will feed this human readable data to mail client of your friend such as Gmail or Outlook. Gmail will show him your message which he can read on his computer screen.

Summary

The OSI (Open System Interconnection) model is a conceptual framework that outlines how data flows over the internet, divided into seven layers, each with a specific task. While not widely used in modern internet technology, understanding the OSI model is crucial for diagnosing network issues and facilitating communication between devices using standard protocols. The article explains the role of each layer, from the Application to the Physical Layer, and provides an example of how data, such as an email, traverses these layers during transmission.