【正文】
tination 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)關路由器接收數(shù)據(jù)幀并提取包含 DNS 查詢報文的 IP 報文段。 路由器查看目的 IP ,然后檢查它的轉(zhuǎn)發(fā)表,上圖中最左邊的路由器。 IP 數(shù)據(jù)報被放置在鏈路層幀中通過連接到學校路由器進行發(fā)送。 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)絡上 接收數(shù)據(jù)幀,提取 IP 報文段,檢查報文的目 的 IP 地址,檢查從路由器的轉(zhuǎn)發(fā)表發(fā)送數(shù)據(jù)報到 DNS 服務器的合適的接口,轉(zhuǎn)發(fā)表通過域內(nèi)網(wǎng)關協(xié)議和邊界網(wǎng)關協(xié)議來進行填充。 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 服務器。 DNS 服務器提取 DNS 查詢報文,在 DNS數(shù)據(jù)庫中查找谷歌域名,找到包含谷歌 IP 地址的 DNS25 源記錄(假設該地址被放到 DNS 服務器的緩沖區(qū)中) 調(diào)用這些緩存數(shù)據(jù)起源于 認證的 DNS 服務器。 DNS 服務器形成一個 DNS 回復報文,其中包含主機名到地址的映射,封裝之后 發(fā)到 Bob 的電腦上。 這個報文將被轉(zhuǎn)發(fā)通過電信網(wǎng)絡到學校路由器,然后在通過以太網(wǎng)交換機到 Bob 的電腦。 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 回復報文中提 取谷歌服務器的 IP 地址。 最后,經(jīng)過許多工作之后, Bob 的電腦準備連接谷歌服務器。 18. Now that Bob’s laptop has the IP address of , it can create the TCP socket that will be used to send the HTTP GET message to . When Bob creates the TCP socket, the TCP in Bob’s laptop must first perform a threeway handshake with the TCP in . Bob’s laptop thus first create a TCP SYN segment with destination port 80 (for HTTP), places the datagram inside a frame with a destination MAC address of 00:22:6B:45: 1F:1B (the gateway router) and sends the frame to the switch. 現(xiàn)在 Bob的電腦谷歌的 IP,然后就能通過創(chuàng)建 TCP套接字來發(fā)送 HTTP GET 消息到谷歌服務器。 當 Bob 創(chuàng)建 TCP 套接字, TCP 連接第一次必須和谷歌服務器執(zhí)行三次握手。 因此 Bob 的電腦第一次必須創(chuàng)建 TCP SYN 報文段到 HTTP 服務器,封裝數(shù)據(jù)報到幀頭中然后發(fā)送到目的 MAC 為網(wǎng)關路由器的接口然后發(fā)送幀到交換機。 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. 學校網(wǎng)絡上的路由器,電信網(wǎng)絡和谷歌所在網(wǎng)絡的路由器都使用各自的轉(zhuǎn)發(fā)表負責轉(zhuǎn)發(fā)包含TCP SYN 的報文到谷歌服務器。 調(diào)用這些路由轉(zhuǎn)發(fā)表的進入接口,支配數(shù)據(jù)包在域內(nèi)和域外轉(zhuǎn)發(fā)使用的是 BGP 邊界網(wǎng)關路由協(xié)議。 20. Eventually, the datagram containing the TCP SYN arrives at . The TCP SYN message is extracted from the datagram and demultiplexed to the wele socket associated with port 80. A connection socket is created for the TCP connection between the Google HTTP server and Bob’s laptop. A TCP SYNACK segment is generated, placed inside a datagram addressed to Bob’s laptop, and finally placed inside a linklayer frame appropriate for the link connecting to its firsthop router. 最終,包含 TCP SYN 的報文段 到達谷歌服務器。 TCP SYN 消息被提取出來從該報文段中然后分用到和歡迎套接字綁定的 80 號端口。 這樣,一個在 googleHTTP 服務器和 Bob 電腦上的 TCP 鏈接套接字就被創(chuàng)建成功了。 一個 TCP SYN ACK 報文產(chǎn)生封裝在數(shù)據(jù)報中發(fā)送到 Bob 的電腦,最后封裝成鏈路層數(shù)據(jù)幀鏈接谷歌的第一跳路由器。 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 的報文段在通過層層轉(zhuǎn)發(fā)到 Bob 的電腦上。 數(shù)據(jù)報被分用到 OS 之前創(chuàng)建的 TCP 套接字 ,進行匹配。 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 的電腦就可以準備發(fā)送字節(jié)到谷歌, Bob 的瀏覽器創(chuàng)建 HTTP GET 消息進行訪問,其中使用 URL。 HTTP GET 消息寫進套接字,和 GET 消息一起變成 TCP 報文段的有效載荷的一部分。 TCP 報文段被封裝在數(shù)據(jù)報中然 后發(fā)送傳輸?shù)焦雀瑁M行的是 1820 部分。 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 服務器從 TCP 套接字中讀 GET 消息,然后創(chuàng)建 HTTP 回應報文,該報文封裝在HTTP 回復報文的網(wǎng)頁主體內(nèi),然后在發(fā)送消息到 TCP 套接字。 24. The datagram containing the HTTP reply message is forwarded through the Google, Comcast, and school works, and arrives at Bob’s laptop. Bob’s web browser program reads the HTTP response from the socket, extracts the html for the web page from the body of the HTTP response, and finally (finally!) displays the web page! 這個包含有 HTTP 回復消息的數(shù)據(jù)報通過層層轉(zhuǎn)發(fā)到 Bob 的電腦。 Bob 的 web 瀏覽器程序讀取 HTTP 回復報文從套接字,然后從 HTTP 響應報文段的主體部分提取網(wǎng)頁的 html 程序,最后顯示網(wǎng)頁。 四、 總結 本次計算機網(wǎng)絡的課程設計收獲頗多,總體總結下來可以有以下幾點收獲和體會。