【复习】计算机网络习题

本习题以《计算机网络:自顶层向下的方法》为参照,基于TJU计算机网络课程复习整理

第一章

课堂小测

1 四个时延

关于网络延迟,下列说法正确的是( )

  • A.节点处理延迟(nodal processing delay) 通常很短,可以忽略不计。

  • B.排队延迟(queueing delay)和网络中业务量的变化无关。

  • C.传播延迟(propagation delay)和链路的带宽有关。带宽越大,传播延迟越小。

  • D.传输延迟(transmission delay)和两个节点的物理距离有关。距离越大,传输延迟越大。

参考答案 A


2 网络性能参数

关于网络性能参数的计算,下列说法正确的是( )

  • A.延迟(delay)只能实验测量,不能理论计算。

  • B.实际网络系统的性能评估中,性能参数通常采用实验来测量。

  • C.除了丢包率、延迟、吞吐率,就没有其它网络性能评价参数了。

  • D.吞吐率(throughput)只能实验测量,不能理论计算。

参考答案 B


3 数据包交换

关于数据包交换(packet switching),下列说法正确的是( )

  • A.每个数据包独立寻路。

  • B.传输过程中没有丢包和乱序。

  • C.中间节点不需要要存储-转发(store-forward)数据包

  • D.发送数据前要建立连接。

参考答案 A


4 可扩展性

Internet具有很强的可扩展性(scalability),得益于下列哪些方面( )?

  • A.网络协议的实现方式具有很好的可扩展性。

  • B.分层的网络协议架构具有很好的可扩展性。

  • C.RFC(Request For Comments) 是收费的,不公开。

  • D.层次型的物理架构具有很好的可扩展性。

参考答案 ABD


5 端到端协议

下列哪些协议层是端到端(end-to-end)的?( )

  • A.数据链路层 (data link layer)

  • B.传输层(transport layer)

  • C.应用层(application layer)

  • D.物理层 (physical layer)

  • E.网络层 (network layer)

参考答案 BC


课后作业

1 分层协议

Chapter 1 R23. What are the five layers in the Internet protocol stack? What are the principal
responsibilities of each of these layers?

参考答案

IP协议栈中的五个层从上到下分别是应用层、传输层、网络层、链路层和物理层。
每一层的作用分别是:

(1) 应用层:面向用户提供端到端的网络服务。

(2) 传输层:为应用层提供端到端的数据传输服务。

(3) 网络层:转发路由。为数据包找到一条从源地址到目的地址的路径。

(4) 链路层:为共享同一条链路的多个用户分配链路资源,以便把数据包传输到网络层指定的相邻节点上。

(5) 物理层:负责把数字信号转换成模拟信号(光/电等),在物理介质上传输。


2 传输/传播时延

Chapter 1 P6. This elementary problem begins to explore propagation delay and transmission delay, two central concepts in data networking. Consider two hosts, A and B, connected by a single link of rate R R R bps. Suppose that the two hosts are separated by m m m meters, and suppose the propagation speed along the link is S S S meters/sec. Host A is to send a packet of size L L L bits to Host B.

a. Express the propagation delay, d p r o p d_{prop} dpropin terms of m m m and S S S

b. Determine the transmission time of the packet, d t r a n s d_{trans} dtrans, in terms of L L L and R R R

c. Ignoring processing and queuing delays, obtain an expression for the end-to-end delay.

d. Suppose Host A begins to transmit the packet at time t = 0 t=0 t=0. At time t = d t r a n s t = d_{trans} t=dtrans, where is the last bit of the packet?

e. Suppose d p r o p d_{prop} dprop is greater than d t r a n s d_{trans} dtrans. At time t = d t r a n s t=d_trans t=dtrans where is the first bit of the packet?

f. Suppose d p r o p d_{prop} dprop is less than d t r a n s d_{trans} dtrans. At time t = d t r a n s t = d_{trans} t=dtrans, where is the first bit of the packet?

g. Suppose 2.5 × 1 0 8 2.5\times 10^8 2.5×108 m/s, L = 1500 L=1500 L=1500 bytes, and R = 10 R=10 R=10 Mbps. Find the distance m so that d p r o p d_{prop} dprop equals d t r a n s d_{trans} dtrans

参考翻译

这个基本问题开始探讨传播延迟和传输延迟,这是数据网络中的两个核心概念。考虑两个主机,A 和 B,通过速率 R R R bps的单链路连接。假设两个主机相距 m m m 米,假设沿链路的传播速度为 S S S 米/秒。主机 A 向主机 B 发送一个大小为 L L L比特的数据包。

a. 将传播延迟 d p r o p d_{prop} dprop 表示为 m m m S S S

b. 确定数据包 d t r a n s d_{trans} dtrans 的传输时间,用 L L L R R R表示

c. 忽略处理和排队延迟,得到端到端延迟表达式。

d. 假设主机A在时间 t = 0 t=0 t=0 时开始传输数据包。在时间 t = d t r a n s t = d_{trans} t=dtrans 时,数据包的最后一位在哪里?

e. 假设 d p r o p d_{prop} dprop 大于 d t r a n s d_{trans} dtrans。在时间 t = d t r a n s t=d_trans t=dtrans 哪里是数据包的第一个位?

f. 假设 d p r o p d_{prop} dprop小于 d t r a n s d_{trans} dtrans。在时间 t = d t r a n s t = d_{trans} t=dtrans,数据包的第一个位在哪里?

g. 假设 2.5 × 1 0 8 2.5\times10^8 2.5×108 m/s, L = 1500 L=1500 L=1500 bytes, R = 10 R=10 R=10 Mbps。求距离m,使 d p r o p d_{prop} dprop 等于 d t r a n s d_{trans} dtrans

参考答案

a. d p r o p = m S d_{prop} = \dfrac{m}{S} dprop=Sm seconds

b. d t r a n s = L R d_{trans} = \dfrac{L}{R} dtrans=RL seconds

c. d e n d − t o − e n d = ( m s + L R ) d_{end-to-end} = (\dfrac{m}{s} + \dfrac{L}{R}) dendtoend=(sm+RL) seconds

d. 最后的 bit 刚离开主机A

e. 第一个 bit 在链路中还未到达主机 B

f. 第一个 bit 已经到达主机 B

g. m = L R S = 1500 × 8 1 0 7 × 2.5 × 1 0 8 = 300 k m m = \dfrac{L}{RS} = \dfrac{ 1500 \times 8}{10^7 \times 2.5 \times 10^8}= 300 km m=RSL=107×2.5×1081500×8=300km


3 支持用户数量

Chapter 1 P8. Suppose users share a 10 Mbps link. Also suppose each user requires 200 kbps when transmitting, but each user transmits only 10 percent of the time. (See the discussion of packet switching versus circuit switching in Section 1.3.)

a. When circuit switching is used, how many users can be supported?

b. For the remainder of this problem, suppose packet switching is used. Find the probability that a given user is transmitting.

c. Suppose there are 120 users. Find the probability that at any given time, exactly n users are transmitting simultaneously. (Hint : Use the binomial distribution.)

d. Find the probability that there are 51 or more users transmitting simultaneously.

参考翻译

假设用户共享一条10mbps的链路。还假设每个用户在传输时需要200kbps,但每个用户只传输10%的时间。(参见第1.3节关于分组交换与电路交换的讨论。)

a.采用电路交换时,可支持多少用户?

b.对于这个问题的剩余部分,假设使用分组交换。求给定用户正在传输的概率。

c.假设有120个用户。求在任意给定时间,恰好有n个用户同时传输的概率。(提示:使用二项分布。)

d.求同时有51个或51个以上用户传输的概率。

参考答案

a) 可以支持50.

b) p = 0.1

c) C 120 n p n ( 1 − p ) 120 − n C_{120}^n p^n (1-p)^{120-n} C120npn(1p)120n

