如何假裝成很懂網際網路的樣子,TCP/IP的故事

發表於2013-09-03

我們生活在這樣一個時代:只要連上網路,就可以和他人交流,無論距離有多遠;也可以網購商品,發誓剁手都無濟於事;還可以點評正在發生的熱點事件,像皇上批閱奏章一樣日理萬機。用我們這一行的表達方式,可以說現代人的生活是基於網路的。

網路的流行很大一部分要歸功於Vinton Cerf和Robert Kahn這對老搭檔。他們在70年代設計的TCP/IP協議奠定了網路的基石,也因此獲得計算機界的最高榮譽——圖靈獎。其實TCP/IP專案還不是這兩位網際網路之父的第一次合作。在此之前他們一起參與了阿帕網的開發。阿帕網是現代網路的前身。當時誰也沒有想到,不久之後他們就會設計一套全新的協議來取代自己設計的阿帕網。

vinton & rogert

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工作的工程師,到了退休年齡也在做著朝陽產業。

OSI+vs.+TCP+IP+-+paddy

令人費解的是,現在的大學課程還在介紹早已淘汰的OSI七層模型。它和TCP/IP模型的對應關係如左圖所示。因為層數太多,很多學生根本理解不了,甚至連排序都不會。老師就用“All People Seem To Need Data Processing”來幫助記憶,因為這七個單詞的首字母和OSI模型每一層的首字母是一樣的。大學的應試教育由此可見一斑。更奇怪的是學生們走出校園後,會發現這個笨重的七層模型早已不復存在。雖然它得到過官方的大力支援,但是市場明顯更青睞輕盈的TCP/IP四層模型。

按理說OSI是權威組織,七層模型應該是科學的。為什麼反而會不受歡迎呢?普度大學的特聘教授Douglas Comer在他的文章裡這樣說過:

OSI七層模型工作小組的合影

“(研究人員)最近有了一些驚人的發現:我們都知道這個七層模型是一個小組完成的,但我們不知道的是,這個小組深夜在酒吧裡談論美國的娛樂八卦。後來他們把迪斯尼電影裡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模型已經名存實亡了,它對人類的影響只停留在還沒來得及更新的教科書上。

相關文章