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

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

问题描述

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

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

我有两个Java小程序:一个用于传输UDP数据包,另一个用于接收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我收到了.预期的.我已经通过Wireshak确认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?

两台计算机都运行64位CentOS 5.我使用的是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天全站免登陆