Wiki DE Start in the browser

Wiki › Protocols

UDP

The fast, connectionless transport for DNS, DHCP and RIP: no handshake, no acknowledgement, just ports and a checksum.

Layer
4 (Transport)
Standard
RFC 768
See an example
See demo

How UDP works

UDP only puts a small header with four fields in front of the payload: source port, destination port, length and checksum. There is no connection, no acknowledgement and no retransmission. If a datagram is lost, only the program notices.

TCPUDP
Connectionhandshake, teardownnone
Reliableacknowledgement, retransmissionno
Orderguaranteednot guaranteed
Headerat least 20 bytes8 bytes
Useweb, mail, SSHDNS, DHCP, RIP, VXLAN, voice and video

The UDP header

Only 8 bytes: source port, destination port, length and checksum.

UDPDatagram · RFC 768
0481216202428
Source port16 bits521
Destination port16 bits521
Length16 bits32
Checksum16 bits0xfafd
Datavariable24 Byte
Each row has 32 bits (4 bytes), bit 0 on the left, as the RFCs draw their headers. Dashed: variable or optional. Point at a field for an explanation.
FieldLengthExample valueMeaning
Source port16 bits (2 bytes)521Port of the sending program (may be 0 if no reply is expected).
Destination port16 bits (2 bytes)521Port of the service: 53 DNS, 67/68 DHCP, 520 RIP, 521 RIPng, 4789 VXLAN.
Length16 bits (2 bytes)32Header and data in bytes, at least 8.
Checksum16 bits (2 bytes)0xfafdChecksum with pseudo header; may be 0 (none) with IPv4, mandatory with IPv6.
Datavariable24 ByteThe application message, e.g. a DNS query.
Values: Real frame from the demo “RIPng for IPv6” (no. 1, 90 bytes), exactly as the packet list in leyoNET shows it.

When UDP fits

For a short question with a short answer, a handshake would cost more than the message itself: DNS simply asks again if no answer comes. DHCP even works before the device has an address. For voice and video a late packet is worthless anyway.

PortService
53DNS
67 / 68DHCP (server / client)
520RIP
4789VXLAN

See an example

  • Demo “DNS with forwarding” in leyoNETDemo “DNS with forwarding” in leyoNET
    DNS with forwarding

    School DNS with the zone schule.example (A, CNAME, MX, TXT, NS, PTR) that forwards unknown names to the provider's DNS.

    PC 1 resolves an alias through two CNAMEs, looks up the mail server (MX) and opens a page at the provider: the school DNS forwards the question and answers “non-authoritative”.

    Watch live Project file

“Watch live” opens the network in leyoNET, the simulation runs in a loop. In the app you find it under File → Demo networks, with a step-by-step tour.

Practise

  • ★★★☆☆ Protocol analysis – Task 2: DHCP · 5 goals · Worksheet (German)

In leyoNET under Tools → Exercise catalogue. Every exercise checks itself.

What leyoNET simplifies

ProtocolLayerSimplification in the simulation
UDP4none

Standards

Read on

Found a mistake or have an idea? Source of this page on GitHub.