We know the size guarantees the datagram won't be fragmented in IPv4 is maximum 576 bytes. But the size when use UDP header 8 bytes and if we take UDP payload 512 bytes and choose maximum header size of IPv4 is 60 bytes(with option field), then Ipv4 datagram becomes (512+8+60)=580 bytes.
When we take UDP payload 508 bytes then IPv4 MTU becomes (508+8+60)=576 bytes.
So what should be the right of UDP payload 508 or 512 bytes, consequently maximum IPv4 MTU should be 576 or 580 bytes which guarantee not fragmenting?
Best Answer
You are confusing a couple of things. MTU is Maximum Transmission Unit, and it is a value of the data-link (layer-2) protocol on a specific medium.
IP, neither IPv4 nor IPv6 has an MTU. They both have maximum packet sizes, which are much larger than any data-link MTU. The total packet size (header and payload) for an IPv4 packet is 65,535 octets. For IPv6, the maximum payload size (excluding the IPv6 header) is 65,535, but there is an extension that increases that to over 2G octets.
Both UDP and TCP also use 16-bit lengths, so they can have datagrams that are larger than can fit in an IPv4 packet. Theoretically, both can be carried by other network (layer-3) protocols than IPv4, and they are with IPv6 (there was an RFC for TCP on IPX, but I do not know of any real implementations).
The 576 value is the minimum guaranteed MTU (by the layer-1/2 protocols) in a path for IPv4, meaning that packets up to that size are guaranteed not to be fragmented in the path. That is not a limit on IPv4 or any protocol it carries.
On the other hand, IPv6 does not allow fragmentation in the path, and it requires a minimum MTU of 1280 in the path.
The UDP payload limits are a minimum of 0 and a maximum of 65,527 octets (bytes).