DEV Community

Cover image for What is the OSI Model? 7 layers explained in detail
Amanda Fawcett for Educative

Posted on • Originally published at educative.io

What is the OSI Model? 7 layers explained in detail

Networking is a vast topic. The OSI model helps us better understand it. In this article, we will cover the OSI model. The Open Systems Interconnection (OSI) model is a conceptual framework that describes the functions of a networking or telecommunication system in seven layers.

The OSI model describes how a network functions and standardizes the way that systems send information to one another. In this article, we will introduce you to the OSI model and discuss each layer in detail.


What is the OSI Model?

Developed in 1984, the Open Systems Interconnection or OSI model is a seven-layer model used to describe networking connections. It was initially developed by ISO, the International Organization for Standardization in 1984 and is now common practice for learning networking concepts.

The OSI models specifies how information is transmitted from a network device like a router to its destination through a physical medium and how it interacts with the application. In other words, it provides a standard for different systems to communicate with each other.

Alt Text

We will go through the different layers in detail below, but keep in mind that the upper layers (first 4) are about transport issues like the physical characteristics of the network and data transmission.

The lower layers (last 3) are about application issues like data formatting and user interfacing.

Why should you learn this?

Some people argue that the OSI model is obsolete because it is less important than the four layers of the TCP/IP model, but this is not true. The OSI model is essential theory for understanding modern computer network technology in a connection-oriented way.

Most discussions on network communication include references to the OSI model and its conceptual framework.

The purpose of this model is to enhance interoperability and functionality between different vendors and connectors. It describes the functions of a networking system. From a design point of view, it divides larger tasks into smaller, more manageable ones.

The OSI model allows network administrators to focus on the design of particular layers. It is also useful when troubleshooting network problems by breaking them down and isolating the source.

Layer 1: Physical Layer

At the lowest layer of the OSI reference model, the physical layer is responsible for transmitting unstructured data bits across the network between the physical layers of the sending and receiving devices. In other words, it takes care of the transmission of raw bit streams.

The physical layer may include physical resources like cables, modems, network adapters, and hubs, etc.

Layer 2: Data Link Layer

The data link layer corrects any errors that may have occurred at the physical layer. It ensures that any data transfer is error-free between nodes over the physical layer. It is responsible for reliable transmission of data frames between connected nodes.

The data is packaged into frames here and transferred node-to-node. The data layer has the following sub-layers

  • Media Access Control (MAC): The MAC address layer is responsible for flow control and multiplexing devices transmissions over the network.
  • Logical link control (LLC): The LLC layer provides error control and flow control over the physical medium and identifies line protocols.

Layer 3: Network Layer

The network layer receives frames from the data link layer and delivers them to the intended destination based on the addresses inside the frame. It also handles packet routing. The network layer locates destinations using logical addresses like the IP. Routers are a crucial component at this layer as they route information to where it needs to go between different networks.

The main functions of the Network layer are:

  • Routing: The network layer protocols determine which routes from source to destination.
  • Logical Addressing: The network layer defines an addressing scheme to uniquely identify devices. The network layer places the IP addresses from the sender and receiver in the header.

Layer 4: Transport Layer

The transport layer is responsible for delivering, error checking, flow control, and sequencing data packets. It regulates the sequencing, size, and transfer of data between systems and hosts. It gets the data from the session layer and breaks it into transportable segments.

Two examples of the Transport Layer are the UDP (User Datagram Protocol) and TCP (Transmission Control Protocol) that is build on top of the Internet Protocol (IP model), which work at layer 3.

Layer 5: Session Layer

The session layer will create communication channels, called sessions, between different devices. This layer is responsible for opening those sessions and ensuring that they're functional during data transfer.

In other words, the session layer is responsible for establishing, managing, and terminating communication sessions with the lower layers with the presentation and application layer. It is also responsible for authentication and reconnections, and it can set checkpoints during a data transfer—if.

Layer 6: Presentation Layer

The presentation layer is responsible for ensuring that the data is understandable for the end system or useful for later stages. It translates or formats data based on the application's syntax or semantics. It also manages any encryption or decryption required by the application layer. It is also called the syntax layer.

Layer 7: Application Layer

The application layer is where the user directly interacts with a software application, so it is closest to the end user. When the user wants to transmit files or pictures, this layer interacts with the application communicating with the network. The application layer identifies resources, communication partners, and synchronizes communication.

Other functions of the application layer are the Network Virtual Terminal and FTAM-File transfer access, and mail/directory services. The protocol used depends on the information the user wants to send. Some common protocols include:

  • POP3 or SMTP for emails
  • FTP for emails
  • Telnet for controlling remote devices

Examples of communications that use Layer 7 are web browsers (Chrome, Firefox, Safari).

Data flow example

Here is how data flows through the OSI model. Let's say you send an email to a friend. Your email passes through the application layer to the presentation layer. This layer will compress your data.

Next, the session layer initializes communication. It will then be segmented in the transportation layer, broken up into packets in the network layer, and then into frames at the data link layer. It will then be sent to the physical layer where it is converted to 0s and 1s and sent through a physical medium like cables.

When your friend gets the email through the physical medium, the data flows through the same layers but in the opposite order. The physical layer will convert the 0s and 1s to frames that will be passed to the data link layer. This will reassemble the frames into packets for the next layer.

The network layer will assemble the segments into data. The data is then passed on to the presentation layer that ends the communication session. The presentation layer will then pass the data to the application layer. The application layer feeds the human-readable data to the email software that will allow your friend to read your email.

What to learn next

Congratulations on making it to the end. I hope you now know what the OSI model is, how the OSI layers work, and why you need to know about it. These concepts are essential for understanding how networks function.

This was just the beginning, and there is a lot you can learn. You can start with:

  • Access networks
  • Protocols
  • Socket programming
  • and more

To get hands on with these concepts, check out Educative's course Grokking Computer Networking for Software Engineers. You will learn about networks, command-line tools, socket programming in Python, all in a hands-on environment. Any software engineer can benefit from a solid grasp on these concepts.

Happy learning!

Continue reading about networking

Top comments (3)

Collapse
 
ssimontis profile image
Scott Simontis

Thanks for a great writeup. I consider myself a lot more network-knowledgeable than many developers I have worked with, but I really only ever end up dealing with Layer 4 or Layer 7 issues. Does anyone else have a different experience?

Collapse
 
thorstenhirsch profile image
Thorsten Hirsch

Layer 8 issues are the worst. ;-)

Collapse
 
joaorbrandao profile image
João Brandão

“All People Seem To Need Data Processing” is a good way to remember it! 🙂