• Articles
  • Tutorials
  • Interview Questions

OSI Model - 7 Layers Explained

Check out this beginner-friendly OSI Model by Intellipaat:

What is the OSI model?

OSI model, or open systems interconnection model, is a conceptual model that was adopted by the International Organization for Standardization (ISO) as an international standard, back in 1984, when network computing was still in its initial phase.

The OSI model gives standard protocols for diverse communication systems to communicate. In simpler words, the OSI model provides some basic rules to enable communication among different computer systems. The OSI model can be thought of as the universal language for computer networking and supporting interoperability between different software and products.

Also known as the 7-layer model, the OSI model splits the communication between computing systems into seven different layers. This helps in isolating and troubleshooting networking problems.

The seven layers of the OSI model, in order from the lowest to the topmost, are the physical layer, data link layer, network layer, transport layer, session layer, presentation layer, and application layer. Let us learn about these layers of the OSI model and their functions in detail.

Physical layer

The physical layer in OSI Model is the lowest layer. It includes physical equipment, such as switches and cables, that is required in the process of data transfer. The physical layer transfers unstructured, raw data bits, between the physical layers of the sending and the receiving device, either optically or electrically.

The physical layer can also include some specifications such as pin layout, radio frequencies, voltages, cabling, etc., and some physical resources such as repeaters, modems, cabling, network hubs, and network adapters.

In this layer of the OSI Model, information is present as bits. Individual bits of data are transmitted from one node to the next. Data gets converted into strings of 1s and 0s, also known as a bitstream. For this to happen, both devices need to agree on signal convention, so that both devices can distinguish between 1s and 0s.

Transmission of bitstream in Physical Layer in OSI Model

Some major functions of the physical layer are:

  • Physical topologies: The physical layer tells us about the arrangement of different nodes or devices in a network.
  • Bitrate control: The physical layer defines the number of bits that are sent in a second or the rate of transmission.
  • Transmission mode: It defines how the data flows between two devices. Simple, full-duplex, and half-duplex are some different transmission modes that are possible.
  • Bit synchronization: The physical layer in the OSI model synchronizes the bits by providing a clock, which controls the sender and the receiver, providing us with synchronization at the bit level.

The next layer in the stack is the data link layer.

EPGC in Cyber Security and Ethical Hacking

The main responsibility of the data link layer is the node-to-node delivery of a message. This is done by using nodes that are directly connected to each other. In the data link layer, data is packaged into frames. This layer is also responsible for finding and correcting any errors that may have occurred in the physical layer.

The data link layer is further divided into two sublayers. They are:

  • Logical link control: Logical link control (LLC) provides us with error control and flow control over the physical medium. It also identifies line protocols.
  • Media access control: Media access control (MAC) provides multiplexing for the transmission of devices over a network. It also provides flow control.

The data link layer is basically responsible for intra-network communication, which is the transmission of data between two devices on the same network. This layer also puts the sender’s and receiver’s MAC addresses in the header. In the OSI Model, HDLC is a protocol used in the data link layer. It is used to encapsulate packets from the Network Layer and to provide reliable data transfer between two devices.

Here are some important functions of the data link layer in the OSI model:

  • Framing: Framing lets the sender transmit a set of bits that are meaningful to the receiver. This is done by attaching special bit patterns to the frame’s beginning and end.
Framing in Data Link Layer in OSI Model
  • Physical addressing: The data link layer encapsulates the MAC or physical address of the sender in the header of each frame. The physical address of the receiver is also added in the header.
  • Access control: There can be instances when multiple devices are sharing a common communication channel. In such a case, the MAC sub-layer of the data link layer helps you determine which device will have control over the channel at any point in time.
  • Flow control: Flow control is important to coordinate the amount of data that the sender can send, before receiving any acknowledgment from the receiver’s end. This ensures that the data rate is constant on both sides and is not corrupted in the process of data transmission.
  • Error control: Data link layer also detects and retransmits the bits that were damaged or lost during transmission.

Data packets in this layer are broken into smaller pieces and are known as frames. Two common data link layer devices are bridge and switch.

Check out this Cyber Security Tutorial for Beginners by Intellipaat

After the data link layer, the next layer is the network layer.

Network Layer

The network layer facilitates the transfer of data between two separate networks. This is what makes it different from the data link layer. In case the two communicating devices are on the same network, then the network layer becomes unnecessary.

