2022年2022年计算机网络课后习题习题五 .pdf
Chapter five 第五章习题38.Convert the IP address whose hexadecimal representation is C22F1582 to dotted decimal notation.(38. 如果一个 IP地址的十六进制表示C22F1582,请将它转换成点分十进制标记.) Solution:The address is 194.47.21.130. 解答:先写成二进制:11000010,0010101111,0001010,10000010 所以,它的点分十进制为:194.47.21.13039. A network on the Internet has a subnet mask of 255.255.240.0. What is the maximum number of hosts it can handle? (39.Interent上一个网络的子网掩码为255.255.240.0.请问它最多能够处理多少台主机?) Solution:The mask is 20 bits long, so the network part is 20 bits. The remaining 12 bits are for the host, so 4096 host addresses exist. Normally, the host address is 4096-2=4094. Because the first address be used for network and the last one for broadcast. 解答:从子网掩码 255.255.240.0可知,它还有 12位用于作主机号。故它的容量有 2的12次方,也即有4096地址。除去全 0 和全 1 地址,它最多能够处理4094 台主机40. A large number of consecutive IP address are available starting at 198.16.0.0. Suppose that four organizations, A, B, C, and D, request 4000, 2000, 4000, and 8000 addresses, respectively, and in that order. For each of these, give the first IP address assigned, the last IP address assigned, and the mask in the w.x.y.z/s notation. (40. 假定从 198.16.0.0开始有大量连续的IP地址可以使用. 现在 4个组织 A,B,C 和D 按照顺序依次申请 4000,2000,4000 和8000个地址 .对于每一个申请, 请利用 w.x.y.z/s的形式写出所分配的第一个 IP地址 ,以及掩码 . )Solution:To start with, all the requests are rounded up to a power of two. The starting address, ending address, and mask are as follows: A: 198.16.0.0 198.16.15.255 written as 198.16.0.0/20 B: 198.16.16.0 198.23.15.255 written as 198.16.16.0/21 C: 198.16.32.0 198.16. 47.255 written as 198.16.32.0/20 D: 198.16.64.0 198.16.95.255 written as 198.16.64.0/19 解答:因为只能是 2的整数次方的, 故应分别借 4096,2048,4096,8192个IP地址。它们分别为2的12名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 5 页 - - - - - - - - - 次方 ,2 的11次方 ,2 的11次方 ,2 的13次方 .故可有如下分配方案:组织首地址末地址w.x.y.z/s的形式A 198.16.0.0 198.16.15.255 198.16.0.0/20 B 198.16.16.0 198.16.23.255 198.16.16.0/21 C 198.16.32.0 198.16.47.255 198.16.32.0/20 D 198.16.64.0 198.16.95.255 198.16.64.0/19 41. A router has just received the following new IP addresses: 57.6.96.0/21, 57.6.104.0/21, 57.6.112.0/21, and 57.6.120.0/21. If all of them use the same outgoing line, can they be aggregated? If so, to what? If not, why not? (41. 一台路由器刚刚接收到一下新的IP地址 :57.6.96.0/27,57.6.104.0/21,57.6.112.0/21和57.6.120.0/21.如果所有这些地址都使用同一条输出线路, 那么 , 它们可以被聚集起来吗?如果可以的话 , 它们被聚集到那个地址上?如果不可以的话, 请问为什么 ?)Solution:They can be aggregated to 57.6.96/19. 解答:96=(0110 0000)2 104=(0110 0100)2 112=(0110 1000)2 120=(0110 1110)2 可以看出,四个IP 地址前 19位都是相同的(前面57的8位以及 6的8位和后面 011这3位,共 19位)故得聚合到地址 57.6.96.0/19 上。42. The set of IP addresses from 29.18.0.0 to 19.18.128.255 has been aggregated to 29.18.0.0/17. However, there is a gap of 1024 unassigned addresses from 29.18.60.0 to 29.18.63.255 that are now suddenly assigned to a host using a different outgoing line. Is it now necessary to split up the aggregate address into its constituent blocks, add the new block to the table, and then see if any reaggregation is possible? If not, what can be done instead? (42. 从29.18.0.0到29.18.128.255之间的 IP地址集合已经被聚集到29.18.0.0/17.然而 , 这里有一段空隙地址,即从 29.18.60.0到29.18.63.255之间的 1024个地址还没有被分配. 现在这段空隙地址突然要被分配给一台使用不同输出线路的主机. 请问是否有必要将聚集地址分割成几块 ,然后把新的地址块加入到路由表中, 再看一看是否可以重新聚集?如果没有必要的话, 那该怎么办 ?) Solution:It is sufficient to add one new table entry: 29.18.0.0/22 for the new block. If an incoming packet matches both 29.18.0.0/17 and 29.18.0.0./22, the longest one wins. This rule makes it possible to assign a large block to one outgoing line but make an exception for one or more small blocks within its range. 解答:名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 5 页 - - - - - - - - - 没有必要。只要在路由表中添加一项:29.18.0.0/22 就可以了。当有一个分组到来时,如果它既匹配 29.18.0.0/17,又匹配 29.18.0.0/22,那么它将被发送到掩码位数较大的目标地址,即29.18.0.7/22。这样做的好处是使得一个大段的地址能够被指定到一个目标,但又允许其中少量的地址出现例外的情况。43. A router has the following (CIDR) entries in its routing table: Address/mask Next hop 135.46.56.0/22 Interface 0 135.46.60.0/22 Interface 1 192.53.40.0/23 Router 1 default Router 2 For each of the following IP addresses, what does the router do if a packet with that address arrives? a. (a) 135.46.63.10 b. (b) 135.46.57.14 c.(c) 135.46.52.2 d. (d) 192.53.40.7 e. (e) 192.53.56.7 43. 一台路由器的路由表中有以下的(CIDR )表项:地址 / 掩码下一跳135.46.56.0/22 接口 0135.46.60.0/22 接口 1192.53.40.0/23 路由器 1默认路由器 2对于下面的每一个IP地址, 请问, 如果一个到达分组的目标地址为该IP地址, 那么路由器该怎么办?(a)135 4663 10 (b)135 4657 14 (c)135 4652 2 (d)192 5340 7 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 5 页 - - - - - - - - - (e)192 5356 7Solution:The packets are routed as follows: (a) Interface 1 (b) Interface 0 (c) Router 2 (d) Router 1 解答:(a)135.46.63.10和255.255.252.0做与运算得到 135.16.60.0,故发送给接口1;(b)135.46.57.14和255.255.252.0做与运算得到 135.16.56.0,故发送给接口0;(c)135.46.52.2和 255.255.252.0做与运算得到135.16.52.0,故发送给路由器2;(d)135.53.40.7和 255.255.254.0做与运算得到135.53.40.0,故发送给路由器1;(e)135.53.56.7和 255.255.254.0做与运算得到135.53.56.0,故发送给路由器2。第四章习题24.Some books quote the maximum size of an Ethernet frame as 1518 bytes instead of 1500 bytes. Are they wrong? Explain your answer. (24有些书将以太网帧的最大长度说成是1518 字节, 而不是 1500 字节, 这些书错了吗?请说明你的理由。 )Solution:The payload is 1500 bytes, but when the destination address, source address, type/length, and checksum fields are counted too, the total is indeed 1518. 解答:没错, 以太网帧的最大净荷为1500 字节,算上目标地址6 字节、 源地址 6 字节、 类型2 字节、校验和 4 字节,则为 1518 字节。不同的书常可能出现题目中的两种不同的表述,但它们的实质是一样的。42 Briefly describe the difference between store-and-forward and cut-through switches. (简略地描述一下存储-转发型交换机和直通型交换机之间的区别。)Solution:A store-and-forward switch stores each incoming frame in its entirety, then examines it and forwards it. A cut-through switch starts to forward incoming frames before they have arrived completely. As soon as the destination address is in, the forwarding can begin. 解答:名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 5 页 - - - - - - - - - 存储转发:整个帧完整接收并存储到缓冲区,对整个帧进行差错检验,然后再查表找出目的端口并转发。优点是进行差错校验,错误不会扩散到目的网段,缺点是交换延迟比较大。直通式:因为转发仅依赖于目的地址目标地址,所以只要收到帧的前6 个字节 (目标地址字段),就可查表找出目的端口并转发。优点是交换延迟小,缺点是无法进行差错校验,帧错误会扩散到目的网段。43 Store-and-forward switches have an advantage over cut-through switches with respect to damaged frames. Explain what it is.(从损坏帧的角度而言,存储-转发型交换机比起直通型交换机更有优势。请说明这种优势是什么。)Solution:43. Store-and-forward switches store entire frames before forwarding them. After a frame comes in, the checksum can be verified. If the frame is damaged, it is discarded immediately. With cut=through, damaged frames cannot be discarded by the switch because by the time the error is detected, the frame is already gone. Trying to deal with the problem is like locking the barn door after the horse has escaped.解答:存储 -转发型交换机会对已经到达的帧进行检验,若发现帧有损坏,则将其丢弃;直通型交换机在一帧的目标头域进来时就开始转发,当发现传输帧有错误的时候,这个帧已经被传输出去了,这样就不能丢弃错误的帧了。名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 5 页 - - - - - - - - -