mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge pull request #26280 from hanszhao80/master
[提交译文][tech]20210511 What is the OSI model
This commit is contained in:
commit
1e90e5ac6a
@ -1,95 +0,0 @@
|
|||||||
[#]: subject: (What is the OSI model?)
|
|
||||||
[#]: via: (https://jvns.ca/blog/2021/05/11/what-s-the-osi-model-/)
|
|
||||||
[#]: author: (Julia Evans https://jvns.ca/)
|
|
||||||
[#]: collector: (lujun9972)
|
|
||||||
[#]: translator: (hanszhao80)
|
|
||||||
[#]: reviewer: ( )
|
|
||||||
[#]: publisher: ( )
|
|
||||||
[#]: url: ( )
|
|
||||||
|
|
||||||
What is the OSI model?
|
|
||||||
======
|
|
||||||
|
|
||||||
Today I tweeted something about how the OSI model doesn’t 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 I’m 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 that’s okay.
|
|
||||||
|
|
||||||
### the OSI model has 7 layers
|
|
||||||
|
|
||||||
Before we talk about what the OSI model means, let’s very briefly discuss what it is: it’s 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 won’t 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”, it’s 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 don’t really correspond to anything in TCP/IP – I’ve 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 don’t 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 don’t 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 they’re 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 it’s confusing if it’s not made clear which parts of the model map well to TCP/IP and which don’t.
|
|
||||||
|
|
||||||
### the OSI model as an abstraction for comparing networking protocols
|
|
||||||
|
|
||||||
Another way of thinking of OSI that I’ve heard is that it’s 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 – here’s an diagram I found on [this page][1] showing how Bluetooth fits into the OSI model.
|
|
||||||
|
|
||||||
![][2]
|
|
||||||
|
|
||||||
As another example of this, [this Wikipedia article][3] 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][4]. Apparently this happened during the [Protocol Wars][5] in the 70s and 80s, where the OSI model lost and TCP/IP won.
|
|
||||||
|
|
||||||
This explains why the OSI model doesn’t 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.
|
|
||||||
|
|
||||||
### that’s all!
|
|
||||||
|
|
||||||
I’m 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? what’s 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][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[hanszhao80](https://github.com/hanszhao80)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://jvns.ca/
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://flylib.com/books/en/4.215.1.116/1/
|
|
||||||
[2]: https://jvns.ca/images/bluetooth.gif
|
|
||||||
[3]: https://en.wikipedia.org/wiki/List_of_network_protocols_(OSI_model)
|
|
||||||
[4]: https://en.wikipedia.org/wiki/OSI_protocols
|
|
||||||
[5]: https://en.wikipedia.org/wiki/Protocol_Wars
|
|
89
translated/tech/20210511 What is the OSI model.md
Normal file
89
translated/tech/20210511 What is the OSI model.md
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
[#]: subject: (What is the OSI model?)
|
||||||
|
[#]: via: (https://jvns.ca/blog/2021/05/11/what-s-the-osi-model-/)
|
||||||
|
[#]: author: (Julia Evans https://jvns.ca/)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (hanszhao80)
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
OSI 模型是什么?
|
||||||
|
======
|
||||||
|
|
||||||
|
今天我在推特上发布了一些关于 OSI 模型如何与 TCP/IP 工作原理的实际表现不相符的观点,这让我思考——OSI 模型到底是什么?通过阅读推特上的一些回复发现,似乎至少存在三种不同的思考方式:
|
||||||
|
|
||||||
|
1. TCP/IP 工作原理的字面描述
|
||||||
|
2. 一个可以用来描述和比较很多不同的网络协议的抽象模型
|
||||||
|
3. 对 1980 年代的一些计算机网络协议的字面描述,这些协议如今大多已不再使用
|
||||||
|
|
||||||
|
在这篇文章中,我不打算试图争辩以上哪一个才是“真正”的 OSI 模型——似乎不同的人以所有这些方式思考它。这不重要。
|
||||||
|
|
||||||
|
### OSI 模型有七层
|
||||||
|
|
||||||
|
在我们讨论 OSI 模型的含义之前,让我们大致地讨论一下它是什么。它是一个抽象模型,用于描述网络如何在七个编号的层上工作:
|
||||||
|
|
||||||
|
- 第一层:物理层
|
||||||
|
- 第二层:数据链路层
|
||||||
|
- 第三层:网络层
|
||||||
|
- 第四层:传输层
|
||||||
|
- 第五层:会话层
|
||||||
|
- 第六层:表示层
|
||||||
|
- 第七层:应用层
|
||||||
|
|
||||||
|
我不会再费时地去解释每一层的含义,网上有上千种解释可供查询。
|
||||||
|
|
||||||
|
### OSI 模型:TCP/IP 工作原理的字面描述
|
||||||
|
|
||||||
|
首先,我想谈谈人们在实践中使用 OSI 模型的一种常见方式:作为对 TCP/IP 工作原理的字面描述。OSI 模型的某些层非常容易映射到 TCP/IP:
|
||||||
|
|
||||||
|
- 第二层对应以太网
|
||||||
|
- 第三层对应 IP
|
||||||
|
- 第四层对应 TCP 或 UDP(或 ICMP 等)
|
||||||
|
- 第七层对应 TCP 或 UDP 包内的任何内容(例如 DNS 查询)
|
||||||
|
|
||||||
|
这种映射对第二、三、四层很有意义——TCP 数据包有三个<ruby>标头<rt>header</rt></ruby>对应于这三个层(以太网标头、IP 标头和 TCP 标头)。
|
||||||
|
|
||||||
|
用数字来描述 TCP 数据包中的不同标头非常有用——如果你说“第二层”,很显然它位于第三层“下方”,因为二比三小。
|
||||||
|
|
||||||
|
“OSI 模型作为字面描述”的古怪之处在于,第五层和第六层并不真正对应于 TCP/IP 中的任何内容——我听说过很多关于第五层或第六层可能是什么的不同解释(你可以说第五层是 TLS 或其他东西!)但它们没有像第二、三、四层那样“每一层在 TCP 数据包中都有相应的标头”这样的明确对应关系。
|
||||||
|
|
||||||
|
此外,TCP/IP 的某些部分即使在第二层到第四层也不能很好地适应 OSI 模型——例如,哪一层是 ARP 数据包?ARP 数据包发送一些带有以太网标头的数据,这是否意味着它们是第三层?或是第二层?列出不同 OSI 层的维基百科文章将其归类为“第 2.5 层”,这并不令人满意。
|
||||||
|
|
||||||
|
因为 OSI 模型有时用于教授 TCP/IP,若搞不清楚它的哪些部分与 TCP/IP 映射良好,而哪些部分不能,则会令人困惑。这才是真的问题。
|
||||||
|
|
||||||
|
### OSI 模型:用于比较网络协议的一个抽象
|
||||||
|
|
||||||
|
我听说过的另一种关于 OSI 的思考方式是,它是一种抽象,可以用来在许多不同的网络协议之间进行类比。例如,如果你想了解蓝牙协议的工作原理,也许你可以使用 OSI 模型来帮助你——这是我在 [这个网页][1] 上找到的一张图表,显示了蓝牙协议如何适配 OSI 模型。
|
||||||
|
|
||||||
|
![][2]
|
||||||
|
|
||||||
|
另一个例子是,[这篇维基百科文章][3] 有一个 OSI 层列表,详细划分了哪些特定的网络协议对应于这些 OSI 层。
|
||||||
|
|
||||||
|
### OSI 模型:一些过时协议的字面描述
|
||||||
|
|
||||||
|
维基百科上的一些非常简短的研究表明,除了对这七层的抽象描述之外,OSI 模型还包含了 [一组实现这些层的特定协议][4]。显然,这发生在 70 年代和 80 年代的 [协议战争][5] 时期,OSI 模型失败了,TCP/IP 则取得了胜利。
|
||||||
|
|
||||||
|
这就解释了为什么 OSI 模型无法与 TCP/IP 很好地对应,因为如果当时“获胜”的是 OSI 协议,那么 OSI 模型 _将_ 完全对应于互联网网络的实际工作方式。
|
||||||
|
|
||||||
|
### 结语
|
||||||
|
|
||||||
|
我写这篇文章的初衷是,当我最初学习 OSI 模型时,我发现它非常令人困惑(所有这些层是什么?它们是真实存在的吗?这是网络的实际工作原理吗?发生了什么?)我希望有人告诉我这个只使用 TCP/IP 网络协议的人,只需了解 OSI 模型第二、三、四和七层与 TCP/IP 的关系,然后忽略它的所有其他内容即可。所以我希望这篇文章对某些人能有所帮助!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://jvns.ca/blog/2021/05/11/what-s-the-osi-model-/
|
||||||
|
|
||||||
|
作者:[Julia Evans][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[hanszhao80](https://github.com/hanszhao80)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://jvns.ca/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://flylib.com/books/en/4.215.1.116/1/
|
||||||
|
[2]: https://jvns.ca/images/bluetooth.gif
|
||||||
|
[3]: https://en.wikipedia.org/wiki/List_of_network_protocols_(OSI_model)
|
||||||
|
[4]: https://en.wikipedia.org/wiki/OSI_protocols
|
||||||
|
[5]: https://en.wikipedia.org/wiki/Protocol_Wars
|
Loading…
Reference in New Issue
Block a user