Why is UDP used in DNS?

DNS and UDP

DNS is an application layer protocol, and all application layer protocols use one of two transport layer protocols—UDP and TCP.

TCP is a widely used protocol. In most cases, when we request a website from our browser, data packets are sent to the server using the TCP protocol.

UDP has much faster performance. Using UDP, the recipient doesn't have to check the package. The sender keeps sending packets without wasting extra time getting feedback.

To serve queries, DNS typically employs the UDP on port 53. DNS inquiry is a single UDP request from the client and a single UDP response from the server. When the message length exceeds 512 bytes and the client and the server support EDNSExtension mechanisms for DNS is a specification for expanding the size of several parameters of the DNS protocol., bigger UDP packets are utilized. If not, the inquiry is resent using the Transmission Control Protocol (TCP).

Areas where DNS uses UDP and TCP

Why is UDP used?

From the aspect of the DNS server, we want to reduce resolution time as much as possible. We want to reduce the time to a few milliseconds. Thus, here are the reasons why we prefer UDP over TCP:

  • UDP is much faster. TCP is slow because it requires a 3-way handshake. The load on the DNS server is also an essential factor.

  • DNS queries are generally minimal and fit well into UDP segments.

  • With no connectivity issues, UDP can support more clients simultaneously.

  • UDP is unreliable, but we can add reliability to the application layer. Applications can use UDP and be more reliable than resending at the application layer using timeouts.

However, there are certain disadvantages as well. UDP does not keep track of connections or data transmission status. Because of the lack of information about how far along each server or network route has moved with its given task, it is also more difficult for specific applications to employ numerous servers and ways efficiently.

Furthermore, due to the inability to secure delivery, specific clients and name servers do not connect. If the DNS server is under a denial-of-service attack via faked UDP packets, it will be unable to reply because it will be too busy trying to track the incorrect requests and packages.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved