每一位程序員都應該保存的計算機網絡總結,哪怕你剛進大學

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"關於網絡,一直是一個讓我相當頭疼的技術點,從上大學那會就這樣,我記得我的巔峯就是參加學校舉辦的網絡攻防大賽,黑學校的服務器,研究了一個星期,愣是沒黑明白,我知道,我基本跟黑客這一行無緣了,雖然後期發展不錯","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"但是我發現,要想往上走,不會網絡真的不行,但是我又學不明白,咋整,最後,強迫自己學一點整理一點,然後整理出來這麼個玩意","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/6b/6b3641212e3b7263ae6a1bc6243fa2c6.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這裏就參考這張腦圖,然後梳理一下我現在的相應的計算機網絡的知識,基本涵蓋現在市面上需要的網絡的基礎知識,自己感覺適合5年以下的,大家可以收藏一下","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"1. 計算機網絡概述","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"1.1. 基本術語","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"結點 (node)","attrs":{}},{"type":"text","text":" :網絡中的結點可以是計算機,集線器,交換機或路由器等。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"鏈路(link )","attrs":{}},{"type":"text","text":" : 從一個結點到另一個結點的一段物理線路。中間沒有任何其他交點。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"主機(host)","attrs":{}},{"type":"text","text":" :連接在因特網上的計算機。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"ISP(Internet Service Provider)","attrs":{}},{"type":"text","text":" :因特網服務提供者(提供商)。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/c4/c4ee17243095d111211575adea4406ba.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"IXP(Internet eXchange Point)","attrs":{}},{"type":"text","text":" : 互聯網交換點 IXP 的主要作用就是允許兩個網絡直接相連並交換分組,而不需要再通過第三個網絡來轉發分組。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/f9/f9d2b76573014a17422cc960177c5469.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"RFC(Request For Comments)","attrs":{}},{"type":"text","text":" :意思是“請求評議”,包含了關於 Internet 幾乎所有的重要的文字資料。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"廣域網 WAN(Wide Area Network)","attrs":{}},{"type":"text","text":" :任務是通過長距離運送主機發送的數據。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"城域網 MAN(Metropolitan Area Network)","attrs":{}},{"type":"text","text":":用來將多個局域網進行互連。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"局域網 LAN(Local Area Network)","attrs":{}},{"type":"text","text":" : 學校或企業大多擁有多個互連的局域網。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/0a/0a1981b1b93b8873223517059ad38fee.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"個人區域網 PAN(Personal Area Network)","attrs":{}},{"type":"text","text":" :在個人工作的地方把屬於個人使用的電子設備用無線技術連接起來的網絡 。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/03/034927b53b9400df569dcf2ce75af462.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"分組(packet )","attrs":{}},{"type":"text","text":" :因特網中傳送的數據單元。由首部 header 和數據段組成。分組又稱爲包,首部可稱爲包頭。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"存儲轉發(store and forward )","attrs":{}},{"type":"text","text":" :路由器收到一個分組,先檢查分組是否正確,並過濾掉衝突包錯誤。確定包正確後,取出目的地址,通過查找表找到想要發送的輸出端口地址,然後將該包發送出去。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/28/28bba3f404b7eb5bdcba920e0b3f5c09.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"帶寬(bandwidth)","attrs":{}},{"type":"text","text":" :在計算機網絡中,表示在單位時間內從網絡中的某一點到另一點所能通過的“最高數據率”。常用來表示網絡的通信線路所能傳送數據的能力。單位是“比特每秒”,即爲 b/s。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"吞吐量(throughput )","attrs":{}},{"type":"text","text":" :表示在單位時間內通過某個網絡(或信道、接口)的數據量。吞吐量更經常地用於對現實世界中的網絡的一種測量,以便知道實際上到底有多少數據量能夠通過網絡。吞吐量受網絡的帶寬或網絡的額定速率的限制。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"1.2. 重要知識點總結","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"計算機網絡(簡稱網絡)把許多計算機連接在一起,而互聯網把許多網絡連接在一起,是網絡的網絡。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"小寫字母 i 開頭的 internet(互聯網)是通用名詞,它泛指由多個計算機網絡相互連接而成的網絡。在這些網絡之間的通信協議(即通信規則)可以是任意的。大寫字母 I 開頭的 Internet(互聯網)是專用名詞,它指全球最大的,開放的,由衆多網絡相互連接而成的特定的互聯網,並採用 TCP/IP 協議作爲通信規則,其前身爲 ARPANET。Internet 的推薦譯名爲因特網,現在一般流行稱爲互聯網。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"路由器是實現分組交換的關鍵構件,其任務是轉發收到的分組,這是網絡核心部分最重要的功能。分組交換採用存儲轉發技術,表示把一個報文(要發送的整塊數據)分爲幾個分組後再進行傳送。在發送報文之前,先把較長的報文劃分成爲一個個更小的等長數據段。在每個數據端的前面加上一些由必要的控制信息組成的首部後,就構成了一個分組。分組又稱爲包。分組是在互聯網中傳送的數據單元,正是由於分組的頭部包含了諸如目的地址和源地址等重要控制信息,每一個分組才能在互聯網中獨立的選擇傳輸路徑,並正確地交付到分組傳輸的終點。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","text":"互聯網按工作方式可劃分爲邊緣部分和核心部分。主機在網絡的邊緣部分,其作用是進行信息處理。由大量網絡和連接這些網絡的路由器組成核心部分,其作用是提供連通性和交換。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","text":"計算機通信是計算機中進程(即運行着的程序)之間的通信。計算機網絡採用的通信方式是客戶-服務器方式(C/S 方式)和對等連接方式(P2P 方式)。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":6,"align":null,"origin":null},"content":[{"type":"text","text":"客戶和服務器都是指通信中所涉及的應用進程。客戶是服務請求方,服務器是服務提供方。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":7,"align":null,"origin":null},"content":[{"type":"text","text":"按照作用範圍的不同,計算機網絡分爲廣域網 WAN,城域網 MAN,局域網 LAN,個人區域網 PAN。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":8,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"計算機網絡最常用的性能指標是:速率,帶寬,吞吐量,時延(發送時延,處理時延,排隊時延),時延帶寬積,往返時間和信道利用率。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":9,"align":null,"origin":null},"content":[{"type":"text","text":"網絡協議即協議,是爲進行網絡中的數據交換而建立的規則。計算機網絡的各層以及其協議集合,稱爲網絡的體系結構。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":10,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"五層體系結構由應用層,運輸層,網絡層(網際層),數據鏈路層,物理層組成。運輸層最主要的協議是 TCP 和 UDP 協議,網絡層最重要的協議是 IP 協議。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/41/415c3866d764b2c812234428b77c82a2.gif","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"下面的內容會介紹計算機網絡的五層體系結構:","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"物理層+數據鏈路層+網絡層(網際層)+運輸層+應用層","attrs":{}},{"type":"text","text":"。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"2. 物理層(Physical Layer)","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/f7/f763f018edcc819c9f4625b534eb07ab.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"2.1. 基本術語","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"數據(data)","attrs":{}},{"type":"text","text":" :運送消息的實體。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"信號(signal)","attrs":{}},{"type":"text","text":" :數據的電氣的或電磁的表現。或者說信號是適合在傳輸介質上傳輸的對象。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"碼元( code)","attrs":{}},{"type":"text","text":" :在使用時間域(或簡稱爲時域)的波形來表示數字信號時,代表不同離散數值的基本波形。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"單工(simplex )","attrs":{}},{"type":"text","text":" : 只能有一個方向的通信而沒有反方向的交互。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"半雙工(half duplex )","attrs":{}},{"type":"text","text":" :通信的雙方都可以發送信息,但不能雙方同時發送(當然也就不能同時接收)。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":6,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"全雙工(full duplex)","attrs":{}},{"type":"text","text":" : 通信的雙方可以同時發送和接收信息。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/d2/d202b545968a12cb44a12c469561664e.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"失真","attrs":{}},{"type":"text","text":":失去真實性,主要是指接受到的信號和發送的信號不同,有磨損和衰減。影響失真程度的因素:1.碼元傳輸速率 2.信號傳輸距離 3.噪聲干擾 4.傳輸媒體質量","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/ff/ff36746afbf96eac515386b491605e76.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"奈氏準則","attrs":{}},{"type":"text","text":" : 在任何信道中,碼元的傳輸的效率是有上限的,傳輸速率超過此上限,就會出現嚴重的碼間串擾問題,使接收端對碼元的判決(即識別)成爲不可能。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"香農定理","attrs":{}},{"type":"text","text":" :在帶寬受限且有噪聲的信道中,爲了不產生誤差,信息的數據傳輸速率有上限值。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"基帶信號(baseband signal)","attrs":{}},{"type":"text","text":" : 來自信源的信號。指沒有經過調製的數字信號或模擬信號。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"帶通(頻帶)信號(bandpass signal)","attrs":{}},{"type":"text","text":" :把基帶信號經過載波調製後,把信號的頻率範圍搬移到較高的頻段以便在信道中傳輸(即僅在一段頻率範圍內能夠通過信道),這裏調製過後的信號就是帶通信號。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"調製(modulation )","attrs":{}},{"type":"text","text":" : 對信號源的信息進行處理後加到載波信號上,使其變爲適合在信道傳輸的形式的過程。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":6,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"信噪比(signal-to-noise ratio )","attrs":{}},{"type":"text","text":" : 指信號的平均功率和噪聲的平均功率之比,即爲 S/N。信噪比(dB)=10*log10(S/N)。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":7,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"信道複用(channel multiplexing )","attrs":{}},{"type":"text","text":" :指多個用戶共享同一個信道。(並不一定是同時)。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/b2/b2f46d9e07925ff8314023aa8577d635.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"比特率(bit rate )","attrs":{}},{"type":"text","text":" :單位時間(每秒)內傳送的比特數。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"波特率(baud rate)","attrs":{}},{"type":"text","text":" :單位時間載波調製狀態改變的次數。針對數據信號對載波的調製速率。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"複用(multiplexing)","attrs":{}},{"type":"text","text":" :共享信道的方法。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"ADSL(Asymmetric Digital Subscriber Line )","attrs":{}},{"type":"text","text":" :非對稱數字用戶線。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"光纖同軸混合網(HFC 網)","attrs":{}},{"type":"text","text":" :在目前覆蓋範圍很廣的有線電視網的基礎上開發的一種居民寬帶接入網","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"2.2. 重要知識點總結","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"物理層的主要任務就是確定與傳輸媒體接口有關的一些特性,如機械特性,電氣特性,功能特性,過程特性。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"一個數據通信系統可劃分爲三大部分,即源系統,傳輸系統,目的系統。源系統包括源點(或源站,信源)和發送器,目的系統包括接收器和終點。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"通信的目的是傳送消息。如話音,文字,圖像等都是消息,數據是運送消息的實體。信號則是數據的電器或電磁的表現。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","text":"根據信號中代表消息的參數的取值方式不同,信號可分爲模擬信號(或連續信號)和數字信號(或離散信號)。在使用時間域(簡稱時域)的波形表示數字信號時,代表不同離散數值的基本波形稱爲碼元。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","text":"根據雙方信息交互的方式,通信可劃分爲單向通信(或單工通信),雙向交替通信(或半雙工通信),雙向同時通信(全雙工通信)。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":6,"align":null,"origin":null},"content":[{"type":"text","text":"來自信源的信號稱爲基帶信號。信號要在信道上傳輸就要經過調製。調製有基帶調製和帶通調製之分。最基本的帶通調製方法有調幅,調頻和調相。還有更復雜的調製方法,如正交振幅調製。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":7,"align":null,"origin":null},"content":[{"type":"text","text":"要提高數據在信道上的傳遞速率,可以使用更好的傳輸媒體,或使用先進的調製技術。但數據傳輸速率不可能任意被提高。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":8,"align":null,"origin":null},"content":[{"type":"text","text":"傳輸媒體可分爲兩大類,即導引型傳輸媒體(雙絞線,同軸電纜,光纖)和非導引型傳輸媒體(無線,紅外,大氣激光)。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":9,"align":null,"origin":null},"content":[{"type":"text","text":"了有效利用光纖資源,在光纖幹線和用戶之間廣泛使用無源光網絡 PON。無源光網絡無需配備電源,其長期運營成本和管理成本都很低。最流行的無源光網絡是以太網無源光網絡 EPON 和吉比特無源光網絡 GPON。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"2.3. 補充","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"2.3.1. 物理層主要做啥?","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"物理層主要做的事情就是 ","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"透明地傳送比特流","attrs":{}},{"type":"text","text":"。也可以將物理層的主要任務描述爲確定與傳輸媒體的接口的一些特性,即:機械特性(接口所用接線器的一些物理屬性如形狀尺寸),電氣特性(接口電纜的各條線上出現的電壓的範圍),功能特性(某條線上出現的某一電平的電壓的意義),過程特性(對於不同功能能的各種可能事件的出現順序)。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"物理層考慮的是怎樣才能在連接各種計算機的傳輸媒體上傳輸數據比特流,而不是指具體的傳輸媒體。","attrs":{}},{"type":"text","text":" 現有的計算機網絡中的硬件設備和傳輸媒體的種類非常繁多,而且通信手段也有許多不同的方式。物理層的作用正是儘可能地屏蔽掉這些傳輸媒體和通信手段的差異,使物理層上面的數據鏈路層感覺不到這些差異,這樣就可以使數據鏈路層只考慮完成本層的協議和服務,而不必考慮網絡的具體傳輸媒體和通信手段是什麼。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"2.3.2. 幾種常用的信道複用技術","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"頻分複用(FDM)","attrs":{}},{"type":"text","text":" :所有用戶在同樣的時間佔用不同的帶寬資源。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"時分複用(TDM)","attrs":{}},{"type":"text","text":" :所有用戶在不同的時間佔用同樣的頻帶寬度(分時不分頻)。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"統計時分複用 (Statistic TDM)","attrs":{}},{"type":"text","text":" :改進的時分複用,能夠明顯提高信道的利用率。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"碼分複用(CDM)","attrs":{}},{"type":"text","text":" : 用戶使用經過特殊挑選的不同碼型,因此各用戶之間不會造成干擾。這種系統發送的信號有很強的抗干擾能力,其頻譜類似於白噪聲,不易被敵人發現。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"波分複用( WDM)","attrs":{}},{"type":"text","text":" :波分複用就是光的頻分複用。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"2.3.3. 幾種常用的寬帶接入技術,主要是 ADSL 和 FTTx","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"用戶到互聯網的寬帶接入方法有非對稱數字用戶線 ADSL(用數字技術對現有的模擬電話線進行改造,而不需要重新佈線。ASDL 的快速版本是甚高速數字用戶線 VDSL。),光纖同軸混合網 HFC(是在目前覆蓋範圍很廣的有線電視網的基礎上開發的一種居民寬帶接入網)和 FTTx(即光纖到······)。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"3. 數據鏈路層(Data Link Layer)","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/b3/b337f6ce634db8cc13fb07d39cab51e5.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"3.1. 基本術語","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"鏈路(link)","attrs":{}},{"type":"text","text":" :一個結點到相鄰結點的一段物理鏈路。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"數據鏈路(data link)","attrs":{}},{"type":"text","text":" :把實現控制數據運輸的協議的硬件和軟件加到鏈路上就構成了數據鏈路。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"循環冗餘檢驗 CRC(Cyclic Redundancy Check)","attrs":{}},{"type":"text","text":" :爲了保證數據傳輸的可靠性,CRC 是數據鏈路層廣泛使用的一種檢錯技術。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"幀(frame)","attrs":{}},{"type":"text","text":" :一個數據鏈路層的傳輸單元,由一個數據鏈路層首部和其攜帶的封包所組成協議數據單元。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"MTU(Maximum Transfer Uint )","attrs":{}},{"type":"text","text":" :最大傳送單元。幀的數據部分的的長度上限。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":6,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"誤碼率 BER(Bit Error Rate )","attrs":{}},{"type":"text","text":" :在一段時間內,傳輸錯誤的比特佔所傳輸比特總數的比率。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":7,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"PPP(Point-to-Point Protocol )","attrs":{}},{"type":"text","text":" :點對點協議。即用戶計算機和 ISP 進行通信時所使用的數據鏈路層協議。以下是 PPP 幀的示意圖:","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/ed/edfd81bf43dad2339bed76c9416067e8.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"MAC 地址(Media Access Control 或者 Medium Access Control)","attrs":{}},{"type":"text","text":" :意譯爲媒體訪問控制,或稱爲物理地址、硬件地址,用來定義網絡設備的位置。在 OSI 模型中,第三層網絡層負責 IP 地址,第二層數據鏈路層則負責 MAC 地址。因此一個主機會有一個 MAC 地址,而每個網絡位置會有一個專屬於它的 IP 地址 。地址是識別某個系統的重要標識符,“名字指出我們所要尋找的資源,地址指出資源所在的地方,路由告訴我們如何到達該處。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/c3/c3993b5f86ed74f01413c8eb824ee579.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"網橋(bridge)","attrs":{}},{"type":"text","text":" :一種用於數據鏈路層實現中繼,連接兩個或多個局域網的網絡互連設備。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"交換機(switch )","attrs":{}},{"type":"text","text":" :廣義的來說,交換機指的是一種通信系統中完成信息交換的設備。這裏工作在數據鏈路層的交換機指的是交換式集線器,其實質是一個多接口的網橋","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"3.2. 重要知識點總結","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"鏈路是從一個結點到相鄰節點的一段物理鏈路,數據鏈路則在鏈路的基礎上增加了一些必要的硬件(如網絡適配器)和軟件(如協議的實現)","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"數據鏈路層使用的主要是","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"點對點信道","attrs":{}},{"type":"text","text":"和","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"廣播信道","attrs":{}},{"type":"text","text":"兩種。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"數據鏈路層傳輸的協議數據單元是幀。數據鏈路層的三個基本問題是:","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"封裝成幀","attrs":{}},{"type":"text","text":",","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"透明傳輸","attrs":{}},{"type":"text","text":"和","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"差錯檢測","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"循環冗餘檢驗 CRC","attrs":{}},{"type":"text","text":" 是一種檢錯方法,而幀檢驗序列 FCS 是添加在數據後面的冗餘碼","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"點對點協議 PPP","attrs":{}},{"type":"text","text":" 是數據鏈路層使用最多的一種協議,它的特點是:簡單,只檢測差錯而不去糾正差錯,不使用序號,也不進行流量控制,可同時支持多種網絡層協議","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":6,"align":null,"origin":null},"content":[{"type":"text","text":"PPPoE 是爲寬帶上網的主機使用的鏈路層協議","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":7,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"局域網的優點是:具有廣播功能,從一個站點可方便地訪問全網;便於系統的擴展和逐漸演變;提高了系統的可靠性,可用性和生存性。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":8,"align":null,"origin":null},"content":[{"type":"text","text":"計算機與外接局域網通信需要通過通信適配器(或網絡適配器),它又稱爲網絡接口卡或網卡。","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"計算器的硬件地址就在適配器的 ROM 中","attrs":{}},{"type":"text","text":"。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":9,"align":null,"origin":null},"content":[{"type":"text","text":"以太網採用的無連接的工作方式,對發送的數據幀不進行編號,也不要求對方發回確認。目的站收到有差錯幀就把它丟掉,其他什麼也不做","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":10,"align":null,"origin":null},"content":[{"type":"text","text":"以太網採用的協議是具有衝突檢測的","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"載波監聽多點接入 CSMA/CD","attrs":{}},{"type":"text","text":"。協議的特點是:","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"發送前先監聽,邊發送邊監聽,一旦發現總線上出現了碰撞,就立即停止發送。然後按照退避算法等待一段隨機時間後再次發送。","attrs":{}},{"type":"text","text":" 因此,每一個站點在自己發送數據之後的一小段時間內,存在這遭遇碰撞的可能性。以太網上的各站點平等的爭用以太網信道","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":11,"align":null,"origin":null},"content":[{"type":"text","text":"以太網的適配器具有過濾功能,它只接收單播幀,廣播幀和多播幀。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":12,"align":null,"origin":null},"content":[{"type":"text","text":"使用集線器可以在物理層擴展以太網(擴展後的以太網仍然是一個網絡)","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"3.3. 補充","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"數據鏈路層的點對點信道和廣播信道的特點,以及這兩種信道所使用的協議(PPP 協議以及 CSMA/CD 協議)的特點","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"數據鏈路層的三個基本問題:","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"封裝成幀","attrs":{}},{"type":"text","text":",","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"透明傳輸","attrs":{}},{"type":"text","text":",","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"差錯檢測","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"以太網的 MAC 層硬件地址","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","text":"適配器,轉發器,集線器,網橋,以太網交換機的作用以及適用場合","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"4. 網絡層(Network Layer)","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/3c/3c8c6047676dcd118ed4b7627e79748a.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"4.1. 基本術語","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"虛電路(Virtual Circuit)","attrs":{}},{"type":"text","text":" : 在兩個終端設備的邏輯或物理端口之間,通過建立的雙向的透明傳輸通道。虛電路表示這只是一條邏輯上的連接,分組都沿着這條邏輯連接按照存儲轉發方式傳送,而並不是真正建立了一條物理連接。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"IP(Internet Protocol )","attrs":{}},{"type":"text","text":" : 網際協議 IP 是 TCP/IP 體系中兩個最主要的協議之一,是 TCP/IP 體系結構網際層的核心。配套的有 ARP,RARP,ICMP,IGMP。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"ARP(Address Resolution Protocol)","attrs":{}},{"type":"text","text":" : 地址解析協議。地址解析協議 ARP 把 IP 地址解析爲硬件地址。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"ICMP(Internet Control Message Protocol )","attrs":{}},{"type":"text","text":" :網際控制報文協議 (ICMP 允許主機或路由器報告差錯情況和提供有關異常情況的報告)。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"子網掩碼(subnet mask )","attrs":{}},{"type":"text","text":" :它是一種用來指明一個 IP 地址的哪些位標識的是主機所在的子網以及哪些位標識的是主機的位掩碼。子網掩碼不能單獨存在,它必須結合 IP 地址一起使用。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":6,"align":null,"origin":null},"content":[{"type":"text","text":"**CIDR( Classless Inter-Domain Routing ) **:無分類域間路由選擇 (特點是消除了傳統的 A 類、B 類和 C 類地址以及劃分子網的概念,並使用各種長度的“網絡前綴”(network-prefix)來代替分類地址中的網絡號和子網號)。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":7,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"默認路由(default route)","attrs":{}},{"type":"text","text":" :當在路由表中查不到能到達目的地址的路由時,路由器選擇的路由。默認路由還可以減小路由表所佔用的空間和搜索路由表所用的時間。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":8,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"路由選擇算法(Virtual Circuit)","attrs":{}},{"type":"text","text":" :路由選擇協議的核心部分。因特網採用自適應的,分層次的路由選擇協議。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"4.2. 重要知識點總結","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"TCP/IP 協議中的網絡層向上只提供簡單靈活的,無連接的,盡最大努力交付的數據報服務。網絡層不提供服務質量的承諾,不保證分組交付的時限所傳送的分組可能出錯,丟失,重複和失序。進程之間通信的可靠性由運輸層負責","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"在互聯網的交付有兩種,一是在本網絡直接交付不用經過路由器,另一種是和其他網絡的間接交付,至少經過一個路由器,但最後一次一定是直接交付","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"分類的 IP 地址由網絡號字段(指明網絡)和主機號字段(指明主機)組成。網絡號字段最前面的類別指明 IP 地址的類別。IP 地址是一種分等級的地址結構。IP 地址管理機構分配 IP 地址時只分配網絡號,主機號由得到該網絡號的單位自行分配。路由器根據目的主機所連接的網絡號來轉發分組。一個路由器至少連接到兩個網絡,所以一個路由器至少應當有兩個不同的 IP 地址","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","text":"IP 數據報分爲首部和數據兩部分。首部的前一部分是固定長度,共 20 字節,是所有 IP 數據包必須具有的(源地址,目的地址,總長度等重要地段都固定在首部)。一些長度可變的可選字段固定在首部的後面。IP 首部中的生存時間給出了 IP 數據報在互聯網中所能經過的最大路由器數。可防止 IP 數據報在互聯網中無限制的兜圈子。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"地址解析協議 ARP 把 IP 地址解析爲硬件地址。ARP 的高速緩存可以大大減少網絡上的通信量。因爲這樣可以使主機下次再與同樣地址的主機通信時,可以直接從高速緩存中找到所需要的硬件地址而不需要再去廣播方式發送 ARP 請求分組","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":6,"align":null,"origin":null},"content":[{"type":"text","text":"無分類域間路由選擇 CIDR 是解決目前 IP 地址緊缺的一個好辦法。CIDR 記法把 IP 地址後面加上斜線“/”,然後寫上前綴所所佔的位數。前綴(或網絡前綴用來指明網絡),前綴後面的部分是後綴,用來指明主機。CIDR 把前綴都相同的連續的 IP 地址組成一個“CIDR 地址塊”,IP 地址分配都以 CIDR 地址塊爲單位。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":7,"align":null,"origin":null},"content":[{"type":"text","text":"網際控制報文協議是 IP 層的協議。ICMP 報文作爲 IP 數據報的數據,加上首部後組成 IP 數據報發送出去。使用 ICMP 數據報並不是爲了實現可靠傳輸。ICMP 允許主機或路由器報告差錯情況和提供有關異常情況的報告。ICMP 報文的種類有兩種 ICMP 差錯報告報文和 ICMP 詢問報文。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":8,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"要解決 IP 地址耗盡的問題,最根本的辦法是採用具有更大地址空間的新版本 IP 協議-IPv6。","attrs":{}},{"type":"text","text":" IPv6 所帶來的變化有 ① 更大的地址空間(採用 128 位地址)② 靈活的首部格式 ③ 改進的選項 ④ 支持即插即用 ⑤ 支持資源的預分配 ⑥IPv6 的首部改爲 8 字節對齊。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":9,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"虛擬專用網絡 VPN 利用公用的互聯網作爲本機構專用網之間的通信載體。VPN 內使用互聯網的專用地址。一個 VPN 至少要有一個路由器具有合法的全球 IP 地址,這樣才能和本系統的另一個 VPN 通過互聯網進行通信。所有通過互聯網傳送的數據都需要加密。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":10,"align":null,"origin":null},"content":[{"type":"text","text":"MPLS 的特點是:① 支持面向連接的服務質量 ② 支持流量工程,平衡網絡負載 ③ 有效的支持虛擬專用網 VPN。MPLS 在入口節點給每一個 IP 數據報打上固定長度的“標記”,然後根據標記在第二層(鏈路層)用硬件進行轉發(在標記交換路由器中進行標記交換),因而轉發速率大大加快。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"5. 傳輸層(Transport Layer)","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/14/1408daec51ab93fab9f06744d2b8e070.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"5.1. 基本術語","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"進程(process)","attrs":{}},{"type":"text","text":" :指計算機中正在運行的程序實體。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"應用進程互相通信","attrs":{}},{"type":"text","text":" :一臺主機的進程和另一臺主機中的一個進程交換數據的過程(另外注意通信真正的端點不是主機而是主機中的進程,也就是說端到端的通信是應用進程之間的通信)。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"傳輸層的複用與分用","attrs":{}},{"type":"text","text":" :複用指發送方不同的進程都可以通過統一個運輸層協議傳送數據。分用指接收方的運輸層在剝去報文的首部後能把這些數據正確的交付到目的應用進程。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"TCP(Transmission Control Protocol)","attrs":{}},{"type":"text","text":" :傳輸控制協議。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"UDP(User Datagram Protocol)","attrs":{}},{"type":"text","text":" :用戶數據報協議。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/6b/6b3be0eaff08a6f68560092c910851b7.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"**端口(port) ** :端口的目的是爲了確認對方機器是那個進程在於自己進行交互,比如 MSN 和 QQ 的端口不同,如果沒有端口就可能出現 QQ 進程和 MSN 交互錯誤。端口又稱協議端口號。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"停止等待協議(stop-and-wait)","attrs":{}},{"type":"text","text":" :指發送方每發送完一個分組就停止發送,等待對方確認,在收到確認之後在發送下一個分組。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"流量控制","attrs":{}},{"type":"text","text":" : 就是讓發送方的發送速率不要太快,既要讓接收方來得及接收,也不要使網絡發生擁塞。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"擁塞控制","attrs":{}},{"type":"text","text":" :防止過多的數據注入到網絡中,這樣可以使網絡中的路由器或鏈路不致過載。擁塞控制所要做的都有一個前提,就是網絡能夠承受現有的網絡負荷。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"5.2. 重要知識點總結","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"運輸層提供應用進程之間的邏輯通信,也就是說,運輸層之間的通信並不是真正在兩個運輸層之間直接傳輸數據。運輸層嚮應用層屏蔽了下面網絡的細節(如網絡拓補,所採用的路由選擇協議等),它使應用進程之間看起來好像兩個運輸層實體之間有一條端到端的邏輯通信信道。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"網絡層爲主機提供邏輯通信,而運輸層爲應用進程之間提供端到端的邏輯通信。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"運輸層的兩個重要協議是用戶數據報協議 UDP 和傳輸控制協議 TCP。按照 OSI 的術語,兩個對等運輸實體在通信時傳送的數據單位叫做運輸協議數據單元 TPDU(Transport Protocol Data Unit)。但在 TCP/IP 體系中,則根據所使用的協議是 TCP 或 UDP,分別稱之爲 TCP 報文段或 UDP 用戶數據報。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"UDP 在傳送數據之前不需要先建立連接,遠地主機在收到 UDP 報文後,不需要給出任何確認。雖然 UDP 不提供可靠交付,但在某些情況下 UDP 確是一種最有效的工作方式。 TCP 提供面向連接的服務。在傳送數據之前必須先建立連接,數據傳送結束後要釋放連接。TCP 不提供廣播或多播服務。由於 TCP 要提供可靠的,面向連接的傳輸服務,這一難以避免增加了許多開銷,如確認,流量控制,計時器以及連接管理等。這不僅使協議數據單元的首部增大很多,還要佔用許多處理機資源。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","text":"硬件端口是不同硬件設備進行交互的接口,而軟件端口是應用層各種協議進程與運輸實體進行層間交互的一種地址。UDP 和 TCP 的首部格式中都有源端口和目的端口這兩個重要字段。當運輸層收到 IP 層交上來的運輸層報文時,就能夠 根據其首部中的目的端口號把數據交付應用層的目的應用層。(兩個進程之間進行通信不光要知道對方 IP 地址而且要知道對方的端口號(爲了找到對方計算機中的應用進程))","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":6,"align":null,"origin":null},"content":[{"type":"text","text":"運輸層用一個 16 位端口號標誌一個端口。端口號只有本地意義,它只是爲了標誌計算機應用層中的各個進程在和運輸層交互時的層間接口。在互聯網的不同計算機中,相同的端口號是沒有關聯的。協議端口號簡稱端口。雖然通信的終點是應用進程,但只要把所發送的報文交到目的主機的某個合適端口,剩下的工作(最後交付目的進程)就由 TCP 和 UDP 來完成。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":7,"align":null,"origin":null},"content":[{"type":"text","text":"運輸層的端口號分爲服務器端使用的端口號(0~1023 指派給熟知端口,1024~49151 是登記端口號)和客戶端暫時使用的端口號(49152~65535)","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":8,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"UDP 的主要特點是 ① 無連接 ② 盡最大努力交付 ③ 面向報文 ④ 無擁塞控制 ⑤ 支持一對一,一對多,多對一和多對多的交互通信 ⑥ 首部開銷小(只有四個字段:源端口,目的端口,長度和檢驗和)","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":9,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"TCP 的主要特點是 ① 面向連接 ② 每一條 TCP 連接只能是一對一的 ③ 提供可靠交付 ④ 提供全雙工通信 ⑤ 面向字節流","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":10,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"TCP 用主機的 IP 地址加上主機上的端口號作爲 TCP 連接的端點。這樣的端點就叫做套接字(socket)或插口。套接字用(IP 地址:端口號)來表示。每一條 TCP 連接唯一被通信兩端的兩個端點所確定。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":11,"align":null,"origin":null},"content":[{"type":"text","text":"停止等待協議是爲了實現可靠傳輸的,它的基本原理就是每發完一個分組就停止發送,等待對方確認。在收到確認後再發下一個分組。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":12,"align":null,"origin":null},"content":[{"type":"text","text":"爲了提高傳輸效率,發送方可以不使用低效率的停止等待協議,而是採用流水線傳輸。流水線傳輸就是發送方可連續發送多個分組,不必每發完一個分組就停下來等待對方確認。這樣可使信道上一直有數據不間斷的在傳送。這種傳輸方式可以明顯提高信道利用率。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":13,"align":null,"origin":null},"content":[{"type":"text","text":"停止等待協議中超時重傳是指只要超過一段時間仍然沒有收到確認,就重傳前面發送過的分組(認爲剛纔發送過的分組丟失了)。因此每發送完一個分組需要設置一個超時計時器,其重轉時間應比數據在分組傳輸的平均往返時間更長一些。這種自動重傳方式常稱爲自動重傳請求 ARQ。另外在停止等待協議中若收到重複分組,就丟棄該分組,但同時還要發送確認。連續 ARQ 協議可提高信道利用率。發送維持一個發送窗口,凡位於發送窗口內的分組可連續發送出去,而不需要等待對方確認。接收方一般採用累積確認,對按序到達的最後一個分組發送確認,表明到這個分組位置的所有分組都已經正確收到了。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":14,"align":null,"origin":null},"content":[{"type":"text","text":"TCP 報文段的前 20 個字節是固定的,後面有 4n 字節是根據需要增加的選項。因此,TCP 首部的最小長度是 20 字節。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":15,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"TCP 使用滑動窗口機制。發送窗口裏面的序號表示允許發送的序號。發送窗口後沿的後面部分表示已發送且已收到確認,而發送窗口前沿的前面部分表示不允許發送。發送窗口後沿的變化情況有兩種可能,即不動(沒有收到新的確認)和前移(收到了新的確認)。發送窗口的前沿通常是不斷向前移動的。一般來說,我們總是希望數據傳輸更快一些。但如果發送方把數據發送的過快,接收方就可能來不及接收,這就會造成數據的丟失。所謂流量控制就是讓發送方的發送速率不要太快,要讓接收方來得及接收。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":16,"align":null,"origin":null},"content":[{"type":"text","text":"在某段時間,若對網絡中某一資源的需求超過了該資源所能提供的可用部分,網絡的性能就要變壞。這種情況就叫擁塞。擁塞控制就是爲了防止過多的數據注入到網絡中,這樣就可以使網絡中的路由器或鏈路不致過載。擁塞控制所要做的都有一個前提,就是網絡能夠承受現有的網絡負荷。擁塞控制是一個全局性的過程,涉及到所有的主機,所有的路由器,以及與降低網絡傳輸性能有關的所有因素。相反,流量控制往往是點對點通信量的控制,是個端到端的問題。流量控制所要做到的就是抑制發送端發送數據的速率,以便使接收端來得及接收。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":17,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"爲了進行擁塞控制,TCP 發送方要維持一個擁塞窗口 cwnd 的狀態變量。擁塞控制窗口的大小取決於網絡的擁塞程度,並且動態變化。發送方讓自己的發送窗口取爲擁塞窗口和接收方的接受窗口中較小的一個。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":18,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"TCP 的擁塞控制採用了四種算法,即慢開始,擁塞避免,快重傳和快恢復。在網絡層也可以使路由器採用適當的分組丟棄策略(如主動隊列管理 AQM),以減少網絡擁塞的發生。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":19,"align":null,"origin":null},"content":[{"type":"text","text":"運輸連接的三個階段,即:連接建立,數據傳送和連接釋放。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":20,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"主動發起 TCP 連接建立的應用進程叫做客戶,而被動等待連接建立的應用進程叫做服務器。TCP 連接採用三報文握手機制。服務器要確認用戶的連接請求,然後客戶要對服務器的確認進行確認。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":21,"align":null,"origin":null},"content":[{"type":"text","text":"TCP 的連接釋放採用四報文握手機制。任何一方都可以在數據傳送結束後發出連接釋放的通知,待對方確認後進入半關閉狀態。當另一方也沒有數據再發送時,則發送連接釋放通知,對方確認後就完全關閉了 TCP 連接","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"5.3. 補充(重要)","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"以下知識點需要重點關注:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"端口和套接字的意義","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"UDP 和 TCP 的區別以及兩者的應用場景","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"在不可靠的網絡上實現可靠傳輸的工作原理,停止等待協議和 ARQ 協議","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","text":"TCP 的滑動窗口,流量控制,擁塞控制和連接管理","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","text":"TCP 的三次握手,四次揮手機制","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"6. 應用層(Application Layer)","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/17/17b75756a615b0c35777e2b8c20d7137.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"6.1. 基本術語","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"域名系統(DNS)","attrs":{}},{"type":"text","text":" :域名系統(DNS,Domain Name System)將人類可讀的域名 (例如,http://www.baidu.com) 轉換爲機器可讀的 IP 地址 (例如,220.181.38.148)。我們可以將其理解爲專爲互聯網設計的電話薄。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/3d/3dd2715fb51345e4a3da2fbd5402194c.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"文件傳輸協議(FTP)","attrs":{}},{"type":"text","text":" :FTP 是 File TransferProtocol(文件傳輸協議)的英文簡稱,而中文簡稱爲“文傳協議”。用於 Internet 上的控制文件的雙向傳輸。同時,它也是一個應用程序(Application)。基於不同的操作系統有不同的 FTP 應用程序,而所有這些應用程序都遵守同一種協議以傳輸文件。在 FTP 的使用當中,用戶經常遇到兩個概念:\"下載\"(Download)和\"上傳\"(Upload)。 \"下載\"文件就是從遠程主機拷貝文件至自己的計算機上;\"上傳\"文件就是將文件從自己的計算機中拷貝至遠程主機上。用 Internet 語言來說,用戶可通過客戶機程序向(從)遠程主機上傳(下載)文件。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/5a/5a2a0957143af09ad8d922f29b8e69db.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"簡單文件傳輸協議(TFTP)","attrs":{}},{"type":"text","text":" :TFTP(Trivial File Transfer Protocol,簡單文件傳輸協議)是 TCP/IP 協議族中的一個用來在客戶機與服務器之間進行簡單文件傳輸的協議,提供不復雜、開銷不大的文件傳輸服務。端口號爲 69。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"遠程終端協議(TELENET)","attrs":{}},{"type":"text","text":" :Telnet 協議是 TCP/IP 協議族中的一員,是 Internet 遠程登陸服務的標準協議和主要方式。它爲用戶提供了在本地計算機上完成遠程主機工作的能力。在終端使用者的電腦上使用 telnet 程序,用它連接到服務器。終端使用者可以在 telnet 程序中輸入命令,這些命令會在服務器上運行,就像直接在服務器的控制檯上輸入一樣。可以在本地就能控制服務器。要開始一個 telnet 會話,必須輸入用戶名和密碼來登錄服務器。Telnet 是常用的遠程控制 Web 服務器的方法。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"萬維網(WWW)","attrs":{}},{"type":"text","text":" :WWW 是環球信息網的縮寫,(亦作“Web”、“WWW”、“'W3'”,英文全稱爲“World Wide Web”),中文名字爲“萬維網”,\"環球網\"等,常簡稱爲 Web。分爲 Web 客戶端和 Web 服務器程序。WWW 可以讓 Web 客戶端(常用瀏覽器)訪問瀏覽 Web 服務器上的頁面。是一個由許多互相鏈接的超文本組成的系統,通過互聯網訪問。在這個系統中,每個有用的事物,稱爲一樣“資源”;並且由一個全局“統一資源標識符”(URI)標識;這些資源通過超文本傳輸協議(Hypertext Transfer Protocol)傳送給用戶,而後者通過點擊鏈接來獲得資源。萬維網聯盟(英語:World Wide Web Consortium,簡稱 W3C),又稱 W3C 理事會。1994 年 10 月在麻省理工學院(MIT)計算機科學實驗室成立。萬維網聯盟的創建者是萬維網的發明者蒂姆·伯納斯-李。萬維網並不等同互聯網,萬維網只是互聯網所能提供的服務其中之一,是靠着互聯網運行的一項服務。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"萬維網的大致工作工程:","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/4e/4e4dc387cc3f7885dca0343acad7538c.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"統一資源定位符(URL)","attrs":{}},{"type":"text","text":" :統一資源定位符是對可以從互聯網上得到的資源的位置和訪問方法的一種簡潔的表示,是互聯網上標準資源的地址。互聯網上的每個文件都有一個唯一的 URL,它包含的信息指出文件的位置以及瀏覽器應該怎麼處理它。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"超文本傳輸協議(HTTP)","attrs":{}},{"type":"text","text":" :超文本傳輸協議(HTTP,HyperText Transfer Protocol)是互聯網上應用最爲廣泛的一種網絡協議。所有的 WWW 文件都必須遵守這個標準。設計 HTTP 最初的目的是爲了提供一種發佈和接收 HTML 頁面的方法。1960 年美國人 Ted Nelson 構思了一種通過計算機處理文本信息的方法,並稱之爲超文本(hypertext),這成爲了 HTTP 超文本傳輸協議標準架構的發展根基。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"HTTP 協議的本質就是一種瀏覽器與服務器之間約定好的通信格式。HTTP 的原理如下圖所示:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/71/717df8a5e70d937d88d2fca56084f2d7.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"代理服務器(Proxy Server)","attrs":{}},{"type":"text","text":" : 代理服務器(Proxy Server)是一種網絡實體,它又稱爲萬維網高速緩存。 代理服務器把最近的一些請求和響應暫存在本地磁盤中。當新請求到達時,若代理服務器發現這個請求與暫時存放的的請求相同,就返回暫存的響應,而不需要按 URL 的地址再次去互聯網訪問該資源。代理服務器可在客戶端或服務器工作,也可以在中間系統工作。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"簡單郵件傳輸協議(SMTP)","attrs":{}},{"type":"text","text":" : SMTP(Simple Mail Transfer Protocol)即簡單郵件傳輸協議,它是一組用於由源地址到目的地址傳送郵件的規則,由它來控制信件的中轉方式。 SMTP 協議屬於 TCP/IP 協議簇,它幫助每臺計算機在發送或中轉信件時找到下一個目的地。 通過 SMTP 協議所指定的服務器,就可以把 E-mail 寄到收信人的服務器上了,整個過程只要幾分鐘。SMTP 服務器則是遵循 SMTP 協議的發送郵件服務器,用來發送或中轉發出的電子郵件。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/bd/bd35fa3e3aba9303fc75011b9d92dfd9.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"搜索引擎","attrs":{}},{"type":"text","text":" :搜索引擎(Search Engine)是指根據一定的策略、運用特定的計算機程序從互聯網上搜集信息,在對信息進行組織和處理後,爲用戶提供檢索服務,將用戶檢索相關的信息展示給用戶的系統。搜索引擎包括全文索引、目錄索引、元搜索引擎、垂直搜索引擎、集合式搜索引擎、門戶搜索引擎與免費鏈接列表等。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"垂直搜索引擎","attrs":{}},{"type":"text","text":" :垂直搜索引擎是針對某一個行業的專業搜索引擎,是搜索引擎的細分和延伸,是對網頁庫中的某類專門的信息進行一次整合,定向分字段抽取出需要的數據進行處理後再以某種形式返回給用戶。垂直搜索是相對通用搜索引擎的信息量大、查詢不準確、深度不夠等提出來的新的搜索引擎服務模式,通過針對某一特定領域、某一特定人羣或某一特定需求提供的有一定價值的信息和相關服務。其特點就是“專、精、深”,且具有行業色彩,相比較通用搜索引擎的海量信息無序化,垂直搜索引擎則顯得更加專注、具體和深入。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"全文索引","attrs":{}},{"type":"text","text":" :全文索引技術是目前搜索引擎的關鍵技術。試想在 1M 大小的文件中搜索一個詞,可能需要幾秒,在 100M 的文件中可能需要幾十秒,如果在更大的文件中搜索那麼就需要更大的系統開銷,這樣的開銷是不現實的。所以在這樣的矛盾下出現了全文索引技術,有時候有人叫倒排文檔技術。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"目錄索引","attrs":{}},{"type":"text","text":" :目錄索引( search index/directory),顧名思義就是將網站分門別類地存放在相應的目錄中,因此用戶在查詢信息時,可選擇關鍵詞搜索,也可按分類目錄逐層查找。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"6.2. 重要知識點總結","attrs":{}}]},{"type":"numberedlist","attrs":{"start":"1","normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"文件傳輸協議(FTP)使用 TCP 可靠的運輸服務。FTP 使用客戶服務器方式。一個 FTP 服務器進程可以同時爲多個用戶提供服務。在進進行文件傳輸時,FTP 的客戶和服務器之間要先建立兩個並行的 TCP 連接:控制連接和數據連接。實際用於傳輸文件的是數據連接。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"萬維網客戶程序與服務器之間進行交互使用的協議是超文本傳輸協議 HTTP。HTTP 使用 TCP 連接進行可靠傳輸。但 HTTP 本身是無連接、無狀態的。HTTP/1.1 協議使用了持續連接(分爲非流水線方式和流水線方式)","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"電子郵件把郵件發送到收件人使用的郵件服務器,並放在其中的收件人郵箱中,收件人可隨時上網到自己使用的郵件服務器讀取,相當於電子郵箱。","attrs":{}}]}],"attrs":{}},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","text":"一個電子郵件系統有三個重要組成構件:用戶代理、郵件服務器、郵件協議(包括郵件發送協議,如 SMTP,和郵件讀取協議,如 POP3 和 IMAP)。用戶代理和郵件服務器都要運行這些協議。","attrs":{}}]}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"希望可以對大家有幫助,喜歡的小夥伴可以關注公衆號:小遷不禿頭,每天不定時更新~","attrs":{}}]}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章