UDP IP Fragmentation and MTU

前端 未结 2 516
一个人的身影
一个人的身影 2021-02-04 05:04

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

I have two little Java programs: one that transmits UDP packets, and the other

相关标签:
2条回答
  • 2021-02-04 05:47

    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.

    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).

    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.

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

    0 讨论(0)
  • 2021-02-04 05:55

    I found the following which may be of interest:

    • Determine the maximum size of a UDP datagram packet on Linux
    • Set the DF bit in the IP header and send continually larger packets to determine at what point a packet is fragmented as per Path MTU Discovery. Packet fragmentation should then result in a ICMP type 3 packet with code 4 indicating that the packet was too large to be sent without being fragmented.

    Dan's answer is useful but note that after headers you're really limited to 65507 bytes.

    0 讨论(0)
提交回复
热议问题