【正文】
無線 trace 格式 $3 如“ _x_”,字段長 len=3 {node_ =substr(node,2,1)。 無線 trace 第 6 個字段 $6 為分組的 uid pkt_type=$7。 有線 trace 第 4 個字段 $4 為分組的目的節(jié)點 pkt_type=$5。 有線 trace 第 12 個字段 $12 為分組的 uid } if(len==3) 如果分析的是無線 trace 記錄 if(event==s amp。 pkt_type==cbr amp。amp。amp。 node_==2 amp。 highest_uiduid) highest_uid=uid。i=highest_uid。 計算分組的延遲時間 if( startend) printf(%d %.9f\n,rate,delay)。 } { event = $1。 if(len == 3) { node_ = substr(node,2,1)。 pkt_type = $7。 pkt_type = $5。 } if(len==1) 如果目的節(jié)點接收到分組 { if(event==r amp。 pkt_type==cbr){ pkt_byte_sum[i+1]=pkt_byte_sum[i]+(pkt_size20)。 更新接收到的最新一個分組的時間 i++。 } { event = $1。 if(len == 3) { node_ = substr(node,2,1)。 pkt_type = $7。 pkt_type = $5。 } if(len==3) { if(event==d amp。 trace_type==AGT amp。amp。 } if(highest_uid uid) highest_uid = uid。 i++ ) { start = start_time[i]。 last_delay 用于保存上一分組的延遲時間 last_seqno=0。 第一個抖動為 0 } else { jitter=(delay[i]last_delay)/(ilast_seqno)。 } } } 、流量分析(主要是分析時延、帶寬和抖動率) 20 三、 E to C Translation A Day in the Life of a Web Page Request 網(wǎng)頁請求的流程 前言: 本章我們主要討論鏈路層,我們的網(wǎng) 絡(luò)之路從協(xié)議棧起步。 正文:如上圖所示:數(shù)字和下面的翻譯對應(yīng): 1. The operating system on Bob’s laptop creates a DHCP request message and puts this message within a UDP segment with destination port 67 (DHCP server) and source port 68 (DHCP client). The UDP segment is then placed within an IP datagram with a broadcast IP destination address 21 () and a source IP address of , since Bob’s laptop doesn’t yet have an IP address. Bob的筆記本電腦上的操作系統(tǒng)創(chuàng)建一個 DHCP請求消息并且把這個消息放在包含目標端口67( DHCP 服務(wù)器)和源端口 68( DHCP 客戶端) UDP 段內(nèi)。 以太網(wǎng)幀的默認目的 MAC 地址為 FF:FF:FF:FF:FF:FF,以至于以太網(wǎng)幀能廣播到連接在交換機(準確的說應(yīng)該是 DHCP 服務(wù)器)的全部設(shè)備上,然后幀的源 MAC 地址是 Bob 的電腦:00:16:D3:23:68:8A. 3. The broadcast Ether frame containing the DHCP request is the first frame sent by Bob’s laptop to the Ether switch. The switch broadcasts the ining frame on all outgoing ports, including the port connected to the router. Bob 的電腦發(fā)到以太網(wǎng)交換機的第一幀是包括 DHCP 請求報文的廣播幀。 此時 DHCP 服務(wù)器擁有了 DHCP 請求報文。 DHCP 服務(wù)器產(chǎn)生一個 ACK 報文其中包含這個 IP 地址,也包含 DNS 服務(wù)器的 IP( (),默認網(wǎng)關(guān)的 IP( )和子網(wǎng)掩碼 。 因為交換機有自我學(xué)習(xí)的功能,所以在之前接收到從 Bob 發(fā)來的 DHCP 請求幀,交換機就知道轉(zhuǎn)發(fā)幀從接收請求幀的那個端口發(fā)送 DHCP ACK 到 MAC 地址為 00:16:D3:23:68:8A。 Bob 的電腦開始發(fā)送帶有目的地址的數(shù)據(jù)報到默認網(wǎng)關(guān),他的子網(wǎng)是 。 Bob 的瀏覽器開始通過創(chuàng)建一個被用來發(fā)送 HTTP 請求道谷歌首頁的 TCP socket 進程。 DNS 報文被封裝在 UDP 數(shù)據(jù)報中,目的端口號為 53. UDP 數(shù)據(jù)報被封裝在目的地址為 的 IP 報文中,源 IP 為 9. Bob’s laptop then places the datagram containing the DNS query message in an Ether frame. This frame will be sent (addressed, at the link layer) to the gateway router in bob’s school’s work. However, even though Bob’s laptop knows the IP address of the school’s gateway router () via the DHCP ACK message in step 5 above, it doesn’t know the gateway router’s MAC address In order to obtain the MAC address of the gateway router, Bob’s laptop will need to use the ARP protocol Bob 的電腦將包含 DNS 請求報文的數(shù)據(jù)封 裝在以太網(wǎng)幀頭中。 10. Bob’s laptop creates an ARP query message with a target IP address of (the default gateway), places the ARP message within an Ether frame with a broadcast destination address (FF:FF:FF:FF:FF:FF) and sends the Ether frame to the switch, which delivers the frame to all connected devices, including the gateway router. Bob 的電腦新建一個 ARP 查詢消息到默認網(wǎng)關(guān),并把 ARP 消息封裝在以太網(wǎng)幀進行廣播然后發(fā)送以太網(wǎng)幀到交換機,交換機傳 幀到直連的設(shè)備,包括默認網(wǎng)關(guān)。 12. Bob’s laptop receives the frame containing the ARP reply message and extracts the MAC address of the gateway router (00:22:6B:45:1F:1B) from the ARP reply message. Bob 的電腦接收包含 ARP 請求報文的幀并從 ARP 請求報文中提取網(wǎng)關(guān)路由器的 MAC 地址。 14. The gateway router receives the frame and extracts the IP datagram containing the DNS query. The router looks up the destination address of this datagram () and determines from its forwarding table that the datagram should be sent to the leftmost router in the Comcast work in Figure . The IP datagram is placed inside a linklayer frame appropriate for the link connecting the school’s router to the leftmost Comcast router and the frame is sent over this link. 網(wǎng)關(guān)路由器接收數(shù)據(jù)幀并提取包含 DNS 查詢報文的 IP 報文段。 16. Eventually the IP datagram containing the DNS query arrives at the DNS server. The DNS server extracts the DNS query message, looks up the name in its DNS database, and finds the DNS resource record that contains the IP address () for . (assuming that it is currently cached in the DNS server). Recall that this cached data originated in the authoritative DNS server for . The DNS server forms a DNS reply message containing this hostnametoIP address mapping, and places the DNS reply message in a UDP segment, and the segment within an IP datagram addressed to Bob’s laptop (). This datagram will be forwarded back through the Comcast work to the school’s router and from there, via the Ether switch to Bob’s laptop. 最后包含 DNS 查詢報文的 IP 數(shù)據(jù)報到達 DNS 服務(wù)器。 17. Bob’s laptop extracts the IP address of the server from the DNS message. Finally, after a lot of work, Bob’s laptop is now ready to contact the server. Bob 的電腦從 DNS 回復(fù)報文中提 取谷歌服務(wù)器的 IP 地址。 因此 Bob 的電腦第一次必須創(chuàng)建 TCP SYN 報文段到 HTTP 服務(wù)器,封裝數(shù)據(jù)報到幀頭中然后發(fā)送到目的 MAC 為網(wǎng)關(guān)路由器的接口然后發(fā)送幀到交換機。 TCP SYN 消息被提取出來從該報文段中然后分用到和歡迎套接字綁定的 80 號端口。 數(shù)據(jù)報被分用到 OS 之前創(chuàng)建的 TCP 套接字 ,進行匹配。 23. The HTTP server at reads the HTTP GET message from the TCP socket, creates an HTTP response message, places the requested web page content in the body of the HTTP response message, and sends the message into the TCP socket. 谷歌的 HTTP 服務(wù)器從 TCP 套接字中讀 GET 消息,然后創(chuàng)建 HTTP 回應(yīng)報文,該報文封裝在HTTP 回復(fù)報文的網(wǎng)頁主體內(nèi),然后在發(fā)送消息到 TCP 套接字。