d) 1 − ∑ n = 0 50 C 120 n p n ( 1 − p ) 120 − n ≈ 0 1-\sum_{n=0}^{50} C_{120}^n p^n(1-p)^{120-n} \approx 0 1n=050C120npn(1p)120n0


4 比特宽度

Chapter 1 P25. Suppose two hosts, A and B, are separated by 20,000 kilometers and are connected by a direct link of R = 5 R=5 R=5 Mbps. Suppose the propagation speed over the link is 2.5 × 1 0 8 2.5 \times 10^8 2.5×108 m/s.

a. Calculate the bandwidth-delay product, R × d p r o p R \times d_{prop} R×dprop.

b. Consider sending a file of 800,000 bits from Host A to Host B. Suppose the file is sent continuously as one large message. What is the maximum number of bits that will be in the link at any given time?

c. Provide an interpretation of the bandwidth-delay product.

d. What is the width (in meters) of a bit in the link? Is it longer than a football field?

e. Derive a general expression for the width of a bit in terms of the propagation speed s, the transmission rate R, and the length of the link m.

参考答案
a. 时延带宽积

R × d p r o p = 5 M b p s × 20 , 000 k m 2.5 ∗ 1 0 8 m / s = 400 k b R \times d_{prop} = 5 Mbps \times \dfrac{20,000km}{2.5*10^8m/s} = 400 kb R×dprop=5Mbps×2.5108m/s20,000km=400kb

b. 由上一问可知,最大bit数为400 kb。

c. 一条链路可以容纳的最大bit数量。

d. 一个bit的宽度为链路长度除以时延带宽积。因此该链路上一个bit的宽度为:50 m,小于一个足球场的长度。

e. 根据以上的理解,一个比特的宽度

m R × d p r o p = m R × m S = S R \dfrac{m}{R \times d_{prop}} = \dfrac{m}{R \times \dfrac{m}{S}} = \dfrac{S}{R} R×dpropm=R×Smm=RS


书后习题

1 端到端时延

R16

延迟组件是处理延迟、传输延迟、传播延迟和排队延迟。所有这些延迟都是固定的,除了排队延迟是可变的。

2 协议分层

R25

路由器处理网络、链路和物理层(第1层到第3层)。(这是一个善意的谎言,因为现代路由器有时充当防火墙或缓存组件,也处理传输层。)

链路层交换机处理链路层和物理层(第一层到第二层)。主机处理所有五个层。

3 多段时延

在这里插入图片描述

参考答案

在这里插入图片描述


第二章

课堂小测

1 使用TCP协议

下列说法错误的是( )。

  • A.DNS 使用TCP。

  • B.FTP使用TCP。

  • C.SMTP使用TCP。

  • D.POP3 使用TCP。

参考答案 A

DHCP 和 DNS 使用 UDP


2 DNS

DNS(Domain Name System)数据库的记录格式为(name, value, type, ttl)。请问其中ttl的作用是 ( )。

  • A.限制DNS查询的跳数(the number of hops)。

  • B.防止记录内容过期(out-of-date)。

  • C.限制记录查询的次数。

  • D.提高记录查询的效率。

参考答案 B


3 P2P

关于网络应用P2P(Peer-to-Peer)架构,下列说法正确的是( )。

  • A. Peer需要有固定的公网IP地址。

  • B.性能高的peers能提供数据,其它peers不能。

  • C.对每个peer的性能要求高,需要一直在线。

  • D.每个peer都可以提供数据。

参考答案 D


4 HTTP

关于HTTP,下列说法错误的是( )。

  • A.HTTP 服务器采用无状态(stateless)管理方式,不保存客户端的任何状态信息。为了能记录用户状态,需要使用cookies。

  • B.使用TCP协议。

  • C.HTTP的web proxy 总是能够降低响应时间,提升用户体验。

  • D.HTTP 的数据包头部是以文本形式存储的,很容易读懂内容。

参考答案 C


5 DNS 数据库

DNS(Domain Name System)采用分布式数据库,主要原因是( )。

  • A.降低由于地理位置导致的延迟。

  • B.避免单点失效问题。

  • C.便于维护。

  • D.减少大量业务的密集访问。

参考答案 ABCD


课后作业

1 邮件协议

Chapter 2 SECTION 2.2-2.5 R16. Suppose Alice, with a Web-based e-mail account (such as Hotmail or Gmail), sends a message to Bob, who accesses his mail from his mail server using IMAP. Discuss how the message gets from Alice’s host to Bob’s host. Be sure to list the series of application-layer protocols that are used to move the message between the two hosts.

参考译文

假设 Alice 使用基于 Web 的电子邮件帐户(例如 Hotmail 或 Gmail)向 Bob 发送了一条消息,Bob 使用 IMAP 从其邮件服务器访问其邮件。讨论该消息如何从 Alice 的主机传输到 Bob 的主机。请务必列出用于在两个主机之间移动消息的一系列应用层协议。

参考答案

消息首先通过HTTP从Alice的主机发送到她的邮件服务器,邮件放置到消息队列里。

随后SMTP客户端打开与Bob邮件服务器的TCP连接

然后SMTP通过TCP连接将Alice的消息发送给Bob的邮件服务器

最后Bob通过IMAP协议将消息从他的邮件服务器下载到他的主机


2 HTTP 传输延迟

Chapter 2 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 6 parallel connections?

c. Persistent HTTP?

参考译文

假设 HTML 文件引用了同一服务器上的八个非常小的对象。忽略传输时间,使用

a. 非持久 HTTP,没有并行 TCP 连接?

b. 非持久 HTTP,浏览器配置为 6 个并行连接?

c. 持久 HTTP?

参考答案

参考P7,查找到包含该IP地址使用的时间是:RTT1+···+RTTn。HTML文件和objects长度短,因此文件传输时间可以忽略不计。

a) 非持续HTTP,一个TCP连接。则HTML文件和每个object都需要1个RTT建立TCP连接,和1个RTT请求文件传输。所以总时间为:
R T T 1 + ⋯ + R T T n + 2 R T T 0 + 8 ⋅ 2 R T T 0 = 18 R T T 0 + R T T 1 + ⋯ + R T T n RTT_1 + \cdots + RTT_n + 2RTT_0 + 8\cdot 2RTT_0 = 18RTT_0 + RTT_1 + \cdots + RTT_n RTT1++RTTn+2RTT0+82RTT0=18RTT0+RTT1++RTTn

b) 非持续HTTP,同时开启6个TCP连接。则HTML文件传输到客户端后,其中所含的8个objects可以每6个一批并行传输,因此分成两批传输:第1批并行传6个objects,第2批并行传2个objects。其中HTML的传输时间为2 RTT0,每批并行传输各需要2RTT0
R T T 1 + ⋯ + R T T n + 2 R T T 0 + 2 ⋅ 2 R T T 0 = 6 R T T 0 + R T T 1 + ⋯ + R T T n RTT_1 + \cdots + RTT_n + 2RTT_0 + 2\cdot 2RTT_0 = 6RTT_0 + RTT_1 + \cdots + RTT_n RTT1++RTTn+2RTT0+22RTT0=6RTT0+RTT1++RTTn

c) 采用并行的持久HTTP,建立TCP连接需要RTT0,请求HTML文件需要RTT0,请求8个objects共需要RTT0
R T T 1 + ⋯ + R T T n + R T T 0 + R T T 0 + R T T 0 = 3 R T T 0 + R T T 1 + ⋯ + R T T n RTT_1 + \cdots + RTT_n + RTT_0 + RTT_0 + RTT_0 = 3RTT_0 + RTT_1 + \cdots + RTT_n RTT1++RTTn+RTT0+RTT0+RTT0=3RTT0+RTT1++RTTn

