OSI Model: 7 Layers Explained in Computer Network

In this tutorial, you will learn the concepts of the OSI Model which consists of seven layers. You will also learn how the seven layers of the OSI model work in computer networks, as well as their definitions, functions, comparisons, and functionality.

Contents:

  1. What is OSI Model?
  2. Layers of OSI Model
  3. Application Layer, Presentation Layer, and Session Layer
  4. Transport Layer
  5. Network Layer
  6. Data Link Layer
  7. Comparison between Transport, Network, & Data Link Layer
  8. Physical Layer
  9. FAQs on OSI Model

What is OSI Model?

The OSI model consists of seven layers that cover all phases of a computer network. The OSI (Open Systems Interconnection) reference model was developed by ISO (International Standards Organization) which describes functions and services at its seven layers. Here the services described by the OSI model only specify what operations should be performed at the particular layer, but it does not say anything about how it should be implemented to the layers.

  • The OSI Reference Model consists of seven layers and each layer has its own services and responsibilities.
  • The OSI model gives you a basic idea of what’s happening on the network because OSI also describes the interaction of one layer with another layer.
  • The OSI model is not practically applicable but we use it as a reference model.

Layers of OSI Model

The OSI model has seven layers and each layer has its own services and responsibilities. They are as follows:

  1. Application Layer
  2. Presentation Layer
  3. Session Layer
  4. Transport Layer
  5. Network Layer
  6. Data Link Layer
  7. Physical Layer

The main question here is, which is the first layer, the application layer, or the physical layer? Remember that the OSI model uses a top-down (application to physical) approach on the sender side and a bottom-up (physical to application) approach on the receiver side.

advertisement
  • Application Layer: The main functionality of AL is to provide the user interface.
  • Presentation Layer: The presentation layer’s main functionality is to translate the sender’s data into a computer-readable format and send it to the receiver by performing encryption and compression on the data.
  • Session Layer: Basically, it provides services to the presentation layer to manage data exchange and dialog control.
  • Transport Layer: It is responsible for the process-to-process delivery.
  • Network Layer: It is responsible for host-to-host delivery.
  • Data Link Layer: It converts packets received from the network layer into frames and sends them to the physical layer.
  • Physical Layer: It converts the frames received from DLL into bits and sends them to the receiver physical layer through media.

The figure below explains the seven layers of the OSI reference model.

seven layers of the OSI reference model

The above diagram shows that the OSI reference model consists of seven layers. It also states that on the sender side data is transmitted from top to bottom (Application layer to Physical layer) and receiver side data is received from bottom to top (Physical layer to Application layer).

Application Layer, Presentation Layer, and Session Layer

Let us understand the first 3 layers of the OSI model which are the Application Layer, Presentation Layer, and Session Layer.

Application Layer: The application layer provides the user interface with which the user interacts with the network and accesses the services or resources he wants to access.

  • Remote access, email services, shared databases, NVT (Network Virtual Transmission), DNS (Domain Name System) are services of the application layer.
  • SSH, TELNET, HTTP/HTTPS, POP, IMAP, SMTP, FTP, etc. are the protocols used in the application layer.

Presentation Layer: Data translation, data encryption, and data compression are the responsibilities of the presentation layer. It also takes care of the syntax and semantics of the data exchanged between the two devices.

  • Translation: Using translation, the message is translated from human-readable format to computer-readable format. In short, the data is converted into a stream of bits because the computer understands the only binary language.
  • Encryption: Once the data translation is complete, the data will be encrypted to protect it from unauthorized access.
  • Data Compression: After the data encryption is completed, the data compression algorithm will be used to compress the data. Because compressed data is transmitted faster than the original data.

The diagram below explains the services of the Application Layer and Presentation Layer.

services of the Application Layer and Presentation Layer

The above diagram shows that the sender has sent his email to the recipient. When the sender sends his email, first the message will be translated into computer understandable format, then it will be encrypted and also it will be compressed for faster communication. Now, an email will be sent by SMTP protocol and will be received by the receiver using the POP3 protocol.

Session Layer: The session layer provides two main responsibilities which are dialog control and synchronization.

  • Dialog Control: Basically, Dialog Control provides two ways for the system to communicate. They are half-duplex and full-duplex.
    • Half Duplex: When two devices communicate, only one device can send or receive messages at a time.
    • Full Duplex: It means bidirectional communication. Communication devices can send or receive messages at the same time.

  • Synchronization: The session layer adds checkpoints or synchronization points in data.

    • For example, if a device is sending a 4000 pages file, it is good to have checkpoints after every 200 pages. When 200 pages are received on the receiving side, an acknowledgment will be given by the receiver to the sender.
    • Now, let’s say the transmission crashed on page 1267, then instead of sending the entire file from the beginning, the system would check checkpoint 1201 and retransmit from page 1201.