The physical layer, data link layer, and network layer are together known as the hardware layers or lower layers.

Let us discuss some of the functions of the network layer.

The network layer breaks down data segments into smaller units, which are called packets. These packets are formed on the sender’s device and later reassembled at the receiver’s end.

Creation and Reassembly of Packets in Network Layer in the OSI Model

To give a unique identification to all devices on the internetwork, the network layer defines an addressing scheme. This is called logical addressing. By doing this, all devices can be distinguished uniquely and universally.

This layer also receives frames from the data link layer and then delivers them to the intended destination. The destination is found by using logical addresses such as internet protocol (IP) addresses.

One of the biggest responsibilities of the network layer is packet routing; it means examining the routes available for the data to reach their destination and then selecting the best, shortest route from among those. This makes routers a very important device of this layer.

Enroll in our Cyber Security course to learn cyber security from experts and to get certified.

Get 100% Hike!

Master Most in Demand Skills Now !

Let us discuss the next layer in the stack, the transport layer.

Transport layer

The transport layer has the job of managing the error checking and delivery of data packets. It keeps track of the sequence, size, and transfer of data between systems.

The transmission control protocol (TCP) is an example of the transport layer.

This layer also takes care of end-to-end communication between devices. To do this, data has to be taken and broken into segments, which are chunks of data. The receiving device’s transport layer, then, extracts data from these segments.

Another job of the transport layer is flow control. Sometimes, the sender might have a fast connection, but the receiver might not. In such a case, the receiver might get overwhelmed. Flow control helps to determine an optimal speed to make sure that the data received is complete, provides acknowledgment if it is, and requests for retransmission if it is not and an error is found.

Read this blog on Top 20 Hacking Tools and Software in 2023 by Intellipaat.

The services provided by the transport layer in the OSI Model are of two types:

  • Connection-less services: This process is done in only one phase, which is data transfer. In connection-less services, the receiver does not have to send an acknowledgment after receiving a packet. This makes connection-less service a fast approach for two devices to communicate.
  • Connection-oriented services: This process is done over three phases. These are:
    • Connection establishment
    • Data transfer
    • Disconnection or termination

Here, the receiver sends an acknowledgment to the sender or source device, on receiving packets. This makes connection-oriented services more secure and reliable than connection-less services.

The important functions of the transport layer are:

  • Service point addressing: To deliver a message to the correct destination, this layer encapsulates a specific type of address, known as the port address or service point address, in the header. By doing this, the transport layer ensures that the message is delivered to the correct destination.
  • Segmentation and reassembly: The transport layer breaks messages into segments. Each of these segments has headers associated with them. The transport layer, then, reassembles the message at the receiver’s end.

Because of the important responsibilities that it has, the transport layer is also known as the heart of the OSI model. It is operated by the operating system (OS) itself.

Transport Layer: Heart of the OSI Model

The next layers that we will discuss are the software layers of the OSI Model, the first one being the session layer.

Session layer

The main job of the session layer is to control conversations between machines. It takes care of setting up, managing, and terminating sessions between different computers. A session is a time between the opening and closing of communication. 

To avoid wasting any resources, the session layer in the OSI model makes sure that the session stays open for as long as the data is being transmitted and closes as soon as the transmission is over. Reconnections and authentication are also among the services performed by this fifth layer of the OSI Model.

Here are the functions of the session layer:

  • Dialog control: The session layer lets two computers communicate with each other in simplex, full-duplex, or half-duplex modes.
  • Establishing a session, maintaining, and terminating it.
  • Synchronization: The session layer makes use of checkpoints to synchronize the transmission of data. This helps in error identification so that data can be properly re-synchronized.

Let us understand this with an example.

If a file of 50 megabytes is being transferred, the session layer could choose to set checkpoints at every five megabytes.

Now, if 23 bytes of data have been transferred and a crash or disconnection occurs, the session can be resumed from the previous checkpoint, i.e., 20 bytes. This means that only 30 more megabytes, and not the total 50 megabytes, will have to be transmitted.

If we did not have checkpoints, the complete transfer would have to be done again from the very beginning.

Data loss is avoided by not cutting the ends of a message prematurely.

The next layer is the presentation layer.

Presentation layer

The presentation layer’s main function is translating or formatting data according to the syntax accepted by the application. For this reason, this layer is often also referred to as the syntax layer. It can also do encryption and decryption needed by the application layer, which is the seventh layer of the OSI model.