d) 如果采用串行的持久HTTP,则传输HTML文件需要2 RTT0,8个objects都各需要RTT0
R T T 1 + ⋯ + R T T n + 2 R T T 0 + 8 R T T 0 = 10 R T T 0 + R T T 1 + ⋯ + R T T n RTT_1 + \cdots + RTT_n + 2RTT_0 + 8RTT_0 = 10RTT_0 + RTT_1 + \cdots + RTT_n RTT1++RTTn+2RTT0+8RTT0=10RTT0+RTT1++RTTn


3 whois 数据库

Chapter 2 SECTION 2.4 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. 使用 Internet 上的各种 whois 数据库获取两个 DNS 服务器的名称。指出您使用了哪些 whois 数据库。

c. 在本地主机上使用 nslookup 将 DNS 查询发送到三个 DNS 服务器:您的本地 DNS 服务器和您在部分 (b) 中找到的两个 DNS 服务器。尝试查询 A 类、NS 和 MX 报告。总结您的发现。

d. 使用 nslookup 查找具有多个 IP 地址的 Web 服务器。您的机构(学校或公司)的 Web 服务器是否有多个 IP 地址?

e. 使用 ARIN whois 数据库确定您的大学使用的 IP 地址范围。

f. 描述攻击者在发起攻击之前如何使用 whois 数据库和 nslookup 工具对机构进行侦察。

g. 讨论为什么 whois 数据库应该公开。

参考答案

a) 对于给定的域名,whois数据库可用于查看域名的当前信息状态,包括域名是否已被注册、注册日期、过期日期、域名状态、DNS解析服务器等。

b)DNS服务器:NS3.DNSV5.COM和NS4.DNSV5.COM。查询网站:whois.chinaz.com。

c)本地:192.168.2.1

A:www.xiaomi.com 58.83.160.155,58.83.160.156

MS:mxhk.mxmail.xiaomi.commx3.mxmail.xiaomi.com

NS:ns3.dnsv5.com,ns4.dnsv5.com

DNS服务器:NS3.DNSV5.COM:

A:www.xiaomi.com 8.83.177.165,58.83.177.173,124.251.58.20,124.251.58.54

MS: mxhk.mxmail.xiaomi.com,mx3.mxmail.xiaomi.com

NS:ns3.dnsv5.com,ns4.dnsv5.com

DNS服务器:NS4.DNSV5.COM:

A:www.xiaomi.com 124.251.58.54,58.83.177.165,58.83.177.173,124.251.58.20

MS:mx3.mxmail.xiaomi.com,mxhk.mxmail.xiaomi.com

NS:ns3.dnsv5.com,ns4.dnsv5.com

d)www.xiaomi.com就含有多个IP地址。我们大学的官网是www.tju.edu.cn只查到一个地址:202.113.2.199。

e)在ARIN(美国Internet号码注册中心)上查不到,所以去了中国互联网络信息中心(cnnic)查询得到天津大学IP地址范围: 128.238.0.0-128.238.255.255。

f)攻击者可以使用 whois 数据库和 nslookup 工具来找到目标机构的 ip 地址范围以及dns 服务器地址,利用这些信息进行攻击。例如可以利用流量轰炸根服务器、中间人攻击、DNS中毒攻击或者利用DNS攻击DDoS。

g) 方便用户在申请域名前可以查询到对应域名是否已经被占用。从安全的角度考虑考虑,被攻击者可以通过分析攻击数据包的来源地址,使用 whois 获取攻击来源域的信息,并联系来源域的管理员或警方进行及时管控。


4 CS P2P 分发时间

Chapter 2 P22. Consider distributing a file of F=20 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.

参考翻译

考虑将F= 20gb的文件分发给N个对等节点。服务器的上传速率为us=30 Mbps,每个对等端的下载速率为di=2 Mbps,上传速率为u。对于N= 10,100和1,000,u=300 Kbps, 700 Kbps和2 Mbps,准备一个图表,给出客户端-服务器分布和P2P分布中N和u的每种组合的最小分布时间。

参考答案

client-server分发模式所需要的最小分发时间为:
D c − s ≥ m a x { N ⋅ F u s , F d m i n } D_{c-s} \ge max\{ \dfrac{N \cdot F}{u_s}, \dfrac{F}{d_{min}} \} Dcsmax{usNF,dminF}
而P2P分发模式的最小分发时间为:

D P 2 P ≥ m a x { F u s , F d m i n , N ⋅ F u s + ∑ i = 1 n u i } D_{P2P} \ge max\{ \dfrac{F}{u_s}, \dfrac{F}{d_{min}}, \dfrac{N\cdot F}{u_s + \sum_{i=1}^n u_i} \} DP2Pmax{usF,dminF,us+i=1nuiNF}

在本题中,文件大小F=20Gbit,服务器上传速率us=30Mbps,dmin=2Mbps,代入计算得:

在这里插入图片描述


书后习题

1 持续/非持续HTTP

P10 考虑一条 10 米短链路,某发送方经过它能够以 150bps 速率双向传输。假定包含数据的分组是100000比特长,仅包含控制(如ACK 或握手) 的分组是 200 比特长。假定 N个并行连接每个都获得 1/N 的链路带宽。现在考虑 HTTP 协议,并且假定每个下载对象是 100Kb 长,这些初始下载对象包含10 个来自相同发送方的引用对象。在这种情况下,经非持续 HTTP 的并行实例的并行下载有意义吗?现在考虑持续 HTTP。你期待这比非持续的情况有很大增益吗?评价并解释你的答案。

参考答案

注意,每个下载的对象都可以完全放入一个数据包中。设Tp表示客户机和服务器之间的单向传播延迟。

首先考虑使用非持久连接的并行下载。并行下载将允许10个连接共享150比特/秒的带宽,每个连接只有15比特/秒。因此,接收所有对象所需的总时间为:

( 200 / 150 + T p + 200 / 150 + T p + 200 / 150 + T p + 100 , 000 / 150 + T p ) + ( 200 / ( 150 / 10 ) + T p + 200 / ( 150 / 10 ) + T p + 200 / ( 150 / 10 ) + T p + 100 , 000 / ( 150 / 10 ) + T p ) = 7377 + 8 ∗ T p ( s e c o n d s ) ( 200/150+Tp + 200/150 +Tp + 200/150+Tp + 100,000/150+ Tp ) +\\ (200/(150/10)+Tp + 200/(150/10) +Tp +200/(150/10)+Tp + 100,000/(150/10)+ Tp ) \\ = 7377 + 8*Tp (seconds) (200/150+Tp+200/150+Tp+200/150+Tp+100,000/150+Tp)+(200/(150/10)+Tp+200/(150/10)+Tp+200/(150/10)+Tp+100,000/(150/10)+Tp)=7377+8Tp(seconds)

现在考虑一个持久HTTP连接。所需总时间为:

( 200 / 150 + T p + 200 / 150 + T p + 200 / 150 + T p + 100 , 000 / 150 + T p ) + 10 ∗ ( 200 / 150 + T p + 100 , 000 / 150 + T p ) = 7351 + 24 ∗ T p ( s e c o n d s ) (200/150+Tp + 200/150 +Tp + 200/150+Tp + 100,000/150+ Tp )\\ + 10*(200/150+Tp + 100,000/150+ Tp )\\ =7351 + 24*Tp (seconds) (200/150+Tp+200/150+Tp+200/150+Tp+100,000/150+Tp)+10(200/150+Tp+100,000/150+Tp)=7351+24Tp(seconds)

假设光速为 300 ∗ 1 0 6 300*10^6 300106米/秒,则

T p = 10 / ( 300 ∗ 1 0 6 ) = 0.03 m i c r o s e c Tp=10/(300*10^6) = 0.03 \quad microsec Tp=10/(300106)=0.03microsec

因此,与传输延迟相比,Tp可以忽略不计。

因此,我们看到持久HTTP并不比并行下载的非持久HTTP快多少(不到1%)。


第三章

课堂小测

1 可靠数据传输

