This is one of the very basic questions asked in a lots of interviews: Which protocol DNS works on – UDP or TCP ?
And when you don’t know the answer then you take a wild guess and says anyone of them :), which in any case is wrong as it works on both, TCP as well as UDP.

Two protocols being different from each other, TCP being a connection oriented protocol and UDP being a connection less protocol, but DNS uses both of them, not for the same purpose, but for different purpose.

DNS uses TCP for Zone files transfer over port 53:

DNS uses a master and slave architecture, in which you have one main authoritative Name server who have all the entries and others are replicated (zone files transferred) from master and also server DNS queries. As there can’t be any inconsistency in Zone files, so to transfer these Zone files, DNS uses TCP as the communication protocol, which makes sure that the zone files are transferred reliably.

DNS uses UDP for DNS queries over port 53:

DNS uses UDP for it’s basic usage, replying to the DNS queries of the clients. When a client asks DNS server for a Name to IP or IP to NAME resolution, then DNS uses UDP protocol to reply to that query. The reason for using a UDP protocol over here, is that UDP is not connection oriented, so it’s light weight and fast, which results in sending the results of the query to the client in much less time compared to TCP.

At the same time, if needed then DNS can also work over TCP to serve the DNS queries, but UDP is always preferred because of greater speed.

If you enjoyed this post, make sure you subscribe to my RSS feed!!!!

No related content found.