计网个人作业04

R13.

Suppose Host A sends Host B a TCP segment encapsulated in an IP datagram. When Host B receives the datagram, how does the network layer in Host B know it should pass the segment (that is, the payload of the datagram) to TCP rather than to UDP or to something else?

假定主机A向主机B发送封装在一个IP数据报中的TCP报文段. 当主机B接受到该数据报时, 主机B中的网络层怎样知道它应当将该报文段(即数据报的有效载荷)交给TCP而不是UDP或某个其他东西呢

  • 主机B中的网络层通过查看数据报首部字段中的协议字段,把数据部分交给特定的运输层协议。 6 对应 TCP, 17 对应 UDP
  • 协议字段相当于运输层报文段首部的目的端口号,其只是数据交给对应的套接字,链路层的链路层帧同样有特殊字段绑定链路层和网络层

16.

Suppose an application generates chunks of 40 bytes of data every 20 msec, and each chunk gets encapsulated in a TCP segment and then an IP datagram. What percentage of each datagram will be overhead, and what percentage will be application data?

假设某应用每20ms生成一个40字节的数据块, 每块封装在一个TCP报文段中, TCP报文段再封装在一个IP数据报中. 每个数据报的开销有多大? 应用数据所占的百分比是多少?

  1. TCP报文段首部字段:20字节
  2. 数据报首部字段: 20字节
  3. 每个数据包开销为80字节,应用数据占比50%

R20.

Suppose you purchase a wireless router and connect it to your cable modem. Also suppose that your ISP dynamically assigns your connected device (that is, your wireless router) one IP address. Also suppose that you have five PCs at home that use 802.11 to wirelessly connect to your wireless router. How are IP addresses assigned to the five PCs? Does the wireless router use NAT? Why or why not?

假定你买了一个无线路由器并将其与电缆调制解调器相连.
同时假定ISP动态地为你连接的设备(即你的无线路由器)分配一个IP地址. 还假定你家有5台PC, 均使用802.11(WIFI)以无线方式与该无线路由器相连. 怎样为这5台PC分配IP地址? 该无线路由器使用NAT吗? 为什么?

  • 这五台PC地址回通过请求DHCP服务器获得
  • 该无线路由器会使用NAT,家庭网络可能会随时添加许多联网设备,常用NAT管理这些设备的IP地址

R22.

Compare and contrast link-state and distance-vector routing algorithms.

比较和对照链路状态和距离矢量这两种路由选择算法

链路状态 距离矢量
要求 需要全局信息,需要在节点中存储⽹络中每条链路的费⽤ 节点仅与相邻节点交互,接受向量并更新⾃身的距离向量表,并在其变化时将新向量发送给⾃⼰的邻居。
复杂性
收敛速度
Robotness

R24.

Why are different inter-AS and intra-AS protocols used in the Internet?

为什么在因特网中用到了不同的AS间与AS内部协议?

  • AS内部端系统之间传播距离短,不同AS之间传播距离长。距离长短影响协议的性能,AS内部路由多用OSPF——一个链路状态protocol,用于子网内路由选择。AS间多用BGP——边界网关协议,类似距离向量路由选择协议
  • 策略:AS之前,策略问题站主导作用,给定AS产生的流量不能穿过另一个AS。
    • BGP继承路径属性,提供路由选择信息受控分布,便于做出基于策略的路由选择决策
    • 而AS内部,一切操作基于相同的管理控制名义,策略问题在AS内部微不足道
  • 规模:扩展路由选择算法和数据结构处理网络间路由选择的能力是AS之间路由选择的问题
    -AS内部可扩展性不是重点,单个ISP过大会将其分为两个AS,然后再这两个新的AS之间执行AS间路由选择
  • 性能: AS间路由选择面向策略,路由质量为次要问题。
    • AS之间几乎没有路由开销
    • AS内部,可以让路由选择多关注路由实现的性能

R25.

Consider Figure 4.35. Starting with the original table in D, suppose that D receives from A the following advertisement:

Destination Subnet Next Router Number of Hops to Destination
z C 10
w - 1
x - 1

Will the table in D change? If so how?

不会修改向量表。

这个通告表示:D可以在11跳到达z,若选择A作为下一条, D的距离向量表中已存储了在选择 B 作为下⼀跳时可以 7 跳到达 z 的信息,比11跳短,所以不会修改

