A bit of background.
I'm writing an application that uses UDP. The application will run on a LAN (not internet). I've been assuming that if my MTU is 1500 then thats how big a UDP payload can be, but I'm not sure if the UDP header is meant to fit within that too.
I'm suspecting that if I send a UDP packet with a 1500 byte payload and the machine MTU is 1500 bytes will it end up sending two packets?
Searching the internet for a clear answer here seems harder than it should be, I've seen conflicting information.
The minimum length of an IP header is 20 bytes, or five 32-bit increments. The maximum length of an IP header is 24 bytes, or six 32-bit increments. Therefore, the header length field should contain either 5 or 6.
The size of an IP packet includes IP headers but excludes headers from the link layer. In the case of an Ethernet frame this adds an overhead of 18 bytes, or 22 bytes with an IEEE 802.1Q tag for VLAN tagging or class of service.
In this case, the type field has a hex value of 08 00, which means that the next embedded protocol that should be expected is IP. The length of the Ethernet header is static at 14 bytes, so we know that 00 is the last byte of the header.
IPv4 uses a 32-bit address space which provides 4,294,967,296 (232) unique addresses, but large blocks are reserved for special networking purposes.
------------------------------------------------------------------------------
|Ethernet | IPv4 |UDP | Data |Ethernet checksum|
------------------------------------------------------------------------------
14 bytes 20 bytes 8 bytes x bytes 4 bytes
\ (w/o options) /
\___________________________________________/
|
MTU
If your MTU is 1500, you have 1500-20-8 = 1472 bytes for your data.
Yes your example would not fit in one frame.
The ethernet data payload is 1500 bytes. IPv4 requires a minimum of 20 bytes for its header. Alternatively IPv6 requires a minimum of 40 bytes. UDP requires 8 bytes for its header. That leaves 1472 bytes (ipv4) or 1452 (ipv6) for your data.
More information:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With