Simply put, the primary responsibility of this layer is to make the data presentable for the applications that need it.

The functions of the presentation layer are:

Encryption and decryption

The process of translating data into a coded form is known as encryption. To encrypt the data, a key value is used. Data in encrypted form is known as Ciphertext.

The same key value can be used to convert data into plain text. This process is known as decryption.

The presentation layer encrypts data on the sender’s end, and then decodes or decrypts the same at the receiver’s end to make it readable.

Compression

This layer also compresses the data that it receives. This is helpful in improving the efficiency and speed of communication by reducing the amount of data that has to be transmitted.

Translation

Sometimes, the two devices that are communicating with each other, might use different methods of encryption. So, the presentation layer in the OSI model translates incoming data into semantics that the receiving device can understand.

This layer handles the interoperability between the various methods of encoding data by converting the sender-dependent format into the common format and the common format into the receiver-dependent format.

For this reason, the presentation layer is also referred to as the translation layer.

Encryption, Compression, and Translation in Presentation Layer of OSI Model

The final and the topmost layer in the stack is the application layer.

Want to learn more about Ethical Hacking? Enroll in our Best Course for Ethical Hacking!

Application layer

The application layer in the OSI Model is at the very top of the stack. This layer is the only one that interacts with data from the user directly. It is also implemented by the network applications directly.

Most software applications, such as email clients and web browsers, rely on this layer for initiating communication. To clear a confusion that normally arises, client software applications are not a part of this layer. Instead, this layer takes care of data manipulation that this software relies on to give relevant data to the user.

To crack your Interviews, go through these Top 50 Cyber Security Interview Questions and Answers by Intellipaat.

The protocols of the application layer include Simple Mail Transfer Protocol (SMTP,) which is a protocol that enables email communications and  Hypertext Transfer Protocol (HTTP,) which lets the end-users interact with web resources by the transmission of messages between servers and clients.

The application layer is also referred to as the desktop layer.

The session layer, presentation layer, and application layer are all integrated into the TCP/IP model as a single layer, as the application layer. These layers are called the upper layers of software layers.

The following are the functions of the application layer:

  • Mail services such as storing and forwarding emails
  • Directory services such as distributing database sources
  • File Transfer Access and Management (FTAM)

Now that we have learned, in detail, about the layers of the OSI model, let us talk about why it was developed.

Why was the OSI model developed?

The OSI model was developed later than the modern internet. This is why the internet does not follow the OSI Model, but it is still very useful in troubleshooting network problems.

No matter the extent of the issue, be it thousands of people unable to use a website that is down or a single person is unable to connect to the internet, the OSI model helps isolate the source by breaking down the problem.

The OSI model was developed because by narrowing down a problem to a particular layer, a lot of unnecessary work can be avoided.

Advantages of the OSI model

Here is how the OSI model is useful for operators and users

  • It troubleshoots by identifying which particular layer is causing a problem and directs all efforts toward that layer.
  • It determines the software and hardware that is required in order to build the network.
  • It communicates and understands the processes that are followed by communicating devices on a network.

Difference between OSI and TCP/IP models

Let us first compare the structure of the OSI and TCP/IP models.

Structure of OSI Model and TCP/IP Model

Now, let us understand the differences between the two models.

TCP/IP ModelOSI Model
It is the older of the two network models.It is a comparatively newer model.
It was developed by the US Department of Defense (DoD.)It was developed by the International Organization of Standardization (ISO.)
It has four layers.It has seven layers.
It is simpler; it combines several layers into one.It is relatively complex.
Session, presentation, and application layers of the OSI model are all combined as the application layer.There are separate session, presentation, and application layers.
Physical and data link layers of the OSI model are combined as the network access layer.There are separate physical and data link layers.
It is a functional model.It is a conceptual framework.
Protocols were developed first, and the model was developed later.The model was developed first, and the protocols were developed later.
It is based on specific, standard protocols.It is generic and independent of protocols.
Most applications use all four layers of the model.Simpler applications do not need to use all seven layers of the model.

If you have any more questions, post them in our Community!

Course Schedule

Name Date Details
Cyber Security Course 27 Apr 2024(Sat-Sun) Weekend Batch
View Details
Cyber Security Course 04 May 2024(Sat-Sun) Weekend Batch
View Details
Cyber Security Course 11 May 2024(Sat-Sun) Weekend Batch
View Details