关于可靠数据传输,下列说法正确的是( )

  • A.只要在不可靠的环境下需要传输的数据没有丢失、不乱序,就需要使用可靠数据传输的机制。

  • B.并行的(pipelined)可靠传输机制一定比停-等(stop-and-wait)机制的链路利用率高,性能好。

  • C.GBN(Go-Back-N)如果有一个数据包丢失,后续成功到达接收端的N个数据包都会被丢弃,导致超时后N个数据包都要重传,浪费带宽。因此没有什么好处,不会得到实际应用。

  • D. Internet只在传输层做可靠数据传输,其它层没有。

参考答案 A


2 可靠传输协议选择

节点A和B间有条微波无线链路相连。A和B相距100 Km,带宽为30 Kbps,数据包长度为1000 bits。需要在A和B间实现可靠数据传输,下列说法正确的是( )

  • A.每个数据包连续发送两次不能改善这条链路的可靠数据传输性能。

  • B.只有使用并行的(pipelined)可靠传输协议才能获得较高的链路利用率。

  • C.使用停-等(stop-and-wait)可靠传输协议就能获得很高的链路利用率。

  • D.不需要采用任何可靠传输协议就能实现可靠传输。

参考答案 C


3 TCP

关于TCP的可靠数据传输机制,下列说法错误的是:( )

  • A.TCP根据测得的RTT(Round Trip Time)值来动态估算超时时间阈值。

  • B.TCP 快速重传(fast retransmission)是指在发生超时事件时,启动重传。

  • C.TCP采用累积应答(accumulative ACK)来提高传输效率。

  • D.TCP采用捎带应答(Piggybacking ACK)的方式来提高传输效率。

参考答案 B

快速重传,连续三次 ACK


4 流量控制

关于TCP的流量控制(flow control),下列说法正确的是( )

  • A.为了解决TCP两端发送速率和接收速率不匹配的问题。

  • B.不能减少丢包的发生。

  • C.和网络传输速率有关。

  • D.不能改变发送端的发送速率。

参考答案 A

  • 拥塞控制侧重于保护网络,避免网络拥塞。
  • 流量控制侧重于保护接收方,防止接收方缓存溢出

5 拥塞控制

关于TCP的拥塞控制(congestion control),下列说法正确的是( )

  • A.通过超时事件推断网络拥塞的情况。

  • B.需要获取网络层的丢包信息。

  • C.通过3次重复的ACK包推断网络拥塞的情况。

  • D.对TCP的可靠数据传输没有任何影响。

参考答案 AC


6 TCP连接建立

关于TCP的连接建立,下列说法正确的是( )。

  • A.为可靠数据传输分配资源:缓冲区、变量等。

  • B.能够提高数据传输的吞吐率。

  • C.采用了三次握手的方式。

  • D.只需要建立连接,不用拆除连接。

参考答案 AC


课后作业

1 FSM图

Chapter 3, P8. Draw the FSM for the receiver side of protocol rdt3.0.

绘制rdt3.0协议接收端FSM图

参考答案

img


2 比特交换协议

Chapter 3, P24. Answer true or false to the following QUESTIONs and briefly justify your answer:

a. With the SR protocol, it is possible for the sender to receive an ACK for a packet that falls outside of its current window.

b. With GBN, it is possible for the sender to receive an ACK for a packet that falls outside of its current window.

c. The alternating-bit protocol is the same as the SR protocol with a sender and receiver window size of 1.

d. The alternating-bit protocol is the same as the GBN protocol with a sender and receiver window size of 1.

参考翻译

对以下问题回答是或否,并简要证明你的答案:

a.使用SR协议,发送方有可能接收到落在当前窗口之外的数据包的ACK。

b.使用GBN,发送方有可能接收到落在当前窗口之外的数据包的ACK。

c.发送端和接收端窗口大小均为1时,交换位协议与SR协议相同。

d.发送端和接收端窗口大小均为1时,交换位协议与GBN协议相同。

参考答案

a. 正确。假设sender在t0时刻窗口大小为3,发送的数据包是1、2、3;在t1时刻receiver收到数据包1、2、3并且发送这三个数据包的ACK;在t2时刻sender没有收到ACK发生超时,并且重新发送数据包1、2、3;在t3时刻receiver收到数据包1、2、3并且重新发送这三个数据包的ACK;在t4时刻sender收到了receiver在t1时刻发送的数据包1、2、3的ACK,并且其窗口变为4、5、6;而在t5时刻sender收到了receiver在t3时刻发送的数据包1、2、3的ACK;这个时刻收到的ACK已经超出了窗口之外。

b. 正确。可以根据a中的假设来考虑,本质上没有区别。

c. 正确。

d. 正确。SR、GBN和alternating-bit协议在发送窗口和接收窗口为1的情况下功能相同,窗口为1可以保证按照顺序接收数据包,排除出现乱序数据包的情况;此时的ACK只能是窗口内数据包的ACK。


3 EstimatedRTT

Chapter 3, P32. Consider the TCP procedure for estimating RTT. Suppose that α = 0.1 \alpha = 0.1 α=0.1. Let SampleRTT1 be the most recent sample RTT, let SampleRTT2 be the next most recent sample RTT, and so on.

a. For a given TCP connection, suppose four acknowledgments have been returned with corresponding sample RTTs: SampleRTT4, SampleRTT3, SampleRTT2, and SampleRTT1. Express EstimatedRTT in terms of the four sample RTTs.

b. Generalize your formula for n sample RTTs.

c. For the formula in part (b) let n approach infinity. Comment on why this averaging procedure is called an exponential moving average.

参考译文

考虑用于估计 RTT 的 TCP 过程。假设 α = 1 \alpha = 1 α=1,让 SampleRTT1 为最新的样本 RTT,让 SampleRTT2 为下一个最新的样本 RTT,依此类推。

a. 对于给定的 TCP 连接,假设已返回四个确认,并带有相应的样本 RTT:SampleRTT4、SampleRTT3、SampleRTT2 和 SampleRTT1。用四个样本 RTT 表示 EstimatedRTT。

b. 将公式推广到 n 个样本 RTT。

c. 对于 (b) 部分中的公式,让 n 趋近于无穷大。评论为什么此平均过程称为指数移动平均数。

参考答案
a.img

b. img

c. img

每一次样本的权重呈指数衰减。


4 GBN SR TCP

Chapter 3, P37. Compare GBN, SR, and TCP (no delayed ACK). Assume that the timeout values for all three protocols are sufficiently long such that 5 consecutive data segments and their corresponding ACKs can be received (if not lost in the channel) by the receiving host (Host B) and the sending host (Host A) respectively. Suppose Host A sends 5 data segments to Host B, and the 2nd segment (sent from A) is lost. In the end, all 5 data segments have been correctly received by Host B.
a. How many segments has Host A sent in total and how many ACKs has Host B sent in total? What are their sequence numbers? Answer this QUESTION for all three protocols.
b. If the timeout values for all three protocol are much longer than 5 RTT, then which protocol successfully delivers all five data segments in shortest time interval?

参考译文

比较 GBN、SR 和 TCP(无延迟 ACK)。假设这三种协议的超时值足够长,以便接收主机(主机 B)和发送主机(主机 A)分别可以接收 5 个连续的数据段及其相应的 ACK(如果没有在通道中丢失)。假设主机 A 向主机 B 发送 5 个数据段,而第 2 个段(从 A 发送)丢失。最后,所有 5 个数据段都被主机 B 正确接收。

a. 主机 A 总共发送了多少个段,主机 B 总共发送了多少个 ACK?它们的序列号是多少?针对这三种协议回答这个问题。

b. 如果这三种协议的超时值都远大于 5 RTT,那么哪种协议可以在最短的时间间隔内成功传送所有五个数据段?

参考答案
a.

