为什么 Internet 主机 “不需要” 接收大于 576 字节的 IPv4 数据报?

注:机翻,未校对。


Why are Internet hosts “not required” to receive an IPv4 datagram larger than 576 bytes?

asked Apr 20, 2018 at 2:47

I’m currently studying Internet protocols and had a question regarding the IP datagram.
我目前正在研究 Internet 协议,并对 IP 数据报有疑问。

Within the IP header I am aware there is a field called “total length” which specifies the total length of the particular fragmented datagram in bits. However, while reading the textbook (“TCP/IP Illustrated Vol. 1”) I read that “a host is not required to be able to receive an IPv4 datagram larger than 576 bytes.”
在 IP 报头中,我知道有一个名为 “总长度” 的字段,它指定特定分段数据报的总长度(以位为单位)。但是,在阅读教科书(“TCP/IP 图解第 1 卷”)时,我读到 “主机不需要能够接收大于 576 字节的 IPv4 数据报”。

If it says that it’s “not required,” then doesn’t it mean that it technically would be able to transport it? Why is there such a limit in terms of the IP MTU?
如果它说它 “不需要”,那么这是否意味着它在技术上能够运输它?为什么在 IP MTU 方面有这样的限制?

One thing that I came across while studying TCP reminded me of this question I asked previously.
我在学习 TCP 时遇到的一件事让我想起了我之前问过的这个问题。

TCP is a transport layer (layer 4 in the conventional OSI model) protocol that runs encapsulated inside the lower network layer (layer 3) protocol. This is also where the Internet “power horse” known as IP is used.
TCP 是一个传输层(在传统的 OSI 模型中是第 4 层)协议,它在较低的网络层(第 3 层)协议内部运行封装。这也是被称为互联网 “引擎” 的 IP 协议使用的地方。

All protocols have a specific kind of header, and in the case of IP and TCP, both of their headers have a minimum of length 20 bytes (in TCP’s case, the maximum length is 60 bytes including options added at the end).
所有协议都有特定类型的标头,在 IP 和 TCP 的情况下,它们的两个标头的最小长度为 20 字节(在 TCP 的情况下,最大长度为 60 字节,包括在末尾添加的选项)。

TCP protocol use things called “segments” which are equivalent to packets for other protocols. The maximum segment size (MSS) is “the largest segment that a TCP is willing to receive from its peer and, consequently, the largest size its peer should ever use when sending.” (TCP/IP Illustrated, Vol. 1, 2e p. 606).
TCP 协议使用称为 “段” 的东西,这些 “段” 等同于其他协议的数据包。最大段大小 (MSS) 是 “TCP 愿意从其对等方接收的最大段,因此,其对等方在发送时应使用的最大段”。“(《TCP/IP 图解》,第 1 卷,第 2e 页,第 606 页)。

The MSS is usually specified as an option in the TCP header, but if it’s not specified then the default size is 536 bytes. Recall that the IP header and TCP basic header are both a minimum of 20 bytes. This means: 20 (IP header) + 20 (TCP header) + 536 (default MSS) = 576 bytes.
MSS 通常指定为 TCP 标头中的一个选项,但如果未指定,则默认大小为 536 字节。回想一下,IP 标头和 TCP 基本标头都是至少 20 个字节。这意味着:20(IP 报头)+ 20(TCP 报头)+ 536(默认 MSS)= 576 字节。

Thus, the minimum required packet size that IPv4 hosts should be able to process are 576 bytes.
因此,IPv4 主机应能够处理的最小数据包大小为 576 字节。

edited Jun 17, 2020 at 8:51

They had to pick a number and this annoyed the fewest the committee members. At the time, some networks had difficulty supporting larger numbers. This was before Ethernet had taken over the world and many links were serial lines. Small packets allow high priority packets to “take cuts” sooner.
他们不得不选择一个数字,这惹恼了最少的委员会成员。当时,一些网络难以支持更大的数字。这是在以太网接管世界之前,许多链路都是串行线路。小数据包允许高优先级数据包更快地 “削减”。

– Jeff Learman Commented Dec 17, 2020 at 22:11

IP datagrams can be up to 64K in length but it would be completely unreasonable back in 1981 to require every host to allocate 64K buffers. That could be your entire addressable memory on a 16 bit computer! The numbers are essentially arbitrary but that memory was too expensive to just throw at the problem is a factor.
IP 数据报的长度可以达到 64K,但在 1981 年,要求每个主机分配 64K 缓冲区是完全不合理的。这可能是您在 16 位计算机上的全部可寻址内存!这些数字基本上是任意的,但内存太昂贵了,不能只是抛出问题是一个因素。

From RFC 791: 来自 RFC 791:

All hosts must be prepared to accept datagrams of up to 576 octets (whether they arrive whole or in fragments). It is recommended that hosts only send datagrams larger than 576 octets if they have assurance that the destination is prepared to accept the larger datagrams.
所有主机都必须准备好接受最多 576 个八位字节的数据报(无论它们是完整的还是分段的)。建议主机仅发送大于 576 个八位字节的数据报,前提是它们可以保证目标已准备好接受较大的数据报。

The number 576 is selected to allow a reasonable sized data block to be transmitted in addition to the required header information. For example, this size allows a data block of 512 octets plus 64 header octets to fit in a datagram.
选择数字 576 是为了除了所需的标头信息外,还允许传输合理大小的数据块。例如,此大小允许 512 个八位字节加上 64 个标头八位字节的数据块适合数据报。

richardb answered Jun 2, 2018 at 7:50


via:


梳理一下

MSS(Maximum Segment Size,最大分段大小)是 TCP 协议中指定的最大数据段大小,它是指除去 IP 头和 TCP 头后的最大数据长度。默认的 MSS 值为 536 字节,这是因为早期的网络设备和协议对数据包的大小限制。

早期的网络设备和协议对数据包的大小限制来自于 RFC 791 和 RFC 1122 等规范。RFC 791 规定了 IP 数据包的最大长度为 576 字节,而 RFC 1122 规定了 TCP 段的最大长度为 536 字节,以避免数据包被截断或丢弃。

计算总的数据包大小:IP 头最小为 20 字节,TCP 头最小为 20 字节,加上默认的 MSS 值 536 字节,所以总的数据包大小为 20 + 20 + 536 = 576 字节。

根据 RFC 791,Internet 主机不需要接收大于 576 字节的 IPv4 数据包,这是因为早期的网络设备和协议对数据包的大小有限制。如果数据包大于 576 字节,可能会被截断或丢弃。

处理这种情况的可能方式有两种:

路由器或网络设备可能会将大于 576 字节的数据包分片(Fragmentation),将其分割成多个小于 576 字节的数据包,然后传输这些分片。目标主机会将这些分片重新组装成原始的数据包。

如果路由器或网络设备不支持分片,或者数据包的 Don’t Fragment(DF)标志位被设置,那么大于 576 字节的数据包可能会被丢弃(ICMP 错误报文将被发送回源主机)。

因此,在设计网络协议和应用程序时,需要考虑数据包的大小限制,以避免数据包被截断或丢弃。

  • 12
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值