Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
Is it true that a nameserver have to answer queries over TCP?

I know DNS uses UDP for most of its queries, but in what circumstances will it use TCP instead?

share|improve this question

migrated from unix.stackexchange.com Jul 4 '12 at 21:32

This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems..

marked as duplicate by Chris S Jul 4 '12 at 22:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

The Stack Exchange sites are not forums. They are Q&A sites. Please see the FAQs for why that matters. The "closed as exact dupe" question isn't the same Question, but has the same answer, and Alnitak is pretty much a DNS demi-god. –  Chris S Jul 4 '12 at 22:02

2 Answers 2

up vote 10 down vote accepted

DNS goes over TCP when the size of the request or the response is greater than a single packet such as with responses that have many records or many IPv6 responses or most DNSSEC responses.

The maximum size was originally 512 bytes but there is an extension to the DNS protocol that allows clients to indicate that they can handle UDP responses of up to 4096 bytes.

DNSSEC responses are usually larger than the maximum UDP size.

Transfer requests are usually larger than the maximum UDP size and hence will also be done over TCP.

share|improve this answer
DNSSEC does not do any certificate negotiation! The resource records added for DNSSEC are no different than other resource records. DNSSEC works just fine over UDP and will only resort to TCP when the response is too large (compare dig +dnssec @a.gtld-servers.net com. any and dig +dnssec @a.gtld-servers.net com. dnskey) –  Cakemox Jul 4 '12 at 21:59
Indeed, I stand corrected. That second query certainly did work just fine over UDP. I'll amend my answer. –  Ladadadada Jul 4 '12 at 22:14

The Transmission Control Protocol (TCP) is used when the response data size exceeds 512 bytes, or for tasks such as zone transfers.


share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.