Does DNS use TCP or UDP or both?

Answer Posted / jai

Sathyender is not wrong about the scenario when DNS uses TCP.

Halon is correct by saying UDP is not limited to 512 bytes
of data.

DNS uses UDP for normal communications. However, check this
detail in RFC 1035

2.3.4. Size limits

Various objects and parameters in the DNS have size limits.
They are listed below. Some could be easily changed,
others are morefundamental.

labels 63 octets or less

names 255 octets or less

TTL positive values of a signed 32 bit number.

UDP messages 512 octets or less

So, the DNS messages can not exceed 512 bytes and when that
happens, the DNS server truncate the data and only send 512
bytes with a TRUNCATED BIT set in the header.

When the DNS client sees this TRUNCATED BIT, it comes to
know that the data is more than 512 bytes which can not be
received using UDP. Then, it switches over to TCP and sends
the same request on TCP.

Hope this clarifies.

Is This Answer Correct ?    16 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is the pdu of "network layer" and "data link layer"?

605


Why shared memory is faster than message queue?

586


Explain about tcp&ip and osi model.

632


What are two models of interprocess communication?

710


How do I check if port 22 is open?

685






Explain what is routing protocol and its purposes?

627


Do I need a dedicated ip?

615


How does tcp ip socket work?

610


Explain 3 way handshake and how it works?

629


What is smb used for?

642


How do you find a ip address?

611


Explain how can we detect that the other end of a tcp connection has crashed? Can we use "keepalives" for this?

765


What is the data unit of "transport layer"?

607


How do I restore my ip address?

605


What are the different class and ranges of ip address?

678