Overview
This lecture explains why the Domain Name System (DNS) typically uses the UDP protocol at the transport layer instead of TCP, comparing packet usage and error handling.
DNS and UDP vs. TCP
- DNS is an application layer service that mainly uses UDP, a connectionless transport protocol.
- UDP does not require connection setup or teardown, reducing overall transmitted traffic for DNS queries.
- A DNS request and response usually fit inside a single UDP datagram.
DNS Traffic and Packet Analysis
- Full DNS resolution can create significant traffic, especially if caches do not have the required entries.
- Using TCP, a single recursive DNS query could require at least 44 packets due to connection setup, acknowledgments, and closure.
- With UDP, the same recursive DNS query typically needs only about 8 packets.
Error Recovery and Application Layer Simplicity
- UDP lacks built-in error recovery; if a DNS response is not received, the resolver simply retries the request.
- DNS handles necessary error checking and retry logic at the application layer, instead of relying on the transport layer.
When DNS Uses TCP
- DNS over TCP is used when responses are too large for a single UDP datagram.
- If a UDP response is too big, the server signals the client, which then switches to TCP for the lookup.
Key Terms & Definitions
- DNS (Domain Name System) — Service that maps domain names to IP addresses.
- UDP (User Datagram Protocol) — Connectionless, lightweight transport protocol with no built-in error correction.
- TCP (Transmission Control Protocol) — Connection-oriented transport protocol with reliable delivery, acknowledgments, and error correction.
- Datagram — An independent packet of data sent via UDP.
- Recursive DNS Query — A DNS lookup process that queries multiple servers to fully resolve a domain name.
Action Items / Next Steps
- Review DNS query flow diagrams showing UDP and TCP packet exchanges.
- Read about scenarios that require DNS over TCP.
- Practice explaining the differences between UDP and TCP in the context of DNS.