Transport Layer

Different processes are running on different machines, so the transport layer is responsible for the process-to-process delivery of data between communication devices. Transport Layer provides responsibilities as follow:

  1. Service point addressing
  2. Segmentation and Reassembling
  3. Connection control
  4. Flow control and Error control
  • Service point addressing: The transport layer header includes the service-point address (port address) that identifies the system’s processes.

    For example, two devices are communicating over a network. Now, Host-1 sends data to Host-2. But Host-2 often runs multiple processes at the same time, so Host-2 will use the port address to identify the process that will access the data sent by Host-1.

  • Segmentation and Reassembling: The message sent by the sender is divided into segments including the sequence number in each segment. When the receiver receives the message, it will reassemble the message using the sequence numbers correctly.
  • Connection control: The transport layer uses two types of connections, the first is TCP and the second is UDP.
    • TCP is used for connection-oriented protocol and hence it guarantees to deliver the message to the receiver. So, one can say that TCP is reliable.
    • UDP is a connectionless protocol and hence it does not give any guarantee of message delivery to the receiver. So, one can say that UDP is unreliable.
    • Sending an email message is an example of TCP, and video streaming is an example of UDP.

  • Flow control and Error control: Flow control (flow of data) and Error control (damage or loss) are performed between processes in the transport layer.

Network Layer

The network layer is responsible for the host-to-host delivery of packets. It converts the segments received from the transport layer into packets. The responsibilities and services of the network layer are as follows:

advertisement
  • Logical addressing: The network layer adds headers to the packet. The NL header contains the logical address (IP address) of the sender and receiver, allowing for host-to-host delivery success.
  • Routing: How your data travels over the network depends on routing. The network layer uses the router so that the layers below the network layer can also use the functionality of the router.
    • Router use two rules which are as follow:

      • The router always works based on the destination address.
      • The router uses the store and forward mechanism to store the packet and forward it to the nearest device.

Data Link Layer

The data link layer is responsible for converting packets received from the network layer into frames. It is also responsible for hop-to-hop delivery. The responsibilities of the data link layer are as follows:

  1. Framing
  2. MAC address
  3. Flow and Error control
  4. Access control
  • Framing: The data link layer converts packets into frames.
  • MAC address: MAC address understands the framing of the data link layer.
  • Flow and Error control: Flow control and Error control are performed between network devices.

    • Flow control: If the received data rate is less than the sent data rate, the data link layer lowers the data rate on the sender side to control the flow of data.
    • Error control: An error control mechanism is used to detect the damaged lost and resend the lost frame.
  • Access control: When more than two devices are connected to the network, the access control mechanism specifies which device will get the link for communication.

The diagram below shows how the delivery takes place at the transport layer, network layer, and data link layer.

Message Delivery in transport layer, network layer, and data link layer

As shown in the above diagram, the data link layer is responsible for the hop-to-hop distribution. Whereas the network layer is responsible for host-to-host delivery and the transport layer is responsible for process-to-process delivery.

Comparison between Transport, Network, & Data Link Layer

The below table describes the comparison between Transport Layer, Network Layer, and Data Link Layer.

Key Transport Layer Network Layer Data Link Layer
Definition The transport layer allows processes to communicate with each other that are running on two different devices. Network Layer allows devices to exchange data with each other on a network. The data link receives packets from the network layer and prepares the frame for the physical layer.
Data Format Segment Packet Frame
Responsibilities
  • Service point addressing
  • Segmentation and Reassemble
  • Connection control
  • Flow control and Error control
  • Logical addressing
  • Routing
  • Framing
  • MAC address
  • Flow and Error control
  • Access control
Functionality Divide the data received from the application layer into segments. Convert segments received from the transport layer into packets. Convert packets received from the network layer into frames.
Delivery Process-to-Process delivery Host-to-Host delivery Hop-to-Hop delivery or NIC-to-NIC delivery
Protocols TCP, UDP IP Ethernet
Network Device used End devices like PC or Mobile Router Switch

Physical Layer

