UDP IP 分片和 MTU [英] UDP IP Fragmentation and MTU

查看:15
本文介绍了UDP IP 分片和 MTU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解我在发送 UDP 数据包的上下文中看到的一些行为.

I'm trying to understand some behavior I'm seeing in the context of sending UDP packets.

我有两个小的 Java 程序:一个传输 UDP 数据包,另一个接收它们.我在通过单个交换机连接的两台计算机之间的网络上本地运行它们.

I have two little Java programs: one that transmits UDP packets, and the other that receives them. I'm running them locally on my network between two computers that are connected via a single switch.

两个网络适配器上的 MTU 设置(由/sbin/ifconfig 报告)均为 1500.

The MTU setting (reported by /sbin/ifconfig) is 1500 on both network adapters.

  • 如果我发送大小为
  • 的数据包1500,我收到了.预计.
  • 如果我发送 1500 的数据包
  • 尺寸 <24258 我收到了.预期的.我已经通过 wireshark 确认 IP 层正在对它们进行分段.
  • 如果我发送大小 > 24258 的数据包,它们就会丢失.不是预期的.当我在接收端运行 wireshark 时,我看不到任何这些数据包.
  • If I send packets with a size < 1500, I receive them. Expected.
  • If I send packets with 1500 < size < 24258 I receive them. Expected. I have confirmed via wireshark that the IP layer is fragmenting them.
  • If I send packets with size > 24258, they are lost. Not Expected. When I run wireshark on the receiving side, I don't see any of these packets.

我可以通过 ping -s 看到类似的行为.

I was able to see similar behavior with ping -s.

ping -s 24258 hostA 可以,但是

ping -s 24259 hostA 失败.

有人了解可能发生的事情,或者知道我应该寻找什么吗?

Does anyone understand what may be happening, or have ideas of what I should be looking for?

两台计算机都运行 CentOS 5 64 位.我使用的是 1.6 的 JDK,但我真的不认为这是一个编程问题,它是一个网络或操作系统问题.

Both computers are running CentOS 5 64-bit. I'm using a 1.6 JDK, but I don't really think it's a programming problem, it's a networking or maybe OS problem.

推荐答案

IP 协议的实现不需要能够处理任意大的数据包.理论上,最大可能的 IP 数据包大小为 65,535 个八位字节,但标准只要求实现至少支持 576 个八位字节.

Implementations of the IP protocol are not required to be capable of handling arbitrarily large packets. In theory, the maximum possible IP packet size is 65,535 octets, but the standard only requires that implementations support at least 576 octets.

您的主机实现支持的最大大小似乎远大于 576,但仍远小于最大理论大小 65,535.(我不认为交换机应该是个问题,因为它不需要进行任何碎片整理——它甚至不在 IP 层运行).

It would appear that your host's implementation supports a maximum size much greater than 576, but still significantly smaller than the maximum theoretical size of 65,535. (I don't think the switch should be a problem, because it shouldn't need to do any defragmentation -- it's not even operating at the IP layer).

IP 标准进一步建议主机不要发送大于 576 字节的数据包,除非他们确定接收主机可以处理更大的数据包大小.您也许应该考虑是否让您的程序发送较小的数据包大小会更好.24,529 对我来说似乎非常大.我认为可能有很多主机无法处理那么大的数据包.

The IP standard further recommends that hosts not send packets larger than 576 bytes, unless they are certain that the receiving host can handle the larger packet size. You should maybe consider whether or not it would be better for your program to send a smaller packet size. 24,529 seems awfully large to me. I think there may be a possibility that a lot of hosts won't handle packets that large.

请注意,这些数据包大小限制与 MTU(数据链路层协议支持的最大帧大小)完全分开.

Note that these packet size limits are entirely separate from MTU (the maximum frame size supported by the data link layer protocol).

这篇关于UDP IP 分片和 MTU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