The UDP datagram and its pseudo-header

Four 2-byte fields make an 8-byte header. Change the payload and watch the Length; build the pseudo-header that the checksum also covers and that is never transmitted; follow the three levels of addressing in a host.

Payload

The application message, in bytes. UDP does not segment: one message = one datagram.

Example

Process in A (port 9157) sends to a process in C (port 6428). The IP addresses are documentation addresses (RFC 5737).

A · 203.0.113.7 : 9157
C · 198.51.100.20 : 6428

Practice

Questions on sizes, like the ones in class: the answer is hidden until you press Check.

View

The checksum is computed step by step in UDP checksum step by step.

The UDP segment in 32-bit rows (hover over or focus a field)

The pseudo-header

Three levels of addressing in a host

Three levels are needed in each host: the host address (in the IP header), the protocol address (in the IP header: 6 = TCP, 17 = UDP) and the port number (in the UDP/TCP segment header). That is why 443/TCP and 443/UDP can coexist.

Model assumptions
  • Each header field takes 16 bits (2 B): the header is 8 B. Length = header + data, in bytes: 8 ≤ L ≤ 65 535. Maximum payload: 65 535 − 8 = 65 527 B; over IPv4 (20-byte header), 65 507 B.
  • The IPv4 header is assumed to have no options (20 B); the dashed row is not used. With options (up to 60 B) the maximum data drops to 65 467 B. The IPv4 header is covered in Topic 4; only the source IP, destination IP and Protocol fields matter here.
  • The checksum value is not computed here: it is computed over the pseudo-header plus the whole segment, with the field set to 0. You will do it in the lab; the one's complement sum is in “UDP checksum step by step”.
  • A datagram that does not fit in the network MTU is fragmented by IP (Topic 4); UDP still sends a single datagram.

About this visualization

A visualization of the UDP datagram (Kurose and Ross §3.3, RFC 768). The segment is drawn in 32-bit rows: an 8-byte header with four 16-bit fields (source port, destination port, length and checksum) and the data; hovering over or focusing each field shows what it means. A payload slider updates the Length (header + data, between 8 and 65 535 B) and the size of the IPv4 datagram, and marks the limits: 8 B with no data, 65 527 B of data as the maximum of the Length field and 65 507 B over IPv4 because of its 20-byte header. An animation builds the 12-byte pseudo-header: the source IP, the destination IP and protocol 17 come down from the IPv4 header, a zero byte and the UDP length are added, and it is marked as not transmitted because each end rebuilds it; it also protects whom the datagram was addressed to. Computing the checksum is left to the lab. An interactive cascade shows the three levels of addressing in a host: the IP address, the Protocol field (6 = TCP, 17 = UDP) and the port number, which is why 443/TCP and 443/UDP can coexist. It includes practice questions on sizes.

Concepts: UDP datagram, UDP header, source port, destination port, Length field, UDP checksum, pseudo-header, maximum payload, protocol number, addressing levels.

Formulas:

Network Architecture I, Session 3.1 · Enrique de la Hoz, University of Alcalá · License CC BY-SA 4.0 · Source and catalogue on GitHub · DOI 10.5281/zenodo.23285664