【正文】
15. The leftmost router in the Comcast work ? receives the frame, ? extracts the IP datagram, ? examines the datagram’s destination address () and ? determines the outgoing interface on which to forward the datagram towards the DNS server from its forwarding table, which has been filled in by Comcast’s intradomain protocol (such as RIP, OSPF, or ISIS) as well as the Inter’s interdomain protocol, BGP. 最左邊的路由器在電信公司的網(wǎng)絡(luò)上 接收數(shù)據(jù)幀,提取 IP 報(bào)文段,檢查報(bào)文的目 的 IP 地址,檢查從路由器的轉(zhuǎn)發(fā)表發(fā)送數(shù)據(jù)報(bào)到 DNS 服務(wù)器的合適的接口,轉(zhuǎn)發(fā)表通過(guò)域內(nèi)網(wǎng)關(guān)協(xié)議和邊界網(wǎng)關(guān)協(xié)議來(lái)進(jìn)行填充。 當(dāng) Bob 創(chuàng)建 TCP 套接字, TCP 連接第一次必須和谷歌服務(wù)器執(zhí)行三次握手。 21. The datagram containing the TCP SYNACK segment is forwarded through the Google, Comcast, 26 and school works, eventually arriving at the Ether card in Bob’s laptop. The datagram is demultiplexed within the operating system to the TCP socket created in step 18, which enters the connected state. 該包含 TCP SYN ACK 的報(bào)文段在通過(guò)層層轉(zhuǎn)發(fā)到 Bob 的電腦上。 四、 總結(jié) 本次計(jì)算機(jī)網(wǎng)絡(luò)的課程設(shè)計(jì)收獲頗多,總體總結(jié)下來(lái)可以有以下幾點(diǎn)收獲和體會(huì)。 22. With the socket on Bob’s laptop now (finally) ready to send bytes to , Bob’s browser creates the HTTP GET message containing the URL to be fetched. The HTTP GET message is then written into the socket, with the GET message being the payload of a TCP segment. The TCP segment is placed in a datagram and sent and delivered to as in steps 18- 20 above. 有了連接套接字 Bob 的電腦就可以準(zhǔn)備發(fā)送字節(jié)到谷歌, Bob 的瀏覽器創(chuàng)建 HTTP GET 消息進(jìn)行訪問(wèn),其中使用 URL。 19. The routers in the school work, Comcast’s work, and Google’s work forward the datagram containing the TCP SYN towards , using the forwarding table in each router, as in steps 14- 16 above. Recall that the router forwarding table entries governing forwarding of packets over the interdomain link between the Comcast and Google works are determined by the BGP protocol. 學(xué)校網(wǎng)絡(luò)上的路由器,電信網(wǎng)絡(luò)和谷歌所在網(wǎng)絡(luò)的路由器都使用各自的轉(zhuǎn)發(fā)表負(fù)責(zé)轉(zhuǎn)發(fā)包含TCP SYN 的報(bào)文到谷歌服務(wù)器。 DNS 服務(wù)器提取 DNS 查詢報(bào)文,在 DNS數(shù)據(jù)庫(kù)中查找谷歌域名,找到包含谷歌 IP 地址的 DNS25 源記錄(假設(shè)該地址被放到 DNS 服務(wù)器的緩沖區(qū)中) 調(diào)用這些緩存數(shù)據(jù)起源于 認(rèn)證的 DNS 服務(wù)器。 13. Bob’s laptop can now (finally!) address the Ether frame containing the DNS query to the gateway router’s MAC address. Note that the IP datagram in this frame has an IP destination address of (the DNS server), while the frame has a destination address of 00:22:6B:45:1F:1B (the gateway router). Bob’s laptop sends this frame to the switch, which delivers the frame to the gateway router. Bob 的電腦現(xiàn)在能發(fā)送包含 DNS 查詢報(bào)文的以太網(wǎng)幀到網(wǎng)關(guān)路由器的 MAC 地址。 該數(shù)據(jù)幀將被發(fā)送到處在學(xué)校網(wǎng)絡(luò)上的默認(rèn)網(wǎng)關(guān)。 此時(shí), Bob 的電腦已經(jīng)開始初始化網(wǎng)絡(luò)部件并準(zhǔn)備開始生成并加工網(wǎng)頁(yè)。 DHCP 報(bào)文封裝在 UDP 數(shù)據(jù)報(bào)中, UDP 數(shù)據(jù)報(bào)又封裝在 IP 報(bào)文中, IP 報(bào)文封裝在以太網(wǎng)幀中進(jìn)行傳輸。 交換機(jī)廣播所有來(lái)自輸出端口的傳入幀,包括連接到路由器的端口上的。 Getting Started : DHCP ,UDP, IP, and Ether 讓我們來(lái)假設(shè) Bob 啟動(dòng)他的筆記本然后連上以太網(wǎng)連接到學(xué)校的以太網(wǎng)交換機(jī),這些交換機(jī)輪流連到學(xué)校的路由器,像上圖顯示的一樣 學(xué)校的路由器連到 ISP,如電信,電信為學(xué)校提供 DNS 服務(wù),因此, DNS服務(wù)器存在于電信聯(lián)盟的網(wǎng)絡(luò)上而不是學(xué)校網(wǎng)絡(luò)。 for(i=0。 更新 highes_uid 的值 } END { id=1。amp。 pkt_size = $6。 trace_type = $4。 } } } END{ th =8*pkt_byte_sum[i1]/(end_time[i1]start_time)/1000。amp。 pkt_size = $8。 time = $2。i++) { start=start_time[i]。amp。 to_node==0 amp。amp。 無(wú)線 trace 第 7 個(gè)字段 $7 為分組的類型 pkt_size=$8。 highest_uid 會(huì)保存一處理過(guò)的分組中最大的 uid } { event=$1。 $tcp set class_ 2 創(chuàng)建分組的接收代理對(duì)象 sink set sink [new Agent/TCPSink] 將源代理對(duì)象 tcp 綁定到節(jié)點(diǎn) 0 $ns_ attachagent $node_(0) $tcp 將接收代理對(duì)象 sink 綁定到節(jié)點(diǎn) 1 $ns_ attachagent $node_(1) $sink 在源代理對(duì)象 tcp 和接收代理對(duì)象 sink 之間建立連接 $ns_ connect $tcp $sink 在 TCP 連接上創(chuàng)建一個(gè) FTP 流 量模擬器,因?yàn)?TCP 不會(huì)產(chǎn)生自己的流量 set ftp [new Application/FTP] $ftp attachagent $tcp 在 啟動(dòng) ftp 流量模擬器 $ns_ at $ftp start 模擬結(jié)束時(shí)告知節(jié)點(diǎn) for {set i 0} {$i $val(nn) } {incr i} { 在模擬結(jié)束前 ()重置節(jié)點(diǎn)中的所有對(duì)象 $ns_ at $node_($i) reset。 拓?fù)涞?X 尺寸(單位 m) set val(y) 500 。 無(wú)限信號(hào)傳輸模型 set val(if) Phy/WirelessPhy 。在 文件中輸出模擬過(guò)程中變化的值 $ns at [expr $now + $intval] Record 。將 FTP 應(yīng)用綁定 到 tcp 發(fā)送代理 $ftp set type_ FTP 。清空跟蹤緩沖區(qū) close $tracefd 。1 中國(guó)地質(zhì)大學(xué) (武漢 )計(jì)算機(jī)學(xué)院 計(jì)算機(jī)網(wǎng)絡(luò)原理 課程設(shè)計(jì)報(bào)告 姓 名: 學(xué) 號(hào): 聯(lián)系方式: 郵 件: 指導(dǎo)老師:陳 喆 二○一二年七月 2 目錄 一、 WireShark 抓包分析 TCP 三次握手和四次握手實(shí)驗(yàn) 實(shí)驗(yàn)思路 ………………………………………………………………………………...3 實(shí)驗(yàn)重點(diǎn) …………………………………………………………………………………3 實(shí)驗(yàn)內(nèi)容 …………………………………………………………………………………3 、 tcp 第一次握手 …………………………………………………………………………………3 、 tcp 第二次握手 …………………………………………………………………………………4 、 tcp 第三次握手 …………………………………………………………………………………4 、第一次請(qǐng)求數(shù)據(jù) ……………………………………………………………………………….5 、第一次回復(fù)數(shù)據(jù) ……………………………………………………………………………….5 、 tcp 斷開連接第一次握手 ………………………………………………………………….6 、 tcp 斷開連接第二次握手 ………………………………………………………………….6 、 tcp 斷開連接第三次握手 ………………………………………………………………….7 、 tcp 斷開連接第四次握手 ……………………………………...............................7 、圖形顯示 ..............................................................................................8 二、 NS2 仿真模擬真實(shí)網(wǎng)絡(luò)場(chǎng)景實(shí)驗(yàn) 有線場(chǎng)景下慢啟動(dòng) +滑動(dòng)窗口實(shí)驗(yàn) 、 tcl 文件 ……………………………………………………………………………………………..8 、 NAM 動(dòng)畫顯示 ………………………………………………………………………………….9 、 graph 流量分析 ………………………………………………………………………………..12 有線節(jié)點(diǎn)與無(wú)線節(jié)點(diǎn)的混合仿真模擬實(shí)驗(yàn) 、 tcl 文件 …………………………………………………………………………………………….12 、 NAM 動(dòng)畫顯示 …………………………………………………………………………………15 、 awk 文件分析 …………………………………………………………………………………..15 、 graph 流量分析 ………………………………………………………………………………..19 無(wú)線節(jié)點(diǎn)移動(dòng)仿真模擬(自己的成果) 、 tcl 文件 …………………………………………………………………………………………….20 、 NAM 動(dòng)畫顯示 …………………………………………………………………………………24 三、 E to C Translation…………………………………………………………………………………25 四、總結(jié) …………………………………………………………………………………………………………….32 3 一、 WireShark 抓包分析 TCP 三次握手實(shí)驗(yàn) 實(shí)驗(yàn)思路: 啟動(dòng) WireShark 抓包 、訪問(wèn)學(xué)校主頁(yè)服務(wù)器,通過(guò) WireShark 捕獲通信內(nèi)容 、分析 TCP 連接建立的三次握手和連接釋放的四次握手過(guò)程 實(shí)驗(yàn)重點(diǎn) : 、瀏覽網(wǎng)頁(yè),抓取三次我輸?shù)陌?,并根?jù) TCP 包頭格式記錄各字段取值情況 、 TCP 包頭格式如下 : 實(shí)驗(yàn)內(nèi)容: 、第一次握手: 找出第一次握手的數(shù)據(jù)包并截取對(duì)該數(shù)據(jù)包的展開圖,根據(jù)截圖填寫相關(guān)內(nèi)容,具體見下面的描述: Source IP: Destination IP: Source port: 50915