计算机网络-自顶向下方法(7th) 第二章 Problems 英文题目+中文答案

P1.

True or false?
a. A user requests a Web page that consists of some text and three images. For this page, the client will send one request message and receive four response messages.
b. Two distinct Web pages (for example, www.mit.edu/research.html and www.mit.edu/students.html) can be sent over the same persistent connection.
c. With nonpersistent connections between browser and origin server, it is possible for a single TCP segment to carry two distinct HTTP request messages.
d. The Date: header in the HTTP response message indicates when the object in the response was last modified.
e. HTTP response messages never have an empty message body

答案:
FTFFF
a, 在建立连接后,只需要发送一个请求报文和一个响应报文
b, 两个地址的主机是相同的
c, 不能。(TCP的请求和应答是一对一的, 不可以一次请求两个)
d, Date是响应报文的时间。
e,可以是空的。(初次建立连接时)

P2

SMS, iMessage, and WhatsApp are all smartphone real-time messaging systems. After doing some research on the Internet, for each of these systems write one paragraph about the protocols they use. Then write a paragraph explaining how they differ.

答案略

P3.

Consider an HTTP client that wants to retrieve a Web document at a given URL. The IP address of the HTTP server is initially unknown. What transport and application-layer protocols besides HTTP are needed in this scenario?

答案:
应用层协议:DNS和HTTP
传输层协议:UDP(用于DNS) 和 TCP (用于HTTP)

P4.