GBN:

  • A一共发送了9个segment,开始发送序号为1、2、3、4、5的segment,在第2个segment丢失之后,发送序号为2、3、4、5的segment。

  • B发送了8个ACK,分别是四个序号为1的ACK和序号为2、3、4、5的ACK。

SR:

  • A一共发送了6个segment,开始发送序号为1、2、3、4、5的segment,在第2个segment丢失之后,发送序号为2的segment。

  • B发送了5个ACK,分别发送的是1、3、4、5的ACK,之后发送的是序号为2的ACK。

TCP:

  • A一共发送了6个segment,开始发送序号为1、2、3、4、5的segment,在第2个segment丢失之后,发送序号为2的segment。

  • B发送了5个ACK,分别发送的是四个序号为2的ACK,之后发送的是序号为6的ACK。

b. TCP,这是因为TCP使用快速重传,而不需要等待超时。


5 拥塞控制

Chapter 3, P40. Consider Figure 3.58 . Assuming TCP Reno is the protocol experiencing the behavior shown above, answer the following QUESTIONs. In all cases, you should provide a short discussion justifying your answer.

a. Identify the intervals of time when TCP slow start is operating.

b. Identify the intervals of time when TCP congestion avoidance is operating.

c. After the 16th transmission round, is segment loss detected by a triple duplicate ACK or by a timeout?

d. After the 22nd transmission round, is segment loss detected by a triple duplicate ACK or by a timeout?

e. What is the initial value of ssthresh at the first transmission round?

f. What is the value of ssthresh at the 18th transmission round?

g. What is the value of ssthresh at the 24th transmission round?

h. During what transmission round is the 70th segment sent?

i. Assuming a packet loss is detected after the 26th round by the receipt of a triple duplicate ACK, what will be the values of the congestion window size and of ssthresh?

j. Suppose TCP Tahoe is used (instead of TCP Reno), and assume that triple duplicate ACKs are received at the 16th round. What are the ssthresh and the congestion window size at the 19th round?

k. Again suppose TCP Tahoe is used, and there is a timeout event at 22nd round. How many packets have been sent out from 17th round till 22nd round, inclusive?

在这里插入图片描述

参考译文

考虑图 3.61。假设 TCP Reno 是经历上述行为的协议,回答以下问题。在所有情况下,您都应该提供一个简短的讨论来证明您的答案。

a. 确定 TCP 慢启动运行的时间间隔。

b. 确定 TCP 拥塞避免运行的时间间隔。

c. 在第 16 次传输轮次之后,是通过三重重复 ACK 还是超时检测到段丢失?

d. 在第 22 次传输轮次之后,是通过三重重复 ACK 还是超时检测到段丢失?

e. 第一个传输轮次中 ssthresh 的初始值是多少?

f. 第 18 次传输轮次中 ssthresh 的值是多少?

g. 第 24 次传输轮次中 ssthresh 的值是多少?

h. 第 70 个段是在哪个传输轮次发送的?

i.假设在第 26 轮之后通过收到三重重复 ACK 检测到数据包丢失,那么拥塞窗口大小和 ssthresh 的值是多少?

j. 假设使用 TCP Tahoe(而不是 TCP Reno),并假设在第 16 轮收到三重重复 ACK。第 19 轮的 ssthresh 和拥塞窗口大小是多少?

k. 再次假设使用 TCP Tahoe,并且在第 22 轮发生超时事件。从第 17 轮到第 22 轮(含)共发送了多少个数据包?

参考答案

a. [1,6],[23,26];

b. [6,16],[17,22];

c. 三个重复(duplicate)ACK。因为收到三个重复 ACK 后拥塞窗口的大小降至当前窗口的一半再加 3;从图上看第 16 轮拥塞窗口为 42,第 17 轮第拥塞窗口为 24(=42/2+3);

d. 超时。因为拥塞窗口大小被设置为 1;

e. 32.因为在第 16 轮,拥塞窗口的大小从指数增长转变为线性增长,即慢启动阶段(slow start)结束,进入拥塞避免(congestion avoidance)阶段。转变的条件是拥塞窗口大于拥塞阈值,16 轮时拥塞窗口为 32,所以拥塞阈值也是 32。

f. 21。第 16 轮时检测到 3 个重复 ACK,拥塞阈值下降为当前拥塞窗口的一半,拥塞窗口下降为当前拥塞窗口的一半再加 3,进入拥塞避免阶段。因此,第 17 轮开始,拥塞阈值为 21=(42/2).在第 16-18 轮间没有发生任何能够让阈值改变的事件,因此拥塞阈值 ssthresh 保持为 21;

g. 14。当发生超时后,拥塞阈值被设置为当前拥塞窗口的一半,拥塞窗口置为 1,进入慢启动阶段。第 22 轮发生了超时,当前拥塞窗口大小为 29,因此拥塞阈值被置为 14(=29/2),拥塞窗口置为 1,进入了慢启动阶段。第 24 轮依然在慢启动阶段,因此拥塞阈值仍为 14;

h. 第 7 轮。在第一轮发送中,发送分组 1;在第二轮发送分组 2-3;在第三轮发送分组 4-7;在第四轮发送分组 8-15;在第五轮发送分组 16-31;在第六轮发送分组 32-63;数据包 64-96 在第 7 轮传输中发送。因此,分组 70 在第 7 轮中被发送;

i. 拥塞阈值为 4,拥塞窗口为 7。当收到三个重复 ACK 时,拥塞阈值被设置为当前拥塞窗口值的一半,并且拥塞窗口被设置为当前拥塞窗口到一半再加 3。第 26 轮时,拥塞窗口为 8,因此,阈值和窗口的新值将分别为 4 和 7,进入拥塞避免阶段。

j. 阈值为 21,拥塞窗口大小为 4。TCP Tahoe 不区分丢包的原因。不管是收到三个重复 ACK,还是超时,都把拥塞阈值设置为当前拥塞窗口的一半,拥塞窗口置为 1,进入慢启动阶段。因此在第 16 轮收到 3 个重复 ACK 后,在第17 轮拥塞阈值会降为 21(=42/2),拥塞窗口降为 1,进入慢启动阶段。在第 19 轮时,拥塞窗口增长到 4.

k. 52;第 17 轮到第 22 轮,共 1+2+4+8+16+21=52 个包。从第 17 轮到第 21 轮,TCP Tahoe 处于慢启动阶段,拥塞窗口从 1 开始指数增加。在第 22 轮,拥塞窗口增加到 21 时,和阈值相等,不再指数增加,转为线性增加,进入拥塞避免阶段。此时发生超时,拥塞窗口在下一轮(第 23 轮)降到 1。因此在第 22 轮时拥塞窗口为 21。


第四五章

课堂小测

1 LS 路由算法

关于LS(Link State)路由算法,下列说法正确的是( )

  • A.路由算法的性能和网络规模无关。

  • B.当某链路状态发生改变,链路端节点只需要告知邻居节点,无需在全网中广播。

  • C.属于静态路由算法。

  • D.需要知道整个网络的拓扑结构(topology)和链路成本(link cost)。

参考答案 D

LS 使用 Dijkstra


2 尽力而为

Internet的网络层向传输层提供的服务具有哪些特点?( )

  • A.确保带宽(bandwidth guarantee)。

  • B.确保可靠(reliability)。

  • C.尽力而为(best effort)。

  • D.确保延迟(delay guarantee)

参考答案 C


3 NAT

关于NAT(Network Address Translation),下列说法正确的是( )

  • A.使用NAT的子网必须用DHCP(Dynamic Host Configuration Protocol)为上网的设备自动分配IP地址。

  • B.服务器不能放在内网,因为难以克服NAT穿越问题(NAT traversal problem)。

  • C.NAT的转换表(translation table)只能手工配置,不能自动配置。

  • D.可以在一定程度上缓解IP地址不够用的问题。

参考答案 D


4 路由算法

