TranslateProject/sources/tech/20210511 What is the OSI model.md
DarkSun eeb65f6be9 选题[tech]: 20210511 What is the OSI model?
sources/tech/20210511 What is the OSI model.md
2021-05-12 05:10:07 +08:00

5.6 KiB
Raw Blame History

What is the OSI model?

Today I tweeted something about how the OSI model doesnt correspond well to the reality of how TCP/IP works and it made me think what is the OSI model, exactly? From reading some of the replies on Twitter, it seems like there are at least 3 different ways to think about it:

  1. A literal description of how TCP/IP works
  2. An abstract model that you can use to describe and compare a lot of different networking protocols
  3. A literal description of some computer networking protocols from the 1980s that are mostly no longer used today

In this post Im not going to try to argue that any one of these is “really” what the OSI model is it seems like different people think about the OSI model in all of these ways, and thats okay.

the OSI model has 7 layers

Before we talk about what the OSI model means, lets very briefly discuss what it is: its an abstract model for how networking works with 7 numbered layers:

  • Layer 1: physical layer
  • Layer 2: data link
  • Layer 3: network
  • Layer 4: transport
  • Layer 5: session
  • Layer 6: presentation
  • Layer 7: application

I wont say more about what each of those is supposed to mean, there are a thousand explanations of it online.

the OSI model as a literal description of how TCP/IP works

First, I want to talk about one common way people use the OSI model in practice: as a literal description of how TCP/IP works. Some layers of the OSI model are really easy to map to TCP/IP:

  • Layer 2 corresponds to Ethernet
  • Layer 3 corresponds to IP
  • Layer 4 corresponds to TCP or UDP (or ICMP etc)
  • Layer 7 corresponds to whatever is inside the TCP or UDP packet (for example a DNS query)

This mapping makes a lot of sense for layers 2, 3, and 4 TCP packets have 3 headers corresponding to these 3 layers (the Ethernet header, the IP header, and the TCP header).

Having numbers to describe the different headers in a TCP packet is pretty useful if you say “layer 2”, its clear that that lives “underneath” layer 3, because 2 is a smaller number than 3.

The weird thing about “OSI model as literal description” is that layers 5 and 6 dont really correspond to anything in TCP/IP Ive heard a lot of different interpretations of what layers 5 or 6 could be (you could say layer 5 is TLS or something!) but they dont have a clear correspondence like “every layer has a corresponding header in the TCP packet” the way layers 2, 3, and 4 do.

Also, some parts of TCP/IP dont fit well into the OSI model even around layers 2-4 for example, what layer is an ARP packet? ARP packets send some data with an Ethernet header, so does that mean theyre layer 3? Layer 2? The Wikipedia article listing different OSI layers categorizes it under “layer 2.5” which is pretty unsatisfying.

This is only really a problem because the OSI model is sometimes used to teach TCP/IP, and its confusing if its not made clear which parts of the model map well to TCP/IP and which dont.

the OSI model as an abstraction for comparing networking protocols

Another way of thinking of OSI that Ive heard is that its an abstraction you can use to draw analogies between lots of different networking protocols. For example, if you want to understand how Bluetooth works, maybe you can use the OSI model to help you heres an diagram I found on this page showing how Bluetooth fits into the OSI model.

As another example of this, this Wikipedia article has a list of OSI layers and which specific networking protocols correspond to those OSI layers.

the OSI model as a literal description of some obsolete protocols

Some very brief research on Wikipedia says that in addition to an abstract description of 7 layers, the OSI model also contained a bunch of specific protocols implementing those layers. Apparently this happened during the Protocol Wars in the 70s and 80s, where the OSI model lost and TCP/IP won.

This explains why the OSI model doesnt really correspond that well to TCP/IP, since if the OSI protocols had “won” then the OSI model would correspond exactly to how internet networking actually works.

thats all!

Im writing this because when I originally learned about the OSI model I found it super confusing (what are all these layers? are they real? is this actually how networking works? whats happening?) and I wish someone had told me that (as someone who does not work with any networking protocols other than TCP/IP) I could just learn how layers 2, 3, 4, and 7 relate to TCP/IP and then ignore everything else about it. So hopefully this will help clear things up for somebody!


via: https://jvns.ca/blog/2021/05/11/what-s-the-osi-model-/

作者:Julia Evans 选题:lujun9972 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出