Consider the following string of ASCII characters that were captured by Wireshark when the browser sent an HTTP GET message (i.e., this is the actual content of an HTTP GET message). The characters are carriage return and line-feed characters (that is, the italized character string in the text below represents the single carriage-return character that was contained at that point in the HTTP header). Answer the following questions, indicating where in the HTTP GET message below you find the answer.

		GET /cs453/index.html HTTP/1.1Host: gai
		a.cs.umass.eduUser-Agent: Mozilla/5.0 (
		Windows;U; Windows NT 5.1; en-US; rv:1.7.2) Gec
		ko/20040804 Netscape/7.2 (ax) Accept:ex
		t/xml, application/xml, application/xhtml+xml, text
		/html;q=0.9, text/plain;q=0.8, image/png,*/*;q=0.5
		Accept-Language: en-us, en;q=0.5Accept-
		Encoding: zip, deflateAccept-Charset: ISO
		-8859-1, utf-8;q=0.7,*;q=0.7Keep-Alive: 300
		Connection:keep-alive

a. What is the URL of the document requested by the browser?
b. What version of HTTP is the browser running?
c. Does the browser request a non-persistent or a persistent connection?
d. What is the IP address of the host on which the browser is running?
e. What type of browser initiates this message? Why is the browser type needed in an HTTP request message?

答案:
a, url:gaia.cs.umass.edu, 从Host字段得出。
b, 1.1
c, 不是。 Connection:keep-alive
d, 报文段中找不到。
e, Mozilla/5.0 (Windows;U; Windows NT 5.1; en-US; rv:1.7.2)。 服务器也许会为不同的浏览器返回不同的信息(以达到更好的浏览效果)

P5.

The text below shows the reply sent from the server in response to the HTTP GET message in the question above. Answer the following questions, indicating where in the message below you find the answer.

		HTTP/1.1 200 OKDate: Tue, 07 Mar 2008
		12:39:45GMTServer: Apache/2.0.52 (Fedora)
		Last-Modified: Sat, 10 Dec2005 18:27:46
		GMTETag: ”526c3-f22-a88a4c80”Accept-
		Ranges: bytesContent-Length: 3874
		Keep-Alive: timeout=max=100Connection:
		Keep-AliveContent-Type: text/html; charset=
		ISO-8859-1
		   CMPSCI 453 / 591 /
		NTU-ST550ASpring 2005 homepage
		

a. Was the server able to successfully find the document or not? What time was the document reply provided?
b. When was the document last modified?
c. How many bytes are there in the document being returned?
d. What are the first 5 bytes of the document being returned? Did the server agree to a persistent connection?

答案:
a, 成功找到页面。(第一行的"OK"), 响应时间:Tue, 07 Mar 2008 12:39:45GMT
b,最后修改时间:Sat, 10 Dec2005 18:27:46 GMT
c, 3874字节
d, 前5个字节:Connection: Keep-Alive可得。

P6.

Obtain the HTTP/1.1 specification (RFC 2616). Answer the following questions:
a. Explain the mechanism used for signaling between the client and server to indicate that a persistent connection is being closed. Can the client, the server, or both signal the close of a connection?
b. What encryption services are provided by HTTP?
c. Can a client open three or more simultaneous connections with a given server?
d. Either a server or a client may close a transport connection between them if either one detects the connection has been idle for some time. Is it possible that one side starts closing a connection while the other side is transmitting data via this connection? Explain.

**答案:**略

P7.

Suppose within your Web browser you click on a link to obtain a Web page. The IP address for the associated URL is not cached in your local host, so a DNS lookup is necessary to obtain the IP address. Suppose that n DNS servers are visited before your host receives the IP address from DNS; the successive visits incur an RTT of R T T 1 , . . . , R T T n RTT_1,..., RTT_n RTT1,...,RTTn Further suppose that the Web page associated with the link contains exactly one object, consisting of a small amount of HTML text. Let R T T 0 RTT_0 RTT0 denote the RTT between the local host and the server containing the object. Assuming zero transmission time of the object, how much time elapses from when the client clicks on the link until the client receives the object?

答案:
获取到Web服务器地址: ∑ i = 1 n R T T i \sum^n_{i=1}RTT_i i=1nRTTi
请求页面: 2 R T T 0 RTT_0 RTT0
总和: ∑ i = 1 n R T T i + 2 R T T 0 \sum^n_{i=1}RTT_i+2RTT_0 i=1nRTTi+2RTT0

P8.

Referring to Problem P7, suppose the HTML file references eight very small objects on the same server. Neglecting transmission times, how much time elapses with
a. Non-persistent HTTP with no parallel TCP connections?
b. Non-persistent HTTP with the browser configured for 5 parallel connections?
c. Persistent HTTP?

答案:
a, ∑ i = 1 n R T T i + 18 R T T 0 \sum^n_{i=1}RTT_i+18RTT_0 i=1nRTTi+18RTT0
b, ∑ i = 1 n R T T i + 3 R T T 0 \sum^n_{i=1}RTT_i+3RTT_0 i=1nRTTi+3RTT0
c, ∑ i = 1 n R T T i + 10 R T T 0 \sum^n_{i=1}RTT_i+10RTT_0 i=1nRTTi+10RTT0

P9.

计算机网络-自顶向下方法(7th) 第二章 Problems 英文题目+中文答案_第1张图片
Consider Figure 2.12 , for which there is an institutional network connected to the Internet. Suppose that the average object size is 850,000 bits and that the average request rate from the institution’s browsers to the origin servers is 16 requests per second. Also suppose that the amount of time it takes from when the router on the Internet side of the access link forwards an HTTP request until it receives the response is three seconds on average (see Section 2.2.5). Model the total average response time as the sum of the average access delay (that is, the delay from Internet router to institution router) and the average Internet delay. For the average access delay, use Δ / ( 1 − Δ β ) Δ/(1-Δ\beta) Δ/(1Δβ), where Δ is the average time required to send an object over the access link and β \beta β is the arrival rate of objects to the access link.
a. Find the total average response time.
b. Now suppose a cache is installed in the institutional LAN. Suppose the miss rate is 0.4. Find the total response time

答案:
a,
Δ= 850000/15000000=0.0567
接入时延: Δ / ( 1 − Δ β ) Δ/(1-Δ\beta) Δ/(1Δβ) = 0.6s
总平均时延: 3s+0.6s = 3.6s

b,
先求接入时延。
由于有0.4的数据命中,对象的到达速率变为0.4 β \beta β, 接入时延变为 Δ / ( 1 − 0.4 Δ β ) Δ/(1-0.4Δ\beta) Δ/(10.4Δβ)=0.089s

对于cache命中的情况,因特网连接时延约为0,因特网时延为0,所以总时延约为0.
对于cache不命中的情况,总时延为3s+0.089s=3.089s

平均时延= 0.4 × 3.089 = 1.236 s 0.4\times3.089=1.236s 0.4×3.089=1.236s

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 handshaking) 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.

答案:

一个来回的传播时延接近0,不考虑

a,若使用非持续、非并行连接。建立11次TCP连接(其中有22次请求,11次控制应答)、发送11次数据包。
时间为: ( 11 × 100000 + 33 × 200 ) / 150000 = 7.377 s (11\times 100000+33\times 200)/150000=7.377s (11×100000+33×200)/150000=7.377s
b, 若使用非持续、N段并行连接。
时间为: ( ( 11 × 100000 + 33 × 200 ) / N ) / ( 150000 / N ) = 7.377 s ((11\times 100000+33\times 200)/N)/(150000/N)=7.377s ((11×100000+33×200)/N)/(150000/N)=7.377s
c, 若使用持续连接
建立1次TCP连接。
时间为 ( 11 × 100000 + 13 × 200 ) / 150000 = 7.35 s (11\times 100000+13\times 200)/150000=7.35s (11×100000+13×200)/150000=7.35s

结论:并行连接与非并行基本没有区别。
持续连接速度略高于非持续连接,但是改善程度很小。

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占有了更多的带宽。比如假如Bob打开了N个并行下载,它的吞吐量占总带宽的N/(N+4)
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 configure 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.

答案:

略。(博主正在学习Socket QAQ)

P13.

What is the difference between MAIL FROM: in SMTP and From: in the mail message itself?

答案:
SMTP中的MAIL FROM指出了邮件发送方IP地址
邮件正文中的From是邮件正文体裁的组成部分,是发送者写的。

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使用CRLF.CRLF来标记消息的结束。(也就是只包含英文句号的单独一行)
HTTP使用首部行Content-Length中的内容来识别正文长度,以此判断数据终点。
不能,因为SMTP的消息一定是ASCII码,而HTTP消息的内容是二进制编码。

P15.

Read RFC 5321 for SMTP. What does MTA stand for? Consider the following received spam e-mail (modified from a real spam e-mail). Assuming only the originator of this spam e-mail is malicious and all other hosts are honest, identify the malacious host that has generated this spam e-mail.

From - Fri Nov 07 13:41:30 2008
Return-Path: 
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
; 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 ; Fri, 7
Nov 2008 13:27:07 -0500 (EST)
Received: from asusus-4b96 ([58.88.21.177]) by barmail.cs.umass.edu
for ; 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” 
To: 
Subject: How to secure your savings

答案:

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 缩写为“ unique-ID listing”。当 POP3客户机发出 UIDL 命令时,服务器将用唯一的消息 ID 响应用户邮箱中的所有消息。这个命令对于“下载并保存”很有用。通过维护一个列出在早期会话中检索到的消息的文件,客户机可以使用 UIDL 命令来确定服务器上哪些消息已经被查看。

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
S: 2 912
S: .
C: retr 1
S: blah blah ...
S: ..........blah
S: .
?
?

答案:

     C: dele 1 
     C: retr 2 
     S: (blah blah ... 
     S: ...........blah) 
     S: . 
     C: dele 2 
     C: quit 
     S: +OK POP3 server signing off

注意点:所有在list中显示的内容都要先retr再delete,单独的英文句号标记消息的结束。

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: retr 2 
     S: blah blah ... 
     S: ...........blah 
     S: . 
     C: quit 
     S: +OK POP3 server signing off 

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

答案:

	C: list 
	S: 1 498 
	S: 2 912 
	S: . 
	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, whois就是一个用来查询域名是否已经被注册,以及注册域名的详细信息的数据库(如域名所有人、域名注册商)。
b, (可以在万网查询)
www.baidu.com:

DNS1:NS1.BAIDU.COM
DNS2:NS2.BAIDU.COM
DNS3:NS3.BAIDU.COM
DNS4:NS4.BAIDU.COM
DNS5:NS7.BAIDU.COM

aliyun.com :

DNS1:NS3.ALIYUN.COM
DNS2:NS4.ALIYUN.COM
DNS3:NS5.ALIYUN.COM

c,

> localhost
服务器:  UnKnown
Address:  10.10.10.10

非权威应答:
名称:    localhost
Addresses:  ::1
          127.0.0.1
          > www.baidu.com
服务器:  UnKnown
Address:  10.10.10.10

非权威应答:
名称:    www.a.shifen.com
Addresses:  39.156.66.14
          39.156.66.18
Aliases:  www.baidu.com

> aliyun.com
服务器:  UnKnown
Address:  10.10.10.10

非权威应答:
名称:    aliyun.com
Addresses:  2401:b180:1:50::f
          2401:b180:1:60::6
          140.205.60.46
          106.11.172.56
          106.11.172.51
          106.11.248.146
          106.11.253.83
          106.11.248.144
          106.11.249.99
          106.11.172.9
          140.205.135.3
          106.11.253.86

>

默认查询的是type=a,即查询的是address(ip地址)
当set type=mx,查询的是邮箱服务器的映射

d, 前面的两个例子都有多个address。学校的主机没有多重IP地址

e,略

f,攻击者可以使用whois数据库和nslookup工具来确定目标机构的IP地址范围、DNS服务器地址等
g,在使用域名进行Internet冲浪时,很多用户希望进一步了解域名、名字服务器的详细信息,这就会用到WHOIS。对于域名的注册服务机构(registrar)而言,要确认域名数据是否已经正确注册到域名注册中心(registry),也经常会用到WHOIS。

P19.

In this problem, we use the useful dig tool available on Unix and Linux hosts to explore the hierarchy of DNS servers. Recall that in Figure 2.19 , a DNS server in the DNS hierarchy delegates a DNS query to a DNS server lower in the hierarchy, by sending back to the DNS client the name of that lower-level DNS server. First read the man page for dig, and then answer the following questions.

a. Starting with a root DNS server (from one of the root servers [a-m].root-servers.net), initiate a sequence of queries for the IP address for your department’s Web server by using dig. Show the list of the names of DNS servers in the delegation chain in answering your query.
b. Repeat part (a) for several popular Web sites, such as google.com, yahoo.com, or amazon.com

答案:

a,
(注:所查询网址与本人无关)

root@LAPTOP-VAFH00IB:~# dig +norecurse @d.root-servers.net any www.nbut.edu.cn

; <<>> DiG 9.16.1-Ubuntu <<>> +norecurse @d.root-servers.net any www.nbut.edu.cn
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54775
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 8, ADDITIONAL: 11

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 4670da554a3dd2e7981fdf6361616e872bc92735832a6760 (good)
;; QUESTION SECTION:
;www.nbut.edu.cn.               IN      ANY

;; AUTHORITY SECTION:
cn.                     172800  IN      NS      b.dns.cn.
cn.                     172800  IN      NS      e.dns.cn.
cn.                     172800  IN      NS      ns.cernet.net.
cn.                     172800  IN      NS      g.dns.cn.
cn.                     172800  IN      NS      f.dns.cn.
cn.                     172800  IN      NS      a.dns.cn.
cn.                     172800  IN      NS      c.dns.cn.
cn.                     172800  IN      NS      d.dns.cn.

;; ADDITIONAL SECTION:
a.dns.cn.               172800  IN      AAAA    2001:dc7::1
d.dns.cn.               172800  IN      AAAA    2001:dc7:1000::1
a.dns.cn.               172800  IN      A       203.119.25.1
b.dns.cn.               172800  IN      A       203.119.26.1
c.dns.cn.               172800  IN      A       203.119.27.1
d.dns.cn.               172800  IN      A       203.119.28.1
e.dns.cn.               172800  IN      A       203.119.29.1
f.dns.cn.               172800  IN      A       195.219.8.90
g.dns.cn.               172800  IN      A       66.198.183.65
ns.cernet.net.          172800  IN      A       202.112.0.44

查询到www.nbut.edu.cn的cn TLD服务器如上

进一步查询权威服务器:

root@LAPTOP-VAFH00IB:~# dig +norecurse @a.dns.cn. any www.nbut.edu.cn

; <<>> DiG 9.16.1-Ubuntu <<>> +norecurse @a.dns.cn. any www.nbut.edu.cn
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53158
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 5, ADDITIONAL: 5

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.nbut.edu.cn.               IN      ANY

;; AUTHORITY SECTION:
edu.cn.                 172800  IN      NS      ns2.cuhk.hk.
edu.cn.                 172800  IN      NS      deneb.dfn.de.
edu.cn.                 172800  IN      NS      dns.edu.cn.
edu.cn.                 172800  IN      NS      ns2.cernet.net.
edu.cn.                 172800  IN      NS      dns2.edu.cn.

;; ADDITIONAL SECTION:
dns.edu.cn.             172800  IN      AAAA    2001:250:c006::35
dns2.edu.cn.            172800  IN      AAAA    2001:da8:1:100::13
dns.edu.cn.             172800  IN      A       202.38.109.35
dns2.edu.cn.            172800  IN      A       202.112.0.13

edu.cn是cn之下的TLD DNS服务器

b, 查询百度的DNS结构:

a.root-servers.net
d.gtld-servers.net
www.baidu.com.

 <<>> DiG 9.16.1-Ubuntu <<>> +norecurse @a.root-servers.net any www.baidu.com
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58734
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 27

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 5e1ccaf614fb20295f16599c6161888b89802bb339e86ede (good)
;; QUESTION SECTION:
;www.baidu.com.                 IN      ANY

;; AUTHORITY SECTION:
com.                    172800  IN      NS      h.gtld-servers.net.
com.                    172800  IN      NS      f.gtld-servers.net.
com.                    172800  IN      NS      m.gtld-servers.net.
com.                    172800  IN      NS      c.gtld-servers.net.
com.                    172800  IN      NS      j.gtld-servers.net.
com.                    172800  IN      NS      b.gtld-servers.net.
com.                    172800  IN      NS      g.gtld-servers.net.
com.                    172800  IN      NS      e.gtld-servers.net.
com.                    172800  IN      NS      k.gtld-servers.net.
com.                    172800  IN      NS      i.gtld-servers.net.
com.                    172800  IN      NS      d.gtld-servers.net.
com.                    172800  IN      NS      a.gtld-servers.net.
com.                    172800  IN      NS      l.gtld-servers.net.

;; ADDITIONAL SECTION:
a.gtld-servers.net.     172800  IN      AAAA    2001:503:a83e::2:30
b.gtld-servers.net.     172800  IN      AAAA    2001:503:231d::2:30
c.gtld-servers.net.     172800  IN      AAAA    2001:503:83eb::30
d.gtld-servers.net.     172800  IN      AAAA    2001:500:856e::30
e.gtld-servers.net.     172800  IN      AAAA    2001:502:1ca1::30
f.gtld-servers.net.     172800  IN      AAAA    2001:503:d414::30
g.gtld-servers.net.     172800  IN      AAAA    2001:503:eea3::30
h.gtld-servers.net.     172800  IN      AAAA    2001:502:8cc::30
i.gtld-servers.net.     172800  IN      AAAA    2001:503:39c1::30
j.gtld-servers.net.     172800  IN      AAAA    2001:502:7094::30
k.gtld-servers.net.     172800  IN      AAAA    2001:503:d2d::30
l.gtld-servers.net.     172800  IN      AAAA    2001:500:d937::30
m.gtld-servers.net.     172800  IN      AAAA    2001:501:b1f9::30
a.gtld-servers.net.     172800  IN      A       192.5.6.30
b.gtld-servers.net.     172800  IN      A       192.33.14.30
c.gtld-servers.net.     172800  IN      A       192.26.92.30
d.gtld-servers.net.     172800  IN      A       192.31.80.30
e.gtld-servers.net.     172800  IN      A       192.12.94.30
f.gtld-servers.net.     172800  IN      A       192.35.51.30
g.gtld-servers.net.     172800  IN      A       192.42.93.30
h.gtld-servers.net.     172800  IN      A       192.54.112.30
i.gtld-servers.net.     172800  IN      A       192.43.172.30
j.gtld-servers.net.     172800  IN      A       192.48.79.30
k.gtld-servers.net.     172800  IN      A       192.52.178.30
l.gtld-servers.net.     172800  IN      A       192.41.162.30
m.gtld-servers.net.     172800  IN      A       192.55.83.30

B:~# dig +norecurse @d.gtld-servers.net any www.baidu.com

; <<>> DiG 9.16.1-Ubuntu <<>> +norecurse @d.gtld-servers.net any www.baidu.com
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36794
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 5, ADDITIONAL: 6

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.baidu.com.                 IN      ANY

;; AUTHORITY SECTION:
baidu.com.              172800  IN      NS      ns2.baidu.com.
baidu.com.              172800  IN      NS      ns3.baidu.com.
baidu.com.              172800  IN      NS      ns4.baidu.com.
baidu.com.              172800  IN      NS      ns1.baidu.com.
baidu.com.              172800  IN      NS      ns7.baidu.com.

;; ADDITIONAL SECTION:
ns2.baidu.com.          172800  IN      A       220.181.33.31
ns3.baidu.com.          172800  IN      A       112.80.248.64
ns4.baidu.com.          172800  IN      A       14.215.178.80
ns1.baidu.com.          172800  IN      A       110.242.68.134
ns7.baidu.com.          172800  IN      A       180.76.76.92
IB:~# dig +norecurse @ns1.baidu.com any www.baidu.com

; <<>> DiG 9.16.1-Ubuntu <<>> +norecurse @ns1.baidu.com any www.baidu.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58911
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 6

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.baidu.com.                 IN      ANY

;; ANSWER SECTION:
www.baidu.com.          1200    IN      CNAME   www.a.shifen.com.

;; AUTHORITY SECTION:
baidu.com.              86400   IN      NS      dns.baidu.com.
baidu.com.              86400   IN      NS      ns3.baidu.com.
baidu.com.              86400   IN      NS      ns4.baidu.com.
baidu.com.              86400   IN      NS      ns7.baidu.com.
baidu.com.              86400   IN      NS      ns2.baidu.com.

;; ADDITIONAL SECTION:
dns.baidu.com.          600     IN      A       110.242.68.134
ns2.baidu.com.          86400   IN      A       220.181.33.31
ns3.baidu.com.          86400   IN      A       112.80.248.64
ns4.baidu.com.          86400   IN      A       14.215.178.80
ns7.baidu.com.          86400   IN      A       180.76.76.92

P20.

Suppose you can access the caches in the local DNS servers of your department. Can you propose a way to roughly determine the Web servers (outside your department) that are most popular among the users in your department? Explain.

答案:

可以的。比如可以这样做:每隔1小时,统计cache中出现的Web服务器IP,然后统计1天的数据,出现频次最多的服务器就是最流行的Web服务器。

P21.

Suppose that your department has a local DNS server for all computers in the department. You are an ordinary user (i.e., not a network/system administrator). Can you determine if an external Web site was likely accessed from a computer in your department a couple of seconds ago? Explain.

答案:

可以的。
可以使用dig工具来查看网站的dns构架。

P22.
Consider distributing a file of F=15 Gbits to N peers. The server has an upload rate of us=30 Mbps, and each peer has a download rate of di=2 Mbps and an upload rate of u. For N=10 ,100, and 1,000 and u = 300 Kbps, 700 Kbps, and 2 Mbps, prepare a chart giving the minimum distribution time for each of the combinations of N and u for both client-server distribution and P2P distribution

答案:

C-S架构:
在这里插入图片描述

u=300Kbps u=700Kbps u = 2Mbps
N = 10 7500s 7500s 7500
N = 100 50000s 50000s 50000s
N = 1000 500000s 500000s 500000s

P2P架构
在这里插入图片描述

u=300Kbps u=700Kbps u = 2Mbps
N = 10 7500s 7500s 7500s
N = 100 25000s 15000s 7500s
N = 1000 45455s 20547s 7500s

P23.

Consider distributing a file of F bits to N peers using a client-server architecture. Assume a fluid model where the server can simultaneously transmit to multiple peers, transmitting to each peer at different rates, as long as the combined rate does not exceed u s u_s us

a. Suppose that u s / N ≤ d m i n u_s/N ≤d_{min} us/Ndmin. Specify a distribution scheme that has a distribution time of N F / u s NF/u_s NF/us
b. Suppose that u s / N ≥ d m i n u_s/N ≥d_{min} us/Ndmin. Specify a distribution scheme that has a distribution time of F / d m i n F/d_{min} F/dmin
c. Conclude that the minimum distribution time is in general given by m a x { N F / u s , F / d m i n } max\{NF/u_s, F/d_{min}\} max{NF/us,F/dmin}

答案:

a, 带宽平均分配,即每个用户的速率为 u s / N u_s/N us/N, 这样每个用户的分配时间都是 N F / u s NF/u_s NF/us
b, 尽量平均分配带宽,使得带宽高于某速率a的接入用户速率相等,低于速率a的用户带宽达到自己接入带宽上限,且服务器尽量不保留剩余带宽。这样最慢的用户的分发时间是 F / d m i n F/d_{min} F/dmin
c,
先证明t≥ m a x { N F / u s , F / d m i n } max\{NF/u_s, F/d_{min}\} max{NF/us,F/dmin}
从总体来说,服务器需要分发的总流量是NF,服务器带宽是 u s u_s us,所以t≥ N F / u s NF/u_s NF/us
考虑速率最小的对等方,它需要在速率为 d m i n d_min dmin的链路上接收大小为Fbits的数据,所以t≥ F / d m i n F/d_{min} F/dmin

再证明t小于等于 m a x { N F / u s , F / d m i n } max\{NF/u_s, F/d_{min}\} max{NF/us,F/dmin}
从题a中我们知道,当 u s / N ≤ d m i n u_s/N ≤d_{min} us/Ndmin时,时间为 N F / u s NF/u_s NF/us,小于等于 m a x { N F / u s , F / d m i n } max\{NF/u_s, F/d_{min}\} max{NF/us,F/dmin}
从题b中可知, u s / N ≥ d m i n u_s/N ≥d_{min} us/Ndmin时,时间是 F / d m i n F/d_{min} F/dmin,小于等于 m a x { N F / u s , F / d m i n } max\{NF/u_s, F/d_{min}\} max{NF/us,F/dmin}
故任何时候,t≤ m a x { N F / u s , F / d m i n } max\{NF/u_s, F/d_{min}\} max{NF/us,F/dmin}

综上,t= m a x { N F / u s , F / d m i n } max\{NF/u_s, F/d_{min}\} max{NF/us,F/dmin}

P24.

Consider distributing a file of F bits to N peers using a P2P architecture. Assume a fluid model. For simplicity assume that d m i n d_{min} dmin is very large, so that peer download bandwidth is never a bottleneck

a. Suppose that u s ≤ ( u s + u 1 , . . . , u N ) / N u_s≤(u_s+u_1,...,u_N)/N us(us+u1,...,uN)/NSpecify a distribution scheme that has a distribution time of F / u s F/u_s F/us
b. Suppose that u s ≥ ( u s + u 1 , . . . , u N ) / N u_s ≥ (u_s+u_1,...,u_N)/N us(us+u1,...,uN)/N Specify a distribution scheme that has a distribution time of N F / ( u s + u 1 , . . . , u N ) NF/(u_s+u_1,...,u_N) NF/(us+u1,...,uN)
c. Conclude that the minimum distribution time is in general given by m a x { F / u s , N F / ( u s + u 1 , . . . , u N ) } max\{F/u_s,NF/(u_s+u_1,...,u_N)\} max{F/us,NF/(us+u1,...,uN)}

答案:
a, 所有的对等方同时从服务器下载文件,并且得到文件块的对等方同步使用P2P分发到其他对等方。
所有的下载带宽,按照下载者的上传带宽比例分配。(保证所有对等方的上传带宽尽可能大)。

把文件从服务器下载所用时间: F / u s F/u_s F/us,文件分发所用时间 N F / ( u s + u 1 , . . . , u N ) NF/(u_s+u_1,...,u_N) NF/(us+u1,...,uN). 由于 u s ≤ ( u s + u 1 , . . . , u N ) / N u_s≤(u_s+u_1,...,u_N)/N us(us+u1,...,uN)/N,最终时间为 F / u s F/u_s F/us

b,方式同a。

c, 证明类似P23,略。

P25.

Consider an overlay network with N active peers, with each pair of peers having an active TCP connection. Additionally, suppose that the TCP connections pass through a total of M routers. How many nodes and edges are there in the corresponding overlay network?

答案:

N个节点, N(N-1)/2 条边。

P26.

Suppose Bob joins a BitTorrent torrent, but he does not want to upload any data to any other peers (so called free-riding).
a. Bob claims that he can receive a complete copy of the file that is shared by the swarm. Is Bob’s claim possible? Why or why not?
b. Bob further claims that he can further make his “free-riding” more efficient by using a collection of multiple computers (with distinct IP addresses) in the computer lab in his department. How can he do that?

答案:

a, 是的。由于BitTorrent存在疏通过程,Bob有可能会在疏通时被某个节点选中,从而得到它的数据。
b,可以。他可以让每个主机请求不同的文件块,并将这些文件块组织成一个完整文件。

P27.

Consider a DASH system for which there are N video versions (at N different rates and qualities) and N audio versions (at N different rates and qualities). Suppose we want to allow the player to choose at any time any of the N video versions and any of the N audio versions.
a. If we create files so that the audio is mixed in with the video, so server sends only one media stream at given time, how many files will the server need to store (each a different URL)?
b. If the server instead sends the audio and video streams separately and has the client synchronize the streams, how many files will the server need to store.

答案:
a, N
b, 2N

P28. Install and compile the Python programs TCPClient and UDPClient on one host and TCPServer and UDPServer on another host.
a. Suppose you run TCPClient before you run TCPServer. What happens? Why?
b. Suppose you run UDPClient before you run UDPServer. What happens? Why?
c. What happens if you use different port numbers for the client and server sides?

答案:

a, 无法建立连接。客户端启动时就会尝试建立TCP连接,假如服务器端未启动,则连接建立失败。
b,没有什么问题。客户端和服务器端不需要建立什么连接。
c, TCP:客户端会尝试与错误的进程(也可能是根本不存在的进程)建立连接,会导致错误。
UDP: 无法将信息发送到正确的进程。

P29.

Suppose that in UDPClient.py, after we create the socket, we add the line:

		clientSocket.bind((’’, 5432))

Will it become necessary to change UDPServer.py? What are the port numbers for the sockets in UDPClient and UDPServer? What were they before making this change?

答案: 容我赶完作业细看socket…

P30.

Can you configure your browser to open multiple simultaneous connections to a Web site? What are the advantages and disadvantages of having a large number of simultaneous TCP connections?

答案:
可以的。
优点:加快浏览速度
缺点:影响其他共享链路用户的带宽

P31.

We have seen that Internet TCP sockets treat the data being sent as a byte stream but UDP sockets recognize message boundaries. What are one advantage and one disadvantage of byte-oriented API versus having the API explicitly recognize and preserve application-defined message boundaries?

答案:

优点:某些没有明确数据边界的场合,使用字节流很好。比如即时聊天系统。
缺点:某些需要有数据边界的场合,使用字节流需要有额外的边界判断步骤。比如邮件系统需要用特定消息来标记邮件的结束。

P32.

What is the Apache Web server? How much does it cost? What functionality does it currently have? You may want to look at Wikipedia to answer this question

答案:
阿帕奇网站服务器是一种开源的网站服务器,它的使用时免费的。(其他略)

你可能感兴趣的:(计网,udp,http,计算机网络)