主机是否会对无序接收的碎片 IP 数据包进行重新排序?

主机是否会对无序接收的碎片 IP 数据包进行重新排序?

主机 A 通过以太网和 PPP 链路向主机 B 发送一个 1400 字节的 IP 数据包。PPP 链路的 MTU 为 532 字节,这意味着 IP 数据包将被分割成 3 个较小的数据包。

首先收到片段 1。它具有唯一标识,并且 M 位标志已设置,表明还有更多片段即将收到。但是,由于网络中的一些重新排序,接下来收到的是片段 3。此片段与片段 1 具有相同的标识,但未设置 M 位,因为它是最后一个片段。随后不久收到片段 2。

接收主机将会做什么?

  1. 接收主机是否会知道偏移量和数据包长度不匹配,并假设中间数据包在网络中被丢弃或重新排序,并等待它?

  2. 接收主机是否会重新组装数据包(两个头校验和匹配)并将其传递给更高层(如果使用 UDP/TCP,则数据的 IP 校验将失败)。

  3. 接收主机是否会丢弃此标识的所有片段。

答案1

接收主机知道丢失的碎片,并等待,直到重组超时到期。除非丢失的碎片到达,碎片掉落。

RFC 791在第 3.2 节中定义:

If the timer runs out, the all reassembly resources for this buffer identifier are released. The initial setting of the timer is a lower bound on the reassembly waiting time. This is because the waiting time will be increased if the Time to Live in the arriving fragment is greater than the current timer value but will not be decreased if it is less. The maximum this timer value could reach is the maximum time to live (approximately 4.25 minutes). The current recommendation for the initial timer setting is 15 seconds.

IPv4 和 IPv6 的重组超时Linux为 30 秒,视窗(Vista、2008、7 和 2008 R2)根据RFC 2460

If insufficient fragments are received to complete reassembly of a packet within 60 seconds of the reception of the first-arriving fragment of that packet, reassembly of that packet must be abandoned and all the fragments that have been received for that packet must be discarded.

相关内容