如何假装成很懂互联网的样子,TCP/IP的故事

jopen 11年前

        我们生活在这样一个时代:只要连上网络,就可以和他人交流,无论距离有多远;也可以网购商品,发誓剁手都无济于事;还可以点评正在发生的热点事件,像皇上批阅奏章一样日理万机。用我们这一行的表达方式,可以说现代人的生活是基于网络的。

        网络的流行很大一部分要归功于 Vinton Cerf 和 Robert Kahn 这对老搭档。他们在 70 年代设计的 TCP/IP 协议奠定了网络的基石,也因此获得计算机界的最高荣誉——图灵奖。其实 TCP/IP 项目还不是这两位互联网之父的第一次合作。在此之前他们一起参与了阿帕网的开发。阿帕网是现代网络的前身。当时谁也没有想到,不久之后他们就会设计一套全 新的协议来取代自己设计的阿帕网。

如何假装成很懂互联网的样子,TCP/IP的故事

        Robert 为人低调,每次接受采访都一本正经。而 Vinton 热情外露,关于他的趣事很多。他的妻子是一位画家,他们第一次约会时去了艺术博物馆。技术男 Vinton 在一幅大型作品前伫立良久,最后冒出一句:“这画真像一只巨大的新鲜汉堡包”。在他们的婚礼上,录音机突然卡壳。Vinton 终于发挥了特长,和伴郎一起到小房间修录音机了。互联网造福了世界,当然也包括 Vinton 自己的生活。因为夫妻俩都有听力缺陷,电子邮件就为他们带来不少便利。

        现在人们说到 TCP/IP 时,指的已经不只是 TCP 和 IP 两个协议,而是包括了 Application Layer、Transport Layer、Internet Layer 和 Network Access Layer 的四层模型。TCP 处于 Transport Layer,而 IP 处于 Internet Layer。鲜为人知的是,刚开始这两个协议并没有分层,而是结合在一起。计算机科学家 Jon Postel 对此批评说:

We are screwing up in our design of internet protocols by violating the principle of layering. Specifically we are trying to use TCP to do two things: serve as a host level end to end protocol, and to serve as an internet packaging and routing protocol. These two things should be provided in a layered and modular way. I suggest that a new distinct internetwork protocol is needed, and that TCP be used strictly as a host level end to end protocol.

        (由于违背层级原理,我们设计的互联网协议已经一团糟。特别是我们试图使用 TCP 协议做下面二件事情:1、用作主机层级的端到端协议。2、用作网络包和路由协议。这二项服务应该通过层级和模块化的方式完成。我建议建立一个新的互联网网 络协议,在这个协议中 TCP 层只用作主机层级的端到端服务。)

        -- Jon Postel, IEN 2, 1977

        这个建议一年后被采纳了,第三版的协议决定把 TCP 和 IP 分离开来,并且延续至今。Jon 的另一个身份是 Vinton 的高中同学。他在 1998 年去世时,Vinton 为他写了一篇感人至深的讣告,并且作为 RFC 2468 发布。这对一位科学家来说也许是最有意义的纪念方式。我们今天还可以通过 http://tools.ietf.org/html/rfc2468访问到它。

        TCP/IP 的设计堪称完美。三十年来底层的带宽、延时、还有介质都发生了翻天覆地的变化,顶层也多了很多应用,但 TCP/IP 却安如泰山。它不但战胜了国际标准化组织的 OSI 七层模型,而且目前还看不到被其他方案取代的可能。第一代从事 TCP/IP 工作的工程师,到了退休年龄也在做着朝阳产业。

如何假装成很懂互联网的样子,TCP/IP的故事

        令人费解的是,现在的大学课程还在介绍早已淘汰的 OSI 七层模型。它和 TCP/IP 模型的对应关系如左图所示。因为层数太多,很多学生根本理解不了,甚至连排序都不会。老师就用“All People Seem To Need Data Processing”来帮助记忆,因为这七个单词的首字母和 OSI 模型每一层的首字母是一样的。大学的应试教育由此可见一斑。更奇怪的是学生们走出校园后,会发现这个笨重的七层模型早已不复存在。虽然它得到过官方的大力 支持,但是市场明显更青睐轻盈的 TCP/IP 四层模型。

        按理说 OSI 是权威组织,七层模型应该是科学的。为什么反而会不受欢迎呢?普度大学的特聘教授 Douglas Comer 在他的文章里这样说过:

如何假装成很懂互联网的样子,TCP/IP的故事

        “(研究人员)最近有了一些惊人的发现:我们都知道这个七层模型是一个小组完成的,但我们不知道的是,这个小组深夜在酒吧里谈论美国的娱乐八 卦。后来他们把迪斯尼电影里 7 个小矮人的名字写在餐巾纸上,有个人开玩笑说 7 对于网络分层是个好数字。第二天上午在标准化委员会的会议上,他们传阅了那张餐巾纸,然后一致同意他们昨晚喝醉时的重大发现。那天结束时,他们又给七个层 次重新起了听上去更科学的名字,于是模型就诞生了。

        (下表是 Douglas 对这个小组的极尽嘲讽,我翻译不出其中的神韵,所以干脆贴出原文。)

Layer

Dwarf

Name

Explanations

1

Sleepy

Physical

        The group new that physical connections are boring, and figured it might as well assign the physical layer to dwarf ``Sleepy''. As it happens, a Layer 1 protocol specification does indeed put everyone to sleep (just try reading one late at night).

2

Sneezy

Link

        If you monitor a network and watch the pattern of packets emitted by a computer, you'll immediately understand the relationship between link-layer protocols and ``Sneezy''.

3

Happy

Network

        Everyone's happy with the network layer. Well... to be honest, the only network layer protocol that makes everyone's happy is the Internet Protocol. Unfortunately, the Internet protocol isn't part of OSI, and wasn't really built to follow the OSI model (the model didn't include internetworking). But, the designers had good intentions.

4

Doc

Transport

        This one's obvious -- it definitely takes a Ph.D. to understand the subtleties of a transport layer protocol.

5

Dopey

Session

        Yep, even the designers realized that having a separate session layer is a dopey idea. They decided to follow Disney's approach of adding comic relief, so they stuck in a completely unnecessary layer and laughed about it.

6

Bashful

Presentation

        Another little joke. The designers realized that sooner or later someone would create a presentation layer protocol. However, the group decided to classify such protocols as too ``bashful'' to appear in public. So, even if a presentation protocol is produced, no one gets to see it.

7

Grumpy

Application

        Programmers who design network applications are incredibly grumpy -- they complain about the efficiency of other layers, the fundamental abstractions of the network, the long hours, the difficulty of debugging, and the API they are forced to use. And users add to the grumpiness because users never complain about protocols at other layers; they only complain about applications.

        这个故事告诉我们:如果你是标准委员会中的工程师,不要和同事喝酒——深夜在酒吧里开的一个拙劣玩笑,却可能成为业界几十年挥之不去的噩梦。”

        Douglas 是网络界德高望重的前辈。他回到普度大学之前曾是 Cisco 的 Vice President of Research,同时更是久负盛名的技术作家,所以我愿意相信他的说法。而业界普遍对待 OSI 模型的抵触态度,更是一个有力的佐证。幸好到了今天,OSI 模型已经名存实亡了,它对人类的影响只停留在还没来得及更新的教科书上。