关于路由算法,下列说法正确的是( )

  • A.路由算法的性能评价参数需要根据设计需求来确定。

  • B.跳数(the number of hops)不能做为路由算法的性能评价参数。

  • C.路由算法负责为数据包从源节点到目的节点找到一条性能好的路径。因此必须知道全局的网络拓扑结构。

  • D.路由算法的性能对网络性能影响不大。

参考答案 A


5 子网

给定子网200.168.240/24,则该子网能支持的同时上网的用户数量和和子网掩码是多少

A.128; 255 255.255.0

B.126: 255.255.248.0

C.254; 255.255.255.0

D.256: 255.255.255.0

参考答案 C


6 DHCP

关于DHCP (Dynamic Host Configuration Protocol), 下列说法正确的是

A. DHCP采用四次握手(four-way handshaking)的方式为设备分配IP地址

B. DHCP为上网的设备自动分配IP地址,不提供其他信息。

C. DHCP不需要用户配置,是即插即用型的(Plug-and-play)

D. 在一个规模较大的子网中通常会部署多个DHCP server,共同管理可以分配的IP地址

参考答案 ACD


7 网络层功能

网络层的主要功能有

A. 为数据包传输传输建立一条逻辑的端到端的路径

B. 转发(forwarding)

C. 端到端(end-to-end)的数据传输

D. 路由(routing)

参考答案 BD


8 数据/控制平面

关于网络层,下列说法正确的是

A.不同物理介质(physical media)的网络如果要互联(interetworking),那么在网络层也可以使用不同的IP协议,

B.IP协议维护转发表(forwarding table)

C.网络层的数据平面(data piane)负责转发(forwarding),控制平面(control plane)负责路由(routing)。

D.路由器(router)和交换机(switch)都是网络层的互联设备。

参考答案 C


9 路由协议

关于Internet的路由协议,下列说法正确的是

A. Internet的路由协议是层次型的(hierarchical),Inter-AS(域间)和Intra-AS(域内)路由协议的设计目标不同。

B. BGP(Border Gateway Protocol)的设计目标是优化路由的性能

C. OSPF(Open Shortest Path First)是一种域间路由协议

D. RIP(Routing Information Path)是域内路由协议,采用链路状态(link state)路由算法

参考答案 A


课后作业

1 子网

Chapter 4 P14. Consider a subnet with prefix 128.119.40.128/26. Give an example of one IP address (of form xxx.xxx.xxx.xxx ) that can be assigned to this network. Suppose an ISP owns the block of addresses of the form 128.119.40.64/26. Suppose it wants to create four subnets from this block, with each block having the same number of IP addresses. What are the prefixes (of form a.b.c.d/x) for the four subnets?

参考翻译

考虑一个前缀为128.119.40.128/26的子网。举例说明一个IP地址(形式为xxx.xxx.xxx.xxx)可以分配给该网络。假设某ISP拥有128.119.40.64/26形式的地址块。假设它想从这个块创建四个子网,每个块具有相同数量的IP地址。这四个子网的前缀(形式为a.b.c.d/x)是什么?

参考答案

128.119.40.128—128.119.40.191之间的任意地址都可以。
分好的IP地址数目相同的四个子网为:128.119.40.64/28, 128.119.40.80/28, 128.119.40.96/28, 128.119.40.112/28


2 路由器转发表

Chapter 4 P15. Consider the topology shown in Figure 4.20 . Denote the three subnets with hosts (starting clockwise at 12:00) as Networks A, B, and C. Denote the subnets without hosts as Networks D, E, and F.

a. Assign network addresses to each of these six subnets, with the following constraints: All addresses must be allocated from 214.97.254/23; Subnet A should have enough addresses to support 250 interfaces; Subnet B should have enough addresses to support 120 interfaces; and Subnet C should have enough addresses to support 120 interfaces. Of course, subnets D, E and F should each be able to support two interfaces. For each subnet, the assignment should take the form a.b.c.d/x or a.b.c.d/x – e.f.g.h/y.

b. Using your answer to part (a), provide the forwarding tables (using longest prefix matching) for each of the three routers.

参考翻译

考虑图4.20所示的拓扑。将有主机的三个子网分别命名为网络A、网络B、网络c (从12:00顺时针方向开始)。将没有主机的三个子网分别命名为网络D、网络E、网络F。

a.为这六个子网分别分配网络地址,限制条件如下:所有地址必须从214.97.254/23开始分配;子网A应该有足够的地址来支持250个接口;子网B应该有足够的地址支持120个接口;子网C应该有足够的地址来支持120个接口。当然,子网D、E和F都应该能够支持两个接口。对于每个子网,分配应该采用a.b.c.d/x或a.b.c.d/x - e.f.g.h/y的形式。

b.使用你对(a)部分的回答,提供三个路由器的转发表(使用最长前缀匹配)。

在这里插入图片描述

参考答案

img

答案解析

imgimg


3 NAT

Chapter 4 P18. Consider the network setup in Figure 4.25 . Suppose that the ISP instead assigns the router the address 24.34.112.235 and that the network address of the home network is 192.168.1/24.

a. Assign addresses to all interfaces in the home network.

b. Suppose each host has two ongoing TCP connections, all to port 80 at host 128.119.40.86. Provide the six corresponding entries in the NAT translation table.

在这里插入图片描述

参考翻译

考虑图4.25中的网络设置。假设ISP给路由器分配的地址为24.34.112.235,家庭网络的网络地址为192.168.1/24。

a.为家庭网络中的所有接口分配地址。

b.假设每台主机有两个正在进行的TCP连接,都连接到主机128.119.40.86的80端口。提供NAT转换表中对应的6个表项

参考答案

a.图4.25中家庭网络中有三台主机,可以将IP地址设为192.168.1.2, 192.168.1.3,192.168.1.4。对应的路由器接口为192.168.1.1。

b. 因为每台主机有两个TCP连接,因此每台主机在NAT转换表中对应两个表项。三台主机在WAN端地址相同,端口不同。对应的NAT 转换表为:

WAN端LAN端
24.34.112.235, 4000192.168.1.2, 3445
24.34.112.235, 4001192.168.1.2, 3446
24.34.112.235, 4002192.168.1.3, 3545
24.34.112.235, 4003192.168.1.3, 3546
24.34.112.235, 4004192.168.1.4, 3545
24.34.112.235, 4005192.168.1.4, 3546

4 LS 路由算法

Chapter5 P3. Consider the following network. With the indicated link costs, use Dijkstra’s shortest-path algorithm to compute the shortest path from x to all network nodes. Show how the algorithm works by computing a table similar to Table 5.1 .

在这里插入图片描述

参考翻译

考虑下面的网络。根据指示的链路开销,使用Dijkstra的最短路径算法计算从x到所有网络节点的最短路径。通过计算一个类似于表5.1的表来展示算法是如何工作的。

参考答案

如下表所示:

StepND(t),p(t)D(u),p(u)D(v),p(v)D(w),p(w)D(y),p(y)D(z),p(z)
0x3,x6,x6,x8,x
1xv7,v6,v6,x6,x8,x
2xvu7,v6,x6,x8,x
3xvuw7,v6,x8,x
4xvuwy7,v8,x
5xvuwyt8,x
6xvuwytz

5 DV 路由算法

Chapter5 P8. Consider the three-node topology shown in Figure 5.6 . Rather than having the link costs shown in Figure 5.6 , the link costs are c(x,y)=3, c(y,z)=6, c(z,x)=4. Compute the distance tables after the initialization step and after each iteration of a synchronous version of the distance vector algorithm (as we did in our earlier discussion of Figure 5.6 ).
img

参考翻译

考虑图5.6所示的三节点拓扑。与图5.6所示的链接成本不同,链接成本为c(x,y)=3, c(y,z)=6, c(z,x)=4。在初始化步骤之后和距离矢量算法的同步版本的每次迭代之后计算距离表(就像我们在前面的图5.6中讨论的那样)。

