IP Header + UDP Header + Layers 5-7 = 65535 (Max).
This number is arrived at the sum total of the 元 and L4 headers, plus the Layers 5-7 payload. What is hard and fast is that the maximum size of an IP datagram is 65535 Bytes. What this means is that if the message length field is 200 Bytes (0x00C8), the payload is actually 192 Bytes (0x00C0). The mistake, is that the Message Length field in the UDP Header includes all payload (Layers 5-7), plus the length of the UDP Header (8 Bytes).
Some have answered that the actual maximum is (65535 - IPHL - UDPHL = 65507). Some have answered that the Message Length field in the UDP header is a max of 65535 (0xFFFF) this is technically true. I've read some good answers here however, there are some minor mistakes. IPv4's 20 byte size (and either way, one must still allow 8 bytes for the UDP header). Note - if you are using IPv6, the maximum size would be 1452 bytes, as IPv6's header size is 40 bytes vs. Since no UDP packet is guaranteed, if you receive a UDP packet, the largest safe size would be 1 packet over IPv4 or 1472 bytes. Since the question was about maximum safe values, I'm assuming that they are talking about the maximum safe value for a UDP packet that can be received. Since once you've encapsulated a stream - there is nothing prohibiting, say, a VPN layer below that and a complete duplication of encapsulation layers above that.
The user didn't ask for the lowest value possible (like "0" for a safe UDP size), but the largest safe packet size.Įncapsulation values for various layers can be included multiple times. Various answers give maximum values allowed by 1 SW vendor or various answers assuming encapsulation. Wait.8086 bytes, would be the max.coincidence? snicker
So 1472 should be safe for external use (though that doesn't mean an app like DNS that doesn't know about EDNS will accept it), and if you are talking internal nets, you can more likely know your network layout in which case jumbo packet sizes apply for for non-fragmented packets so for 4096 - 4068 bytes, and for intel's cards with 9014 byte buffers, a package size of. Besides, doing so might easily be considered providing preferential treatment for some traffic - a no no under rules they probably don't care much about (unless they get caught). Given that IPV6 has a size of 1500, I would assert that carriers would not provide separate paths for IPV4 and IPV6 (they are both IP with different types), forcing them to equipment for ipv4 that would be old, redundant, more costly to maintain and less reliable. Interestingly, the maximum theoretical packet size is around 30 MB (1,500 ethernet MTU - 60 IP header x 65,536 maximum number of fragments), though the likelihood of it getting through would be infinitesimal. With UDP, this is going to happen either way. But this isn't too important, because losing a fragment has the same effect as losing an unfragmented packet: the entire packet is dropped. A more conservative value of around 300-400 bytes may be preferred instead.Īny UDP packet may be fragmented. As others have mentioned, additional protocol headers could be added in some circumstances. Except on an IPv6-only route, where the maximum payload is 1,212 bytes. Anything larger is allowed to be outright dropped by any router for any reason. Any UDP payload this size or smaller is guaranteed to be deliverable over IP (though not guaranteed to be delivered). This is a packet size of 576, minus the maximum 60-byte IP header and the 8-byte UDP header. The maximum safe UDP payload is 508 bytes.