P11.

Consider a datagram network using 8-bit host addresses. Suppose a router uses longest prefix matching and has the following forwarding table:

|Prefix Match |Interface|
|–|–|–|
|1|0|
|11|1|
|111|2|
|otherwise| 3|

  1. 首先首部为111的先去匹配2号端口,即111 00000 - 111 11111的32个地址
  2. 剩余首部为11的地址匹配1号端口 11 000000 - 11 011111的32个地址
  3. 最后首部为1的匹配0号端口10000000 - 10 111111的64个地址
  4. 其余00000000 - 01111111的128个地址匹配3号端口
    For each of the four interfaces, give the associated range of destination host addresses and the number of addresses in the range.

P13.

Consider a subnet with prefix 101.101.101.64/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 101.101.128/17. 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?

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

  • 101.101.101.64 = 01100101 01100101 01100101 01000000
  • 子网掩码: 01100101 01100101 01100101 01

所以可以分配给这个子网的IP地址可以从尾号 000001111111(000000已被占用)
所以其中一个IP可以为101.101.101.65

  • 由于要在此分配四个子网IP要相同
    101.101.128 = 01100101 01100101 10000000
    子网掩码: 01100101 01100101 1

分为4个大小相同的块,那么只需要在子网掩码的基础上加上11,10,01,00划分区域即可

101.101.128/19
101.101.160/19
101.101.192/19
101.101.224/19

P14.

Consider a datagram network using 8-bit host addresses. Suppose a router uses longest prefix matching and has the following forwarding table:

Prefix Match Interface
00 0
01 1
10 2
11 3

For each of the four interfaces, give the associated range of destination host addresses and the number of addresses in the range.

算法同P11

0匹配00000000 - 00111111,64个地址
1匹配01000000 - 01111111,64个地址
2匹配10000000 - 10111111,64个地址
3匹配11000000 - 11111111,64个地址

P18.

In this problem we’ll explore the impact of NATs on P2P applications. Suppose a peer with username Arnold discovers through querying that a peer with username Bernard has a file it wants to download. Also suppose that Bernard and Arnold are both behind a NAT. Try to devise a technique that will allow Arnold to establish a TCP connection with Bernard without application-specific NAT configuration. If you have difficulty devising such a technique, discuss why.

在这个问题中,我们将探讨NAT对P2P应用的影响。假设一个用户名为Arnold的对等体通过查询发现一个用户名为Bernard的对等体有一个它想要下载的文件。 还假设Bernard和Arnold都在NAT后面。 试着设计一种技术,使Arnold能够与Bernard建立TCP连接,而不需要特定的NAT配置。如果你很难设计出这样的技术,请讨论原因。

  • 无法实现
  1. 需要在Arnold和Bernard之间直接建⽴TCP连接
  2. NAT技术会将Arnold和Bernard 的IP地址和端⼝都进⾏映射转换,目的IP与NAT地址不一致,TCP握⼿失败

P20.

Consider the network fragment shown below. x has only two attached neighbors, w and y. w has a minimum-cost path to destination u (not shown) of 5, and y has a minimum-cost path to u of 6. The complete paths from w and y to u (and between w and y) are not shown. All link costs in the network have strictly positive integer values.

考虑下图所示的网络片段。x只有两个相连的邻居,w和y。w到目的地u(未显示)的最小成本路径是5,y到u的最小成本路径是6。 网络中的所有链接成本都有严格的正整数值。
在这里插入图片描述

a. Give x’s distance vector for destinations w, y, and u.

x距离向量表如下

目的地 跳数
w 2
y 4
u 7

b. Give a link-cost change for either c(x,w) or c(x,y) such that x will inform its neighbors of a new minimum-cost path to u as a result of executing the distance-vector algorithm.

  • 将(x,w)更新为1,此时x->u的距离被更新为6,会通知x的临近节点

c. Give a link-cost change for either c(x,w) or c(x,y) such that x will not inform its neighbors of a new minimum-cost path to u as a result of executing the distance-vector algorithm.

  • 将 (x,y) 更新为 5,此时 x 到 y 的最短路径仍为 x->w->y,不会通知 x 的邻居

猜你喜欢

转载自blog.csdn.net/JamSlade/article/details/129206236#comments_26532713