The physical layer is responsible for converting the frames received from the data link layer into a stream of bits because the computer only understands bits. It defines the tasks that network devices have to perform over the network to successfully transmit data through the media. The physical layer is concerned with the following:

  1. Physical representation
  2. Representation of bits
  3. Data rate
  4. Synchronization of bits
  5. Line configuration
  6. Physical topology
  7. Transmission mode
  • Physical representation: It defines the interface and transmission media between the devices.
  • Representation of Bits: The physical layer contains the stream of bits which is a machine-understandable language.
  • Data Rate: The data rate is set for transmitting data over the network so that the flow of the network is controlled and the data is transmitted successfully.
  • Synchronization of bits: The sender and receiver clocks are synchronized so that the data encoded by the sender can be successfully transmitted and decoded correctly by the receiver.
  • Line Configuration: The devices are connected to share the link.
  • Physical topology: The physical topology gives an idea of ​​where your network equipment will be configured and where cables will be installed on the network.
  • Transmission Mode: The transmission mode defines the mode to transmit the data. They are simplex, half-duplex, and full-duplex.
    • Simplex: Only one device can send data and one device can receive it. This is one-way communication.
      Example: Radio and TV broadcasting
    • Half-duplex: Two devices connected over a network can send or receive data, but not simultaneously.
      Example: Walkie-Talkies
    • Full-duplex: Two devices connected over a network can send or receive data at the same time. It is bidirectional communication.
      Example: Telephone

FAQs on OSI Model

1. What is the OSI Model?

The OSI (Open Systems Interconnection) model is a conceptual framework that defines how network communication occurs between devices. It divides network communication into seven layers, each with specific functions. This layered approach allows different systems to communicate seamlessly regardless of the underlying hardware or software.

2. Why is the OSI Model important?

The OSI Model is important because it helps standardize networking protocols to allow diverse communication systems to communicate using standardized protocols. It also helps with troubleshooting and understanding the network architecture.

3. What are the 7 layers of the OSI Model?

The 7 layers of the OSI Model are:

  • Physical Layer: Deals with the physical transmission of data bits over a network medium like cables or wireless signals.
  • Data Link Layer: Focuses on error-free transmission between directly connected devices. It packages data into frames and handles MAC addressing.
  • Network Layer: Responsible for routing data packets across networks. It determines the most efficient path for data to reach its destination.
  • Transport Layer: Provides reliable data transfer between applications on different devices. It breaks data into segments, ensures delivery, and handles flow control.
  • Session Layer: Establishes, manages, and terminates sessions between communicating applications.
  • Presentation Layer: Prepares data for the application layer by handling encryption, decryption, compression, and formatting.
  • Application Layer: Provides network services to user applications like web browsing, email, and file transfer.

4. How do the OSI layers interact with each other?

Each layer in the OSI Model serves the layer above it and is served by the layer below it. Data is passed down from the Application Layer to the Physical Layer on the sender’s side and then passed up from the Physical Layer to the Application Layer on the receiver’s side. Each layer adds its own header information to the data to facilitate proper routing and delivery.

5. Are there any limitations to the OSI Model?

  • Theoretical Model: The OSI model is not a direct implementation but rather a conceptual framework.
  • Complexity: With seven layers, it can be overwhelming for beginners.

6. What are some common protocols associated with each OSI layer?

OSI Layer Protocols/Technologies
Physical Layer Ethernet, USB, Bluetooth
Data Link Layer Ethernet (IEEE 802.3), Wi-Fi (IEEE 802.11), PPP
Network Layer IP (Internet Protocol), ICMP, IGMP
Transport Layer TCP (Transmission Control Protocol), UDP (User Datagram Protocol)
Session Layer NetBIOS, PPTP
Presentation Layer SSL/TLS, JPEG, GIF
Application Layer HTTP, FTP, SMTP, DNS

7. How does the OSI Model differ from the TCP/IP Model?

The OSI Model has seven layers, while the TCP/IP Model has four layers: Application, Transport, Internet, and Network Interface. The TCP/IP Model is more practical and used as the basis for the Internet. The OSI Model is more of a theoretical framework.

8. What is the role of encapsulation in the OSI Model?

Encapsulation wraps data with protocol-specific information at each layer, which helps in data transfer and understanding between different layers.

Key Points to Remember

Here is the list of key points we need to remember about the “OSI Reference Model”.

  • OSI (Open System Interconnection) was developed by ISO which consists of seven layers that cover all aspects of a computer network.
  • The OSI model consists of the following seven layers:
    1. Application Layer
    2. Presentation Layer
    3. Session Layer
    4. Transport Layer
    5. Network Layer
    6. Data Link Layer
    7. Physical Layer
  • The application layer provides services and user interface to the user.
  • The presentation layer is responsible for Translation, Encryption, and Data compression.
  • The session layer manages data exchange and dialog control. It also providessynchronization of data.
  • The transport layer is responsible for process-to-process delivery and divides the data into smaller segments. It consists of two protocols to transfer data which are TCP and UDP.
  • The network layer is responsible for host-to-host delivery and converts segments into packets received from the transport layer. It uses the IP address to store and forward the packets using the router.
  • The data link layer is responsible for hop-to-hop delivery. It converts packets received from the network layer into frames.
  • The physical layer is responsible for converting the frame into a stream of bits.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.