计算机网络课后习翘指导 陕西师范大学 0.0567 1-49=1-0.9×0.4=0.089s 通过因特网访问一个对象所需要的时间为:3+0.089=3.089s,本地机构服务满足40%的 对象请求, 访问时间为0 因特网满足60%,时间为3.1235则总响应时间为 0.4×3.089+0.6×0≈124s 由计算可知,在安装了缓存器之后,一个对象总平均响应时间由3.567s减少到了1245,提高 了效率 P10.Consider a short,10-meter link,over which a sender can transmit at a rate of 150 bits/see in both directions.Suppose that packets containing data are 100.000 bits long.and packets containing only control (e.g..ACK or hand-shaking)are 200 bits long.Assume that N parallel connections each get 1/N of the link bandwidth.Now consider the HTTP protocol,and suppose that each downloaded object is1 Kbits long and that the initial downloaded object contains referenced objects from the same sender.Would parallel downloads via parallel instances of non-persistent HTTP make sense in this case?Now consider persistent HTTP Do you expect significant gains over the non-persistent case?justify and explain your answer 答:由题意可知,每下载一个对象可以完整的将一个分组投入链路,用T,表示在服务器和客 户机之间的单向传播时延 首先考虑非特久连接的并行下载 ,并行下载允许10条连接共享150bits/s c的带宽,每个是 I5bits/sec 。非持久连接并行下载包括两个部分,第一部分是:TCP三次握手以及下载整个 对象,两台主机之间建立连接:第二部分是:因为是非持久连接,在下载每 一个对象时,要 再一次进行TCP三次握手,完成请求和响应过程。因此接收所有对象所花费的时间为: (g+,++T++T,+0+T)+(。+T,+。+T,+。+T,+ w20+7))=737+87,(6 second) 现在考虑持久HTTP连接,在服务器和客户机之间的连接建立以后,无需建立新的连接,在 此连接上可以传输所有对象,花费总时间为: (+,++,+器++0+T)+10×(+,+80+)=7351+ 24Tp(seconds) 假定光的传播速度是3×108m/s,那么Tp=10m÷(3×108m/s)=0.03ms,因此传播时延 T,相对于传输时延而言,可以忽略不计。 由上面计算我们可以看出,持久的HTTP连接不是明显的比非持久的并行下载快,快的不到 1% P11.Consider the scenario introduced in the previous problem.Now suppose that the link is shared by Bob with four other users.Bob uses parallel instances of non-persistent HTTP,and the other four uersuso-persistent HTTP without paralle Do Bob'sparalleo etions help him get Web pages Whyor why no b.If all five users open five parallel instances of non-persistent HTTP,then would Bob's paralle connections still be beneficial?Why or why not? 答:a是的,因为Bob有更多的连接,他可以共享更大的链路带宽
计算机网络课后习题指导 陕西师范大学 23 ∆ 1 − ∆ = 0.0567 1 −0.9 × 0.4 = 0.089 通过因特网访问一个对象所需要的时间为:3 + 0.089 = 3.089s,本地机构服务器满足40%的 对象请求,访问时间为 0,因特网满足60%,时间为 3.123s 则总响应时间为: 0.4 × 3.089 + 0.6 × 0 ≈ 1.24s 由计算可知,在安装了缓存器之后,一个对象总平均响应时间由 3.567s 减少到了 1.24s,提高 了效率。 P10. Consider a short, 10-meter link, over which a sender can transmit at a rate of 150 bits/sec in both directions. Suppose that packets containing data are 100,000 bits long, and packets containing only control (e.g., ACK or hand- shaking) are 200 bits long. Assume that N parallel connections each get 1/N of the link bandwidth. Now consider the HTTP protocol, and suppose that each downloaded object is 100 Kbits long, and that the initial downloaded object contains 10 referenced objects from the same sender. Would parallel downloads via parallel instances of non-persistent HTTP make sense in this case? Now consider persistent HTTP. Do you expect significant gains over the non-persistent case? Justify and explain your answer. 答:由题意可知,每下载一个对象可以完整的将一个分组投入链路,用表示在服务器和客 户机之间的单向传播时延。 首先考虑非持久连接的并行下载,并行下载允许 10 条连接共享 150bits/sec 的带宽,每个是 15bits/sec。非持久连接并行下载包括两个部分,第一部分是:TCP 三次握手以及下载整个 对象,两台主机之间建立连接;第二部分是:因为是非持久连接,在下载每一个对象时,要 再一次进行 TCP 三次握手,完成请求和响应过程。因此接收所有对象所花费的时间为: + T + + T + + T + + T+ / + T + / + T + / + T + / + T = 7377+8() 现在考虑持久 HTTP 连接,在服务器和客户机之间的连接建立以后,无需建立新的连接,在 此连接上可以传输所有对象,花费总时间为: + T + + T + + T + + T+ 10 × + T + + T = 7351 + 24 () 假定光的传播速度是3 × 10m/s,那么T = 10 ÷ (3 × 10/) = 0.03,因此传播时延 T相对于传输时延而言,可以忽略不计。 由上面计算我们可以看出,持久的 HTTP 连接不是明显的比非持久的并行下载快,快的不到 1%。 P11. Consider the scenario introduced in the previous problem. Now suppose that the link is shared by Bob with four other users. Bob uses parallel instances of non-persistent HTTP, and the other four users use non-persistent HTTP without parallel downloads. a. Do Bob’s parallel connections help him get Web pages more quickly? Why or why not? b. If all five users open five parallel instances of non-persistent HTTP, then would Bob’s parallel connections still be beneficial? Why or why not? 答:a. 是的,因为 Bob 有更多的连接,他可以共享更大的链路带宽
计算机网络课后习题指导 陕西师范大学 b.Bb仍然需要执行并行下载,否则,对于其他四个用户来说,他将获得更少的链路带宽。 P12.Write a simple TCP program for a server that accepts lines of input from prints the lines onto the server's standard output.(You can do this by modifying the TCPServer.py program in the text.Compile and execute your program.On any other machine that contains a Web browser.set the proxy server in the browser to the host that is running your server program:also con-figure the port number appropriately.Your browser should now send its GET reques r serv er should display the standard ouput Use this platform to determine whether your browser generates conditional GET messages for objects that are locally cached 答:如下: TCPServer iava import j va.io. import java.net. class TCPServer public static void main(String argv)throws Exception String clientSentence et welcomeSocket new ServerSocket(6789) while(true) Socket connectionSocket welcomeSocket accept(): BufferedReader inFromClient=new BufferedReader(new InputStreamRea er(connec nSock tgetlnputStream()方 clientSentence System.out.println("RECEIVED FROM CLIENT:"+ clientSentence+n"方 P13.What is the difference between MAIL FROM:in SMTP and From:in the mail message itself? 答:SMTP中的MAIL FROM:是SMTP握手协议的一部分,是来自于客户端的消息,标识 发送到SMTP服务器的郎件消息的发送者。而邮件消息本身中的FrOm:是邮件报文实体的 部分,而不是一个SMTP消息 P14.How does SMTP mark the end of a message body?How about HTTP?Can HTTP use the same method as SMTP to mark the end of a message body?Explain. 答:SMTP用仅仅只包含时间的一行,来标记作为信息主体的末尾。HTTP用Content-Length ar®d(首部字段长度)来指出信息主体的长度。两者不能用同一样的方法米标记末尾, 因为HTTP信息可以用2进制数据来表示,然而,SMTP必须用7比特的ASC格式来表示 P15.Read RFC 5321 for SMTP.What does MTA stand for?Consider the follow-ing received spam email (modified from a real spam email).Assuming only the originator of this spam email is
计算机网络课后习题指导 陕西师范大学 24 b. Bob 仍然需要执行并行下载,否则,对于其他四个用户来说,他将获得更少的链路带宽。 P12. Write a simple TCP program for a server that accepts lines of input from a client and prints the lines onto the server’s standard output. (You can do this by modifying the TCPServer.py program in the text.) Compile and execute your program. On any other machine that contains a Web browser, set the proxy server in the browser to the host that is running your server program; also con- figure the port number appropriately. Your browser should now send its GET request messages to your server, and your server should display the messages on its standard output. Use this platform to determine whether your browser generates conditional GET messages for objects that are locally cached. 答:如下: TCPServer.java import java.io.*; import java.net.*; class TCPServer { public static void main(String argv[]) throws Exception { String clientSentence; ServerSocket welcomeSocket = new ServerSocket(6789); while(true) { Socket connectionSocket = welcomeSocket.accept(); BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream( ) ) ); clientSentence = inFromClient.readLine(); System.out.println(“RECEIVED FROM CLIENT : ” + clientSentence + “\n”); } } } P13. What is the difference between MAIL FROM: in SMTP and From: in the mail message itself? 答:SMTP 中的 MAIL FROM:是 SMTP 握手协议的一部分,是来自于客户端的消息,标识 发送到 SMTP 服务器的邮件消息的发送者。而邮件消息本身中的 From:是邮件报文实体的 一部分,而不是一个 SMTP 消息。 P14. How does SMTP mark the end of a message body? How about HTTP? Can HTTP use the same method as SMTP to mark the end of a message body? Explain. 答:SMTP 用仅仅只包含时间的一行,来标记作为信息主体的末尾。HTTP 用“Content-Length header field (首部字段长度) ”来指出信息主体的长度。两者不能用同一样的方法来标记末尾, 因为 HTTP 信息可以用 2 进制数据来表示,然而,SMTP 必须用 7 比特的 ASCII 格式来表示。 P15. Read RFC 5321 for SMTP. What does MTA stand for? Consider the follow- ing received spam email (modified from a real spam email). Assuming only the originator of this spam email is
计算机网络课后习翘指导 陕西师范大学 malacious and all other hosts are honest,identify the malacious host that has generated this spam email. Fom-Fri Nov071341:302008 Return-Path:<tennis5@pp33head.com> Received:from barmail.cs.umass.edu (barmail.cs.umass.edu [128.119.240.3])by cs.umass.edu (8.13.1/8.12.6)for<hg @cs umass edu>:Fri.7Nov200813:27:10-0500 Received:from asusus-4b9(localhost [170.0.1)by barmail.cs.umass.edu(Spam Firewall)for hg@cs.umass.:27:07-0500(EST) Received:from asusus-4b96 ([58.88.21.177])by barmail.cs.umass.edu for <hg@cs umass edu> Fri.07Nov200813:27:07-0500ESD Received:from [58.88.21.177]by inbnd55.exchangeddd.com:Sat,8 Nov 200801:2707+0700 From:"Jonny"stennis5@pp33head com To.he@cs uma .edu Subject:How to secure your savings 答:MTA指Mail Transfer Agent”,一个主机将报文信息发送给MTA,然后这个信息在大量 的MAT报文处有一个序号,以使到达接收方的邮箱。我们看到这个TA报文限随在一连 串MTA报文后面。一个有信用的MTA应该报告它在何处 收到这个MTA。在这个报文中我 们注意到 “asusu b96([5 .88.21.17 没有报告它在何处 到这份电子邮件 们仅仅认为这份邮件的发起者是不诚实的,因此“susus--4b96I58.88.21.177列”一定是发起者 P16.Read the POP3 RFC.RFC 1939.What is the purpose of the UIDL POP3 command? 答:UDL是唯一识别码列表的缩写.当一个POP3客户端发出一个UIDL命令,服务器返 回储存在用户邮箱里的所有邮件的唯一邮件识别码。这个命令对下载并保留方式有用。通过 保留上次收取的邮件的列表信息,客户能够使用UD ,命令来确定在服务器上的哪些邮 是已经被阅读过的。 注: UIDL POP3命令格式:UIDLImsgl 【参数】信件数(可选)。如果给出信件数,不包括被标记为删除的信件 【限制】仅在"操作状态下使用。 【说明】 如果给出了参数,且POP3服务器返回包括上述信息的"确认",此行称为信息的"独立-D”。 如果没有参数,服务器返回“确认"响应,此响应便以多行给出。在最初的+O水后,对于每 个信件,服务器均给出相应的响应。此行叫做信件的独立-D表”。为简化语法分析,所有 服务器要求使用独 表的特定格式。 它包括 格和信件的 立-D.信件的独立-D由 0x21到0x7E字符组成,这个符号在给定的存储邮件中不会重复 P17.Consider accessing your e-mail with POP3. a.Suppose your POP mail download-and-delete mode Complete the following transactio C:list S:1498
计算机网络课后习题指导 陕西师范大学 25 malacious and all other hosts are honest, identify the malacious host that has generated this spam email. From - Fri Nov 07 13:41:30 2008 Return-Path: <tennis5@pp33head.com> Received: from barmail.cs.umass.edu (barmail.cs.umass.edu [128.119.240.3]) by cs.umass.edu (8.13.1/8.12.6) for <hg@cs.umass.edu>; Fri, 7 Nov 2008 13:27:10 -0500 Received: from asusus-4b96 (localhost [127.0.0.1]) by barmail.cs.umass.edu (Spam Firewall) for <hg@cs.umass.edu>; Fri, 7 Nov 2008 13:27:07 -0500 (EST) Received: from asusus-4b96 ([58.88.21.177]) by barmail.cs.umass.edu for <hg@cs.umass.edu>; Fri, 07 Nov 2008 13:27:07 -0500 (EST) Received: from [58.88.21.177] by inbnd55.exchangeddd.com; Sat, 8 Nov 2008 01:27:07 +0700 From: "Jonny" <tennis5@pp33head.com> To: <hg@cs.umass.edu> Subject: How to secure your savings 答:MTA 指“Mail Transfer Agent”。一个主机将报文信息发送给 MTA,然后这个信息在大量 的 MAT 报文处有一个序号,以便到达接收方的邮箱。我们看到这个 MTA 报文跟随在一连 串 MTA 报文后面。一个有信用的 MTA 应该报告它在何处收到这个 MTA。在这个报文中我 们注意到,“asusus-4b96 ([58.88.21.177])”,它没有报告它在何处收到这份电子邮件,因此我 们仅仅认为这份邮件的发起者是不诚实的,因此“asusus-4b96 ([58.88.21.177])”一定是发起者。 P16. Read the POP3 RFC, RFC 1939. What is the purpose of the UIDL POP3 command? 答:UIDL 是唯一识别码列表的缩写。当一个 POP3 客户端发出一个 UIDL 命令,服务器返 回储存在用户邮箱里的所有邮件的唯一邮件识别码。这个命令对下载并保留方式有用。通过 保留上次收取的邮件的列表信息,客户能够使用 UIDL 命令来确定在服务器上的哪些邮件 是已经被阅读过的。 注: UIDL POP3 命令格式: •UIDL[msg] 【参数】信件数(可选)。如果给出信件数,不包括被标记为删除的信件。 【限制】仅在"操作"状态下使用。 【说明】 如果给出了参数,且 POP3 服务器返回包括上述信息的"确认",此行称为信息的"独立-ID"。 如果没有参数,服务器返回"确认"响应,此响应便以多行给出。在最初的+OK 后,对于每 个信件,服务器均给出相应的响应。此行叫做信件的"独立-ID 表"。为简化语法分析,所有 服务器要求使用独立-ID 表的特定格式。它包括空格和信件的独立-ID。信件的独立-ID 由 0x21 到 0x7E 字符组成,这个符号在给定的存储邮件中不会重复。 P17. Consider accessing your e-mail with POP3. a. Suppose you have configured your POP mail client to operate in the download-and-delete mode. Complete the following transaction: C: list S: 1 498
计算机网络课后习题指导 陕西师范大学 S2912 c retr blah blahS…blahS: b.Suppose you have configured your POP mail client to operate in the download-and-keep mode Complete the following transaction C:list S:1498 S:2912 C:retr 1 S:blah blah…S:blah S: c.Suppose you have configured your POP mail client to operate in the download-and-keep mode Using your transcript in part (b).suppose you retrieve messages I and 2,exit POP,and then five minutes later you again access POP to retrieve new e-mail.Suppose that in the five-minute inter- val no new messages have been sent to you Provide a transcript of this second POP session. 答:a如下: C:dele C:retr 2 S:(blah blah S:.ah) g. C:dele2 C:quit S:+OK POP3 server signing off b.如下: C:retr 2 S:blah blah S:.....ah S:. C:quit S:+OK POP3 server signing off c.如下: C:list S:1498 S:2912 S:
计算机网络课后习题指导 陕西师范大学 26 S: 2 912 S: . C: retr 1 S: blah blah ... S: ..........blah S: . ? ? b. Suppose you have configured your POP mail client to operate in the download-and-keep mode. Complete the following transaction: C: list S: 1 498 S: 2 912 S: . C: retr 1 S: blah blah ... S: ..........blah S: . ? ? c. Suppose you have configured your POP mail client to operate in the download-and-keep mode. Using your transcript in part (b), suppose you retrieve messages 1 and 2, exit POP, and then five minutes later you again access POP to retrieve new e-mail. Suppose that in the five-minute interval no new messages have been sent to you. Provide a transcript of this second POP session. 答:a. 如下: C: dele 1 C: retr 2 S: (blah blah … S: ………..blah) S: . C: dele 2 C: quit S: +OK POP3 server signing off b. 如下: C: retr 2 S: blah blah … S: ………..blah S: . C: quit S: +OK POP3 server signing off c. 如下: C: list S: 1 498 S: 2 912 S:
计算机网络课后习题指导 陕西师范大学 C:retr l S:blah. S:.blah C:retr 2 S:blah blah 8 ..blah C:quit S:+OK POP3 server signing off P18 a What is a whois database? b.Use various whois databases on the Interet namesof DNSserver Indicate ich whois databas ses you used c.Use nslookup on your local host to send DNS queries to three DNS servers:your local DNS server and the two DNS servers you found in part(b).Try querving for Type A.NS.and MX reports.Summarize your findings. d.Use nslookup to find a Web server that has multiple IP addresses.Does the Web server of you mpany)hav e.Use the N whois d se to determine the IP address range used by your university. f.Describe how an attacker can use whois databases and the nslookup tool to perform reconnaissance on an institution before launching an attack e Discuss why whois databases should be publicly available 答:a对于一个给定的域名,P地址或网络管理员名的输入,whos数据库能被用来定位 相应的登记人, 服务器, NS服务器等 b.获得两台 DNS服务器的名字 NS4.YAHOO.COM 从 wr心gister.com得到 NSI.MSFT.NET从wnw.register.com得到. c.Local Domain:www.mindspring.com Web servers:www.mindspring com 207.69.18921,207.69.189.22 207.69.189.23,207.69.189.24 207.69.189.25,207.69.189.26,207.69.18927, 207.69.189.28 Mail Servers:mxl.mindspring.com(207.69.189.217) mx3.mindspring.com(20769.189.219 mx4.mindspring.com(207.69.189.220) Name Servers:itchy.earthlink net (207.69.188.196) scratchy.earthlink net (207.69.188.197) www.yahoo.com Web Servers::www.yahoo.com(2I6.109.112.135,66.94234.13) Mail Servers:a.mx.mail.yahoo.com(209.191.118.103) b.mx.mail.yahoo.com(66.196.97.250) 之
计算机网络课后习题指导 陕西师范大学 27 C: retr 1 S: blah ….. S: ….blah S: . C: retr 2 S: blah blah … S: ………..blah S: . C: quit S: +OK POP3 server signing off P18. a. What is a whois database? b. Use various whois databases on the Internet to obtain the names of two DNS servers. Indicate which whois databases you used. c. Use nslookup on your local host to send DNS queries to three DNS servers: your local DNS server and the two DNS servers you found in part (b). Try querying for Type A, NS, and MX reports. Summarize your findings. d. Use nslookup to find a Web server that has multiple IP addresses. Does the Web server of your institution (school or company) have multiple IP addresses? e. Use the ARIN whois database to determine the IP address range used by your university. f. Describe how an attacker can use whois databases and the nslookup tool to perform reconnaissance on an institution before launching an attack. g. Discuss why whois databases should be publicly available. 答:a. 对于一个给定的域名,IP 地址或网络管理员名的输入,whois 数据库能被用来定位 相应的登记人,whois 服务器,DNS 服务器等。 b. 获 得 两 台 DNS 服 务 器 的 名 字 : NS4.YAHOO.COM 从 www.register.com 得 到 ; NS1.MSFT.NET 从 www.register.com 得到。 c.Local Domain: www.mindspring.com Web servers : www.mindspring.com 207.69.189.21, 207.69.189.22, 207.69.189.23, 207.69.189.24, 207.69.189.25, 207.69.189.26, 207.69.189.27, 207.69.189.28 Mail Servers : mx1.mindspring.com (207.69.189.217) mx2.mindspring.com (207.69.189.218) mx3.mindspring.com (207.69.189.219) mx4.mindspring.com (207.69.189.220) Name Servers: itchy.earthlink.net (207.69.188.196) scratchy.earthlink.net (207.69.188.197) www.yahoo.com Web Servers: www.yahoo.com (216.109.112.135, 66.94.234.13) Mail Servers: a.mx.mail.yahoo.com (209.191.118.103) b.mx.mail.yahoo.com (66.196.97.250)