参考答案

三个节点都只需要一次迭代,其迭代步骤如下:
img


6 路由协议

Chapter5 P14. Consider the network shown below. Suppose AS3 and AS2 are running OSPF for their intra-AS routing protocol. Suppose AS1 and AS4 are running RIP for their intra-AS routing protocol. Suppose eBGP and iBGP are used for the inter-AS routing protocol. Initially suppose there is no physical link between AS2 and AS4.

a. Router 3c learns about prefix x from which routing protocol: OSPF, RIP, eBGP, or iBGP?

b. Router 3a learns about x from which routing protocol?

c. Router 1c learns about x from which routing protocol?

d. Router 1d learns about x from which routing protocol?

img

参考翻译

考虑如下所示的网络。假设AS3和AS2的as内路由协议运行OSPF。假设AS1和AS4的内部路由协议是RIP。假设as间路由协议采用eBGP和iBGP。假设AS2和AS4之间没有物理连接。

a.路由器3c从哪个路由协议学习到前缀x,是OSPF、RIP、eBGP还是iBGP?

b.路由器3a从哪个路由协议学习到x ?

c.路由器1c从哪个路由协议中了解到x ?

d.路由器1d从哪个路由协议学习到x ?

参考答案

AS4和AS3是两个不同的AS,所以他们之间互相学习路由需要通过BGP,3c与AS4相邻,跨越两个AS,所以3c通过eBGP(external BGP session)学习到x,3a和3b并不与AS4相邻,需要通过iBGP(internal BGP session)才可以学习到x。

同理,1c与3a有eBGP邻居关系所以1c通过eBGP学习到x,1a、1d和1b则通过iBGP学习到x。因此:

a.3c通过eBGP学习到x

b.3a通过iBGP学习到x

c.1c通过eBGP学习到x

d.1d通过iBGP学习到x


第六章

课堂小测

1 交换机

关于交换机(switch),下列说法正确的是( )。

  • A.交换机是数据链路层的网络互联设备。

  • B.交换机的转发表采用自学习(self-learning)的方式更新,即交换机向所有端口广播查询包,与之匹配的节点也以广播的方式发回响应帧。

  • C.交换机的转发表(forwarding table)和路由器的转发表的内容是一样的。

  • D.交换机的每个端口都配置有MAC地址和IP地址。

参考答案 A


2 数据链路层

关于数据链路层,下列说法错误的是( )

  • A.802.11无线网络和以太网(Ethernet)的数据链路层是相同的。

  • B.路由器的每个接口运行的链路层协议可能是不同的,因此帧的结构也可能不同。

  • C.端系统(end system)的链路层的主要功能在网卡(NIC,Network Interface Card)中实现。

  • D.路由器有几个接口(Interface),就有几个链路层的实现。

参考答案 A


3 CSMA/CD

CSMA/CD(collision detection)是传统以太网(Ethernet)所采用的MAC协议,下列说法正确的是( )

  • A.CSMA/CD在数据帧发送过程中如果检测到冲突,仍然继续发送数据帧直到发送完毕。

  • B.CSMA/CD在有数据要发送时就检测信道,如果信道忙(channel busy)就随机退避(backoff)一段时间再继续检测。

  • C.以太网在数据发送过程中能够很容易地检测(detect)到冲突(collision)。

  • D.CSMA/CD需要预先知道共享信道的用户数量,才能有效避免冲突。

参考答案 C

第一次等,不退避

开始发了之后使用二进制指数退避


4 ARP

关于ARP(Address Resolution Protocol)协议,下列说法正确的是( )

  • A.ARP采用广播的方式发布ARP 查询包(ARP query),IP地址与之相匹配的节点也以广播的方式发回响应帧。

  • B.ARP把数据包携带的目的IP地址转换成MAC地址。

  • C.ARP通过设置TTL(Time To Live)实现ARP表项的自动更新。

  • D.ARP采用分布式数据库的方式存储(IP,MAC)项。

参考答案 C


5 MAC协议

MAC(Multiple Access Control)协议大致可以分成三种类型:信道划分(channel partitioning)型、随机访问 (random access)型和轮流型(taking turns),下列说法正确的是( )

  • A.轮流型的MAC协议既不会产生冲突,又能充分利用信道资源。

  • B.这些MAC协议类型中只有随机访问中的CSMA协议还在应用,其它都不再应用了。

  • C.信道划分型的MAC协议没有冲突(collision),其它两类都会产生冲突。

  • D.随机访问型的MAC协议信道利用率低,又会产生冲突,没有任何实用价值。

参考答案 A


6 连续传输过程

当你使用电脑在线看电影时,电影视频数据包源源不断地从服务器发送到你的电脑。下列说法正确的是( )。

  • A.所有视频数据包所经历的端到端延迟都是相同的。

  • B.所有视频数据包都经历了相同的路由器。

  • C.视频数据包的源IP地址和目的IP地址在传输过程中不改变(不考虑VPN/NAT)。

  • D.视频数据包的源MAC地址和目的MAC地址在传输过程中不改变。

参考答案 C


7 链路层功能

数据链路层的主要功能有( )

  • A.数据帧封装。

  • B.把数据帧传输到相邻的下一个节点。

  • C.信道共享,即为共享同一条链路的多个用户分配链路资源。

  • D.把数据帧转换成模拟信号发送到链路上。

参考答案 ABC


课后作业

1 CSMA/CD

Chapter 6, R6. In CSMA/CD, after the fifth collision, what is the probability that a node chooses k=4? The result k=4 corresponds to a delay of how many seconds on a 10 Mbps Ethernet?

参考翻译

在CSMA/CD中,在第五次碰撞后,节点选择k=4的概率是多少?在10mbps的以太网上,结果k=4对应的延迟是多少秒?

微信图片_20220606122826.png


2 ARP

Chapter 6, P15. Consider Figure 6.33. Now we replace the router between subnets 1 and 2 with a switch S1, and label the router between subnets 2 and 3 as R1.

a、 Consider sending an IP datagram from Host E to Host F. Will Host E ask router R1 to help forward the datagram? Why? In the Ethernet frame containing the IP datagram, what are the source and destination IP and MAC addresses?

b、 Suppose E would like to send an IP datagram to B, and assume that E’s ARP cache does not contain B’s MAC address. Will E perform an ARP query to find B’s MAC address? Why? In the Ethernet frame (containing the IP datagram destined to B) that is delivered to router R1, what are the source and destination IP and MAC addresses?

c、 Suppose Host A would like to send an IP datagram to Host B, and neither A’s ARP cache contains B’s MAC address nor does B’s ARP cache contain A’s MAC address. Further suppose that the switch S1’s forwarding table contains entries for Host B and router R1 only. Thus, A will broadcast an ARP request message. What actions will switch S1 perform once it receives the ARP request message? Will router R1 also receive this ARP request message? If so, will R1 forward the message to Subnet 3? Once Host B receives this ARP request message, it will send back to Host A an ARP response message. But will it send an ARP query message to ask for A’s MAC address? Why? What will switch S1 do once it receives an ARP response message from Host B?

在这里插入图片描述

参考翻译

考虑图6.33。现在我们用交换机S1替换子网1和2之间的路由器,并将子网2和3之间的路由器标记为R1。

a、考虑从主机E向主机f发送一个IP数据报。主机E会请求路由器R1帮助转发这个数据报吗?为什么?在包含IP数据报的以太网帧中,源和目的IP地址和MAC地址是什么?

b、假设E想要发送一个IP数据报给b,并且假设E的ARP缓存中不包含b的MAC地址。E会执行ARP查询来查找B的MAC地址吗?为什么?在发送给路由器R1的以太网帧(包含目的地为B的IP数据报)中,源和目的IP地址和MAC地址是什么?

