An article to understand what is the OSI model?

2022.07.16
An article to understand what is the OSI model?

In this post, I'm not going to try to argue which of the above is the "true" OSI model - it seems that different people think about it in all these ways.

Today I tweeted some points about how the OSI model doesn't match up with the actual representation of how TCP/IP works, which got me thinking - what the heck is the OSI model? Reading through some of the replies on Twitter, there seem to be at least three different ways of thinking:

  • A literal description of how TCP/IP works
  • An abstract model that can be used to describe and compare many different network protocols
  • A literal description of some computer networking protocols of the 1980s, most of which are no longer in use today

In this post, I'm not going to try to argue which of the above is the "true" OSI model - it seems that different people think about it in all these ways. It does not matter.

The OSI model has seven layers

Before we discuss what the OSI model means, let's briefly discuss what it is. It is an abstract model that describes how the network works on seven numbered layers:

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

I won't waste time explaining the meaning of each layer, there are thousands of explanations available online.

The OSI Model: A Literal Description of How TCP/IP Works

First, I want to talk about a common way people use the OSI model in practice: as a literal description of how TCP/IP works. Certain layers of the OSI model map very easily to TCP/IP:

  • Layer 2 corresponds to Ethernet
  • Layer 3 corresponds to IP
  • The fourth layer corresponds to TCP or UDP (or ICMP, etc.)
  • Layer 7 corresponds to anything inside a TCP or UDP packet (eg DNS queries)

This mapping makes sense for layers 2, 3, and 4 - a TCP packet has three headers corresponding to these three layers (Ethernet header, IP header, and TCP header).

Numerically describing the different headers in a TCP packet is very useful - if you say "layer two" it's clearly "below" layer three because two is less than three.

The weird thing about the "OSI model as a literal description" is that layers 5 and 6 don't really correspond to anything in TCP/IP - I've heard a lot about what layer 5 or 6 might be (you could say layer 5 is TLS or something!) but they don't have a clear correspondence like "each layer has a corresponding header in a TCP packet" like layers 2, 3, and 4 .

Also, some parts of TCP/IP don't fit well into the OSI model even at layers 2 to 4 - eg, which layer is an ARP packet? ARP packets send some data with ethernet headers, does that mean they are layer 3? Or the second floor? The Wikipedia article listing the different OSI layers classifies it as "Layer 2.5", which is unsatisfactory.

Because the OSI model is sometimes used to teach TCP/IP, it can be confusing to know which parts of it map to TCP/IP and which parts don't. That's the real problem.

OSI Model: An Abstraction for Comparing Network Protocols

Another way of thinking about OSI that I've heard is that it's an abstraction that can be used to draw analogies between many different network protocols. For example, if you want to understand how the bluetooth protocol works, maybe you can use the OSI model to help you - here is a diagram I found on this page that shows how the bluetooth protocol fits into the OSI model.

The OSI model: a literal description of some obsolete protocols

Some very brief research on Wikipedia shows that, in addition to an abstract description of these seven layers, the OSI model contains a set of specific protocols that implement these layers​. Obviously, this happened during the protocol wars of the 70's and 80's, where the OSI model failed and TCP/IP triumphed.

This explains why the OSI model doesn't correspond well with TCP/IP, because if it was the OSI protocol that "won" at the time, the OSI model would correspond exactly to how Internet networks actually work.

Epilogue

The reason I wrote this post was that when I first learned about the OSI model, I found it very confusing (what are all these layers? Are they real? Is this how the network actually works? What's going on? ?) I wish someone told me that this guy who only uses the TCP/IP network protocol just needs to understand how layers 2, 3, 4 and 7 of the OSI model relate to TCP/IP and ignore everything else about it. So I hope this article helps someone!