# 第01講 Foundation 計算機網路概論 黃能富教授 Applications Protocol --- 1. URL:Uniform resource locater 2. HTTP:Hyper Text Transfer Protocol 3. TCP:Transmission Control Protocol 傳出過程: Domain Name server (用URL查IP) ->用 3 way handshaking 建立連線 ->用 HTTP 提出request 和 acknowledgement ->連線結束tearing down TCP connection Network Connectivity --- * Important terminologies: 1. Link 2. Nodes 3. Point-to-point(點對點) 4. Multiple access(多點) 5. Switched Network(交換網路) -> Circuit Switched(電路交換) -> Packet Switched(封包交換) 6. Packet, message 7. Store-and-forward 8. Hosts 9. witches 10. Spanning tree -> 避免迴路 11. internetwork 12. Router/gateway 13. Host-to-host connectivity 14. Address 15. Routing 16. Unicast(單點)/broadcast(廣播)/multicast(群播) 17. LAN (Local Area Networks) -> 區域 18. MAN (Metropolitan Area Networks) -> 都會 19. WAN (Wide Area Networks) -> 廣域 Cost-Effective Resource Sharing --- * How to share a link ? 1. Multiplexing (多工) -> Switch 1 2. De-multiplexing (解多工) -> Switch 2  * FDM: Frequency Division Multiplexing (分頻多工)  * Synchronous Time-division Multiplexing (TDM) (同步分時多工) -> Time slots/data transmitted in predetermined slots  FDM和TDM問題:負載不平衡其況下,不可互相借用,因此效率較低。 * Statistical Multiplexing (統計式多工) 1. 資料依據資料的flow需求來傳送 2. What is a flow? -> 使用者所需要用到的流量 3. 交換機排程法: -> FIFO, Round-Robin, Priorities, Quality-of-Service(QoS) Logical Channels --- Logical Channels:應用程式與應用程式之間的通訊路徑或管道 -> 只是有關係存在,和實際所經過的路徑不一定會相同 Network Reliability --- * Network should ***hide the errors*** 1. Bits are lost -> Bit errors - 1 to a 0, and vice versa -> Burst errors (突爆錯誤) - several consecutive errors 2. Packets are lost (Congestion雍塞) 3. Links and Node failures 4. Messages are delayed 5. Messages are delivered out-of-order 6. Third parties eavesdrop Network Architecture ---  Protocols --- 1. Protocol defines the interfaces between * the layers in the **same system** * the layers of **peer system** 2. Each protocol object has two different interfaces * **Service interface**(縱向):定義本介面在協議中的執行業務 * **Peer-to-peer interface**(橫向):用於同層對等者(peer)的訊息交換  3. **Protocol Specification**(規格): * pseudo-code (虛擬碼) * state transition diagram(狀態轉移圖) * message format(訊息格式) 4. **Interoperable**(互通測試):when two or more protocols that implement the specification accurately 5. IETF: Internet Engineering Task Force -> 負責定義互聯網標準與協議規格 6. Protocol Architecture  * TCP 較 UDP 可靠 Encapsulation ---  * High-level messages are encapsulated inside of low-level messages * 紅色虛線為Peer-to-peer interface,故虛線部分可互相溝通 * 往上傳送時(decapsulation),每一層只讀自己的header,如IP只看IP那欄的header,並且在處理完資料之後將此header移除後,接著將封包往上層傳送 OSI Architecture ---  * Data Link layer (傳送一小段) * Network layer (傳送整條路徑) ex:IP * Transport layer (容錯較高) ex:TCP、UDP ->且Transport layer有重送機制,因為下層較不可靠 ---  * Switch為layer 2的設備、Router為layer 3的設備 * 因為經過的均為Switch,所以LAN為**Ethernet**(乙太網路) ---  * Access Point (AP)為layer 2的設備 * 因為經過的有Switch和AP,所以LAN為**Ethernet + WiFi** ## Description of Layers ### Physical Layer 1. Handles the transmission of raw bits over a communication link * Coaxial cable (同軸電纜) * Twisted pair (雙絞線) -> 降低電磁波干擾 * Optical Fiber (光纖) * Air space (無線傳輸) 2. Different Signal Coding schemes * 需要知道clock cycle time或是一個bit的時間 ### Data Link Layer **(如何將 frame 傳給直接相連的主機或設備)** 1. Collects a stream of bits into a ***frame*** 2. How to transmit a frame to a directly connected host (destination) ? * Point-to-point * Multiple access:可能會發生collision,所以用 **MAC** 解決 3. **MAC (Media Access Control Protocol)** * CSMA/CD (IEEE 802.3 Ethernet) -> D(detect):偵測的意思 * CSMA/CA (IEEE 802.11 Wireless LAN) -> A(avoid):避免 4. **Layer 2** devices ### Network Layer **(如何將封包透過 Internet 送給目的地主機)** 1. Handles **routing** among nodes within a packet-switched network -> 如何選擇路徑 2. Data exchanged between nodes in this layer is called a **packet** 3. **Routing protocols** * RIP (路由信息協議) * OSPF (開放式最短路徑優先) * BGP (邊界閘道器協議) 4. Routing Tables -> 根據Routing protocols製作,並且**動態變更** ### Transport Layer **(提供不同主機 processes 之間的資料傳送)** 1. Implements a **process-to-process** channel 2. Unit of data exchanges in this layer is called a **message** 3. **TCP** (Transmission Control Protocol) – ***Reliable*** service 4. **UDP** (User Datagram Protocol) – ***Unreliable*** service ### Session Layer * 將不同的transport streams緊密結合成一個應用程式的一部分 ### Presentation Layer * 著重於網路資料交換格式的呈現 ### Application Layer * 提供共同的應用程式格式交換 * EX:FTP/E-mail/DNS/HTTP/Browsers/FB, … ***傳輸層以及較高的上層協議通常只實作在主機上,一般不會出現在網路中間的交換機或路由器等網路設備中*** 各層封包比較: --- * Data Link Layer -> frame * Network Layer -> packet * Transport Layer -> message Internet Architecture ---  * Defined by **IETF** * **Three main features** 1. Does not imply strict layering -> 應用程式可以隨意略過傳輸層以便直接使用 IP 或是其他更底層的網路服務 2. An hour-glass shape ->**IP協議提供目前大部分上下層連接的一個重要的點**  3. 制定一個 new protocol 需要包含 * a protocol specification * 至少一個(最好兩個)規格的實作 Network Performance --- 1. Bandwidth * Width of the **frequency band** * **Number of bits per second** 2. 1 **Mbps**: 1 x 106 bits/second 3. Bandwidth越小,傳輸越慢 * **Latency**: -> *Propagation time(傳播時間) + transmission time(傳輸時間) + queuing time(排隊時間)* * Propagation time:距離/光速 * Transmission time:size/bandwidth * **One** bit transmission => **propagation** is important (**資料已送完, 但前導資料還未到達對方**) -> 原因:短資料很快就送完, 但需要長時間才能傳到對方 => Propagation time >> transmission time * **Large** bytes transmission => **bandwidth** is important ( **未送完前, 前導資料已到對方**) -> 原因:長資料很慢才能送完 => Transmission time >> propagation time ## Latency X Bandwidth **Latency x Bandwidth means how many data can be stored in the pipe** * **Latency** (delay): **length** of the pipe (長度) * **Bandwidth**: **width** of the pip (寬度) * Relative importance of bandwidth and latency depends on application * **large** file => **bandwidth** * **small** messages => **latency** * Variance in latency (**jitter**) can also affect some applications * jitter:延遲的變異數 ### 結論 * 如果傳送端**持續塞滿整個pipe**, delay x bandwidth就是傳送端在第一個位元抵達接收端前必須傳送的位元數 * 傳送端若**無法將pipe塞滿**,那就不算是有效利用網路 * **停下來等對方回應之前如果可以傳送**delay x bandwidth的資料量是最佳的設計 throughput --- Throughput = TransferSize / TransferTime * TransferTime = RTT + TransferSize/Bandwidth * RTT (Round Trip Time) dominates -> 來回通訊延遲 Performance Summary --- * 兩個用於分析電腦網路效能的主要參數 * Bandwidth * Delay
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up