c、假设主机A想向主机B发送一个IP数据报,并且A的ARP缓存中既不包含B的MAC地址,B的ARP缓存中也不包含A的MAC地址。进一步假设交换机S1的转发表只包含主机B和路由器R1的转发表项。因此,A将广播一条ARP请求消息。交换机S1接收到ARP请求消息后会做什么动作?路由器R1也会收到这个ARP请求消息吗?如果是,R1会将消息转发给子网3吗?一旦主机B收到这个ARP请求消息,它将向主机A发送一个ARP响应消息。但是它会发送一个ARP查询消息来请求A的MAC地址吗?为什么?一旦交换机S1从主机B接收到ARP响应消息,它会做什么?

参考答案

a、

不会。E会检查F的IP地址的子网前缀,了解到F在同一局域网内的。

源IP=E的IP地址,目的IP=F的IP地址;

源MAC=E的MAC地址,目的MAC=F的MAC地址。

b、

不会。因为它们不在同一个局域网内,E通过检查B的IP地址可以发现这一点。

源IP=E的IP地址,目的IP=B的IP地址;

源MAC=E的MAC地址,目的MAC=R1与E连接的接口的MAC地址。

c、

交换机S1将通过两个接口广播以太网帧,因为接收到的ARP帧的目的地址是广播地址。它了解到A在连接到子网1内,并将关于A的条目写入转发表中。

是的,路由器R1也会接收到这个ARP请求,但是R1不会将消息转发到子网3。

B不会发送请求A的MAC地址的ARP查询消息,因为这个地址可以从A的查询消息中获得。

一旦交换机S1接收到B的响应消息,它将在其转发表中为主机B添加一个条目,然后删除接收到的帧,因为目的地主机A与主机B在同一个接口上(即A和B位于同一个LAN段上)。


3 交换机自学习

Chapter 6, P26. Let’s consider the operation of a learning switch in the context of a network in which 6 nodes labeled A through F are star connected into an Ethernet switch. Suppose that (i) B sends a frame to E, (ii) E replies with a frame to B, (iii) A sends a frame to B, (iv) B replies with a frame to A. The switch table is initially empty. Show the state of the switch table before and after each of these events. For each of these events, identify the link(s) on which the transmitted frame will be forwarded, and briefly justify your answers.

参考翻译

让我们考虑这样一个网络中的学习交换机的操作,其中6个标记为a到F的节点星形连接到以太网交换机。假设:

(i) B发送一个帧给E

(ii) E回复一个帧给B

(iii) a发送一个帧给B

(iv) B回复一个帧给a

交换表初始为空。显示这些事件前后交换表的状态。对于这些事件中的每一个,确定传输帧将被转发的链路,并简要地证明你的答案。

参考答案

(1) B向E发送帧,交换机能学到B的MAC地址对应的interface,该帧会被传输到A、C、D、E、F五个interface;解释:由于此时switch table是空的,交换机不知道E对应的interface是什么。

(2) E向B回复帧,交换机能学到E的MAC地址对应的interface,该帧会被发送到B;解释:通过B向E发送帧这个过程,交换机已经知道B对应的interface。

(3) A向B发送帧,交换机能学到A的MAC地址对应的interface,该帧会被发送到B;解释:通过B向E发送帧这个过程,交换机已经知道B对应的interface。

(4) B向A回复帧,switch table没有变化,该帧会被发送到A;解释:通过A向B发送帧这个过程,交换机已经知道A对应的interface。


书后习题

1 ARP

P14,如图 6-33 所示,考虑通过两台路由器互联的3个局域网。

a.对所有的接口分配 IP 地址。对子网1使用形式为 192.168.1.xxx 的地址,对子网2 使用形式为192.168.2.xxx 的地址,对子网3 使用形式为 192.168.3.xxx 的地址

b.为所有的适配器分配 MAC 地址

c. 考虑从主机E向主机B发送一个 IP数据报。假设所有的 ARP 表都是最新的。就像在6.4.1节中对单路由器例子所做的那样,列举出所有步骤

d.重复©,现在假设在发送主机中的 ARP 表为空(并且其他表都是最新的)。

在这里插入图片描述

参考答案

a), b) See figure below.

在这里插入图片描述

c)

  1. Forwarding table in E determines that the datagram should be routed to interface 192.168.3.002.

  2. The adapter in E creates and Ethernet packet with Ethernet destination address 88- 88-88-88-88-88.

  3. Router 2 receives the packet and extracts the datagram. The forwarding table in this router indicates that the datagram is to be routed to 198.162.2.002.

  4. Router 2 then sends the Ethernet packet with the destination address of 33-33-33- 33-33-33 and source address of 55-55-55-55-55-55 via its interface with IP address of 198.162.2.003.

  5. The process continues until the packet has reached Host B.

  6. E中的转发表确定数据报应该路由到接口192.168.3.002。

  7. E中的适配器创建一个以太数据包,其目的地址为88-88-88-88-88-88。

  8. router2接收到该报文并提取数据报。该路由器的转发表指示该数据报要路由到198.162.2.002。

  9. 路由器2通过IP地址为198.162.2.003的接口发送目的地址为33-33-33-33-33,源地址为55-55-55-55-55-55的以太网报文。

  10. 这个过程一直持续到数据包到达主机B。

d) ARP in E must now determine the MAC address of 198.162.3.002. Host E sends out an ARP query packet within a broadcast Ethernet frame. Router 2 receives the query packet and sends to Host E an ARP response packet. This ARP response packet is carried by an Ethernet frame with Ethernet destination address 77-77-77-77-77-77.

E中的ARP现在必须确定198.162.3.002的MAC地址。主机E在广播以太网帧内发送ARP查询报文。路由器2收到查询报文后,向主机E发送ARP响应报文。该ARP响应报文由目的地址为77-77-77-77-77-77的以太网帧携带。


2 CSMA/CD

P17 使用 CSMA/CD 协议,适配器在碰撞之后等待K·512 比特时间,其中K是随机选取的对于K=100,对于一个 10Mbps 的广播信道,适配器返回到第二步要等多长时间?对于 100Mbps 的广播信道来说呢?

在这里插入图片描述


第七章

课堂小测

1 CSMA/CA

下列关于CSMA/CA协议说法错误的是( )

  • A.在数据帧发送过程中能够检测到信道冲突(collision)。

  • B.监测到信道忙时,随机等待一段时间再继续监测信道。

  • C.在发送数据帧前先侦听信道的状态。

  • D.使用停-等(Stop-and-Wait)可靠传输来应对信道冲突产生的丢包。

参考答案 A


2 无线链路特征

无线链路的特征不包括下列哪项:( )

  • A.在同一频段发送信号的电磁波将相互干扰。

  • B.递减的信号强度

  • C.多路径传播

  • D.电磁波在穿过物体时强度不会减弱

参考答案 D


课后作业

1 802.11 ACK

Chapter7 R7. Why are acknowledgments used in 802.11 but not in wired Ethernet?

参考翻译

为什么在802.11中使用确认,而在有线以太网中不使用?

参考答案

在无线网络中信号衰落、多径传播和干扰等问题比较严重,导致无线网络的误码率较高,因此 802.11网络使用了确认机制。而有线的以太网信道非常稳定,误码率非常低,所以没有使用确认机制。


2 CSMA/CA

Chapter7 P6. In step 4 of the CSMA/CA protocol, a station that successfully transmits a frame begins the CSMA/CA protocol for a second frame at step 2, rather than at step 1. What rationale might the designers of CSMA/CA have had in mind by having such a station not transmit the second frame immediately (if the channel is sensed idle)?

参考翻译

在CSMA/CA协议的第4步中,成功传输一帧的站在第2步开始CSMA/CA协议的第二帧,而不是在第1步。CSMA/CA的设计者有什么理由让这样一个站不立即传输第二帧(如果信道被检测到空闲)?

参考答案

为了避免冲突

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值