UDP is a transport layer protocol that provides fast, connectionless, and lightweight communication between processes. It skips delivery guarantees, ordering, and error correction, making it ideal for real-time and time-sensitive applications.
- UDP provides fast, connectionless, lightweight communication with no handshake, no acknowledgements, and no retransmission; data is sent and forgotten, minimising overhead.
- It's ideal for latency-sensitive traffic like video streaming, DNS lookups, VoIP, and online gaming, where speed matters more than guaranteed delivery.

UDP Header
The UDP header is a fixed 8 bytes, followed by the data payload. It contains just enough information to route and validate a packet.

| Field | Size | Description |
|---|---|---|
| Source Port | 16 bits | Identifies the sender’s port number. |
| Destination Port | 16 bits | Identifies the receiver’s port number. |
| Length | 16 bits | Specifies the total length of UDP header and data. |
| Checksum | 16 bits | Used for error detection (optional in IPv4, mandatory in IPv6). |
Note: Unlike TCP, UDP's checksum is optional and it performs no flow or error control - it relies on higher layers (IP/ICMP) for error reporting. Port numbers alone are used to distinguish between different processes/requests.
UDP Pseudo Header
To improve checksum accuracy, UDP uses a pseudo header computed during checksum calculation but never actually transmitted. It includes:
- Source and destination IP address (from the IP header)
- Zero (padding field)
- Protocol number
- UDP length

This ensures the packet reaches the correct host and protocol, and lets the receiver verify integrity using the same pseudo header before accepting the packet.
Use of UDP in DDoS Attacks
A UDP flood attack exploits UDP's connectionless nature attackers send massive volumes of packets to a target, often with spoofed IP addresses.
Attack Process:
- Attacker sends UDP packets with spoofed IPs to random target ports.
- Target checks each port for an active application — usually finds none.
- Target responds with ICMP "Destination Unreachable" messages, exhausting its own resources.
Mitigation:
- Monitor for abnormal UDP traffic spikes.
- Apply rate limiting, firewalls, and intrusion prevention systems (IPS).
- Use dedicated DDoS protection services for large-scale attacks.
How UDP Interacts with IP
UDP rides on top of IP to move data between applications:
- The application hands off data + destination details to UDP.
- UDP attaches its header (source port, destination port, length, checksum).
- The datagram passes to IP for addressing and routing.
- IP adds its own header and forwards the packet.
- At the receiver, UDP strips its header and delivers the payload to the target application.
Applications of UDP
- DNS: Fast query/response lookups for small, quick-turnaround requests.
- DHCP: Dynamically assigns IP addresses using small control messages.
- VoIP: Real-time voice - tolerates some packet loss but not delay.
- RIP: Sends periodic routing updates between routers.
- NTP: Synchronizes system clocks with minimal overhead.