【正文】
26。Bob的web瀏覽器程序讀取HTTP回復(fù)報(bào)文從套接字,然后從HTTP響應(yīng)報(bào)文段的主體部分提取網(wǎng)頁的html程序,最后顯示網(wǎng)頁。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)報(bào)文,該報(bào)文封裝在HTTP回復(fù)報(bào)文的網(wǎng)頁主體內(nèi),然后在發(fā)送消息到TCP套接字。HTTP GET消息寫進(jìn)套接字,和GET消息一起變成TCP報(bào)文段的有效載荷的一部分。數(shù)據(jù)報(bào)被分用到OS之前創(chuàng)建的TCP套接字,進(jìn)行匹配。一個(gè)TCP SYN ACK 報(bào)文產(chǎn)生封裝在數(shù)據(jù)報(bào)中發(fā)送到Bob的電腦,最后封裝成鏈路層數(shù)據(jù)幀鏈接谷歌的第一跳路由器。TCP SYN消息被提取出來從該報(bào)文段中然后分用到和歡迎套接字綁定的80號端口。調(diào)用這些路由轉(zhuǎn)發(fā)表的進(jìn)入接口,支配數(shù)據(jù)包在域內(nèi)和域外轉(zhuǎn)發(fā)使用的是BGP邊界網(wǎng)關(guān)路由協(xié)議。因此Bob的電腦第一次必須創(chuàng)建TCP SYN報(bào)文段到HTTP服務(wù)器,封裝數(shù)據(jù)報(bào)到幀頭中然后發(fā)送到目的MAC為網(wǎng)關(guān)路由器的接口然后發(fā)送幀到交換機(jī)。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消息到谷歌服務(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ù)報(bào)文中提取谷歌服務(wù)器的IP地址。DNS服務(wù)器形成一個(gè)DNS回復(fù)報(bào)文,其中包含主機(jī)名到地址的映射,封裝之后發(fā)到Bob的電腦上。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 network to the school’s router and from there, via the Ethernet switch to Bob’s laptop. 最后包含DNS查詢報(bào)文的IP數(shù)據(jù)報(bào)到達(dá)DNS服務(wù)器。IP數(shù)據(jù)報(bào)被放置在鏈路層幀中通過連接到學(xué)校路由器進(jìn)行發(fā)送。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 network 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查詢報(bào)文的IP報(bào)文段。注意在這個(gè)幀的IP報(bào)文段中有目的IP為DNS Server的IP,目的MAC為網(wǎng)關(guān)路由器的MAC。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請求報(bào)文的幀并從ARP請求報(bào)文中提取網(wǎng)關(guān)路由器的MAC地址。網(wǎng)關(guān)路由器因此準(zhǔn)備回復(fù)ARP請求,表明它的MAC地址00:22:6B:45:1F:。10. Bob’s laptop creates an ARP query message with a target IP address of (the default gateway), places the ARP message within an Ethernet frame with a broadcast destination address (FF:FF:FF:FF:FF:FF) and sends the Ethernet frame to the switch, which delivers the frame to all connected devices, including the gateway router. Bob的電腦新建一個(gè)ARP查詢消息到默認(rèn)網(wǎng)關(guān),并把ARP消息封裝在以太網(wǎng)幀進(jìn)行廣播然后發(fā)送以太網(wǎng)幀到交換機(jī),交換機(jī)傳幀到直連的設(shè)備,包括默認(rèn)網(wǎng)關(guān)。然而即使Bob的電腦可以通過DHCP ,但還是無法知道其MAC地址。DNS報(bào)文被封裝在UDP數(shù)據(jù)報(bào)中,目的端口號為53.,9. Bob’s laptop then places the datagram containing the DNS query message in an Ethernet frame. This frame will be sent (addressed, at the link layer) to the gateway router in bob’s school’s network. 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 addressIn order to obtain the MAC address of the gateway router, Bob’s laptop will need to use the ARP protocolBob的電腦將包含DNS請求報(bào)文的數(shù)據(jù)封裝在以太網(wǎng)幀頭中。我們學(xué)習(xí)的DNS協(xié)議就是用來提供這這種名字到IP地址翻譯的服務(wù)。Bob的瀏覽器開始通過創(chuàng)建一個(gè)被用來發(fā)送HTTP請求道谷歌首頁的TCP socket進(jìn)程。注意只有最后兩個(gè)DHCP步驟在第四章中提出的四個(gè)步驟實(shí)際上是必要的。Bob的電腦開始發(fā)送帶有目的地址的數(shù)據(jù)報(bào)到默認(rèn)網(wǎng)關(guān)。然后Bob的DHCP客戶端記錄它的IP地址和DNS服務(wù)器的IP地址。因?yàn)榻粨Q機(jī)有自我學(xué)習(xí)的功能,所以在之前接收到從Bob發(fā)來的DHCP請求幀,交換機(jī)就知道轉(zhuǎn)發(fā)幀從接收請求幀的那個(gè)端口發(fā)送DHCP ACK 到MAC地址為00:16:D3:23:68:8A。以太網(wǎng)幀有一個(gè)連接在路由器接口源MAC地址00:22:6B:45:1F:1B和Bob電腦的目的MAC地址00:16:D3:23:68:8A。DHCP服務(wù)器產(chǎn)生一個(gè)ACK報(bào)文其中包含這個(gè)IP地址,也包含DNS服務(wù)器的IP((),默認(rèn)網(wǎng)關(guān)的IP()。在這個(gè)例子中學(xué)校里面使用的IP的地址也是電線公司分配的地址塊當(dāng)中的地址。此時(shí)DHCP服務(wù)器擁有了DHCP請求報(bào)文。4. The router receives the broadcast Ethernet frame containing the DHCP request on its interface with MAC address 00:22:6B:45:1F:1B and the IP datagram is extracted from the Ethernet frame. The datagram’s broadcast IP destination address indicates that this IP datagram should be processed by upper layer protocols at this node, so the datagram’s payload (a UDP segment) is thus demultiplexed up to UDP, and the DHCP request message is extracted from the UDP segment. The DHCP server now has the DHCP request message.路由器用接口MAC地址為00:22:6B:45:1F:1B接收包含DHCP請求報(bào)文的廣播以太網(wǎng)幀,然后從以太網(wǎng)幀中提取IP報(bào)文。以太網(wǎng)幀的默認(rèn)目的MAC地址為FF:FF:FF:FF:FF:FF,以至于以太網(wǎng)幀能廣播到連接在交換機(jī)(準(zhǔn)確的說應(yīng)該是DHCP服務(wù)器)的全部設(shè)備上,然后幀的源MAC地址是Bob的電腦:00:16:D3:23:68:8A.3. The broadcast Ethernet frame containing the DHCP request is the first frame sent by Bob’s laptop to the Ethernet switch. The switch broadcasts the ining frame on all outgoing port