How IP Fragmentation Affects the UDP Header
When an IP packet exceeds the Maximum Transmission Unit (MTU) of a network path, it undergoes IP fragmentation, splitting the original payload across multiple smaller packets. In the case of User Datagram Protocol (UDP) traffic, this process fundamentally alters how the transport layer information is distributed across the network. Because the UDP header is treated strictly as data payload by the Internet Protocol (IP) layer, only the initial fragment retains the UDP header, while subsequent fragments contain only IP headers and raw payload data. This technical behavior creates critical challenges for port identification, firewall filtering, NAT translation, and overall transmission reliability.
The Fragmentation Mechanism
IP fragmentation operates at Layer 3 (Network Layer), making it entirely agnostic to Layer 4 (Transport Layer) protocols like UDP. When a large UDP datagram is fragmented:
- The First Fragment (Offset 0): Contains the complete IP header, the entire 8-byte UDP header (source port, destination port, length, and checksum), and the beginning portion of the UDP payload. The IP header flags field has the “More Fragments” (MF) bit set to 1, and the Fragment Offset is set to 0.
- Subsequent Fragments (Offset > 0): Contain a standard IP header followed directly by the next slice of the UDP payload data. These fragments do not duplicate the UDP header. The MF bit remains set to 1 until the final fragment, where MF is set to 0, and each fragment includes an increasing Fragment Offset value indicating its byte position in the original datagram.
Impact on Port Inspection and Firewalls
Because only the first fragment carries the UDP header, intermediate network devices encounter visibility issues:
- Stateless Firewalls and ACLs: Filtering rules that rely on source or destination UDP port numbers can accurately evaluate the first fragment. However, non-initial fragments lack port information. Stateless devices must either drop non-initial fragments (breaking communication) or allow them through blindly (creating a security risk).
- Stateful Inspection: Stateful firewalls and Network Address Translation (NAT) gateways must track fragments using the IP Identification, Source IP, and Destination IP fields. They must maintain state in memory until the initial fragment arrives to correctly apply port mappings or policy decisions to all related fragments.
Checksum Verification and Reassembly
The UDP header contains a 16-bit checksum calculated over an IP pseudo-header, the UDP header itself, and the entire UDP data payload.
- No Per-Fragment Checksum: There is no UDP checksum validation for individual fragments in transit.
- Full Reassembly Required: The receiving host’s IP layer must collect and reorder all fragments using the IP Identification and Fragment Offset fields to reconstruct the original datagram. Only after full reassembly is the UDP layer presented with the complete payload to compute and verify the UDP checksum.
Reliability and Packet Loss
UDP is an inherently connectionless, unreliable protocol that does not support native retransmissions. IP fragmentation amplifies this limitation:
- All-or-Nothing Delivery: If even a single fragment is dropped, corrupted, or delayed beyond the reassembly timeout window, the destination IP stack discards all associated fragments.
- Header Loss Impact: If the first fragment containing the UDP header is lost, the receiving host cannot deliver any portion of the reassembled payload to the target application port, rendering all other received fragments useless.