Use it when ordinary names resolve but a few with large answers time out — signed domains, long TXT records, many addresses.
DNS Truncation & TCP Fallback
1. dig <name> <type> +tcp — does it work over TCP?
2. Fails while small UDP queries work → TCP 53 is blocked on that path.
3. Works over TCP, plain query times out → large UDP replies are dropped; a smaller +bufsize should make it truncate cleanly.
4. Set the resolver's UDP size to 1232.
UDP query → answer fits: done; too large → truncated reply reaches the client → client opens TCP 53 → full answer over TCP
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
dig example.com TXTVerification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational verification Verify boundary
dig example.com TXT
dig example.com TXT +notcp +ignore
dig example.com TXT +tcp
dig example.com DNSKEY +dnssec +bufsize=512 +ignore
A normal dig retries over TCP automatically and says so: ";; Truncated, retrying in TCP mode." Adding +ignore stops the retry, so the truncated UDP reply can be seen with tc among its flags. +tcp uses TCP from the start; if this fails while UDP queries for small names work, TCP port 53 is blocked. +bufsize sets the UDP size the client offers, which makes it easy to provoke truncation for a test.
In a capture, the pattern is a UDP query, a UDP reply with the truncated flag, then a TCP handshake to port 53.
Known-good: the same query succeeds with +tcp, and a truncated UDP reply is followed by a successful TCP exchange.
Step 2 Failure isolation workflow Narrow the fault
- Small names resolve, a few large ones time out. TCP port 53 is not permitted; test with
dig +tcp. dig +tcpfails against one resolver or server only. That path filters TCP 53, or the server does not listen on TCP.- No reply to the UDP query, and no truncated flag either. The large UDP reply is being dropped on the way — size or fragment filtering; a smaller
+bufsizemakes the server truncate instead. - Lookups of signed domains fail from one site. DNSSEC answers are large; the same two causes apply.
- Zone transfers fail while queries work. Transfers always use TCP.
- An application fails where
digsucceeds. The application's resolver library does not fall back to TCP. - Mail or verification records "cannot be read" by an external service. The TXT answer exceeds the UDP size and the retry does not reach the server.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
DNS needs both UDP and TCP on port 53; TCP is not only for zone transfers. If TCP 53 is blocked, the retry fails. If large UDP replies are dropped on the path, not even the truncated flag arrives.
dig <name> <type>— says "Truncated, retrying in TCP mode" when it happens.dig <name> <type> +notcp +ignore— shows the truncated UDP reply with thetcflag.dig <name> <type> +tcp— TCP from the start.dig <name> <type> +bufsize=512 +ignore— provoke truncation for a test.
ReferenceWhat it is1 section · depth on demand
Mechanics & mental model
DNS normally uses UDP: one packet for the question, one for the answer. When an answer is too large for the size the client can accept, the server sends back a cut-down reply with the truncated flag set, and the client repeats the same question over TCP, where size is not a limit.
ReferenceWhy it matters1 section · depth on demand
Why it matters operationally
DNS needs both UDP and TCP on port 53. A firewall rule that allows only UDP — on the old assumption that TCP is "just for zone transfers" — works for ordinary lookups and fails for exactly the names with large answers: DNSSEC-signed zones, long TXT records, names with many addresses. The failure affects particular names only, which makes it look like a fault in those domains.
ReferenceHow it works1 section · depth on demand
How it works
The size limit. Originally a DNS message over UDP could be at most 512 bytes. With EDNS, the client states in its query how large a UDP reply it can take — today typically 1232 bytes, a value chosen to pass any path without fragmentation.
The sequence.
1. The client sends its query over UDP.
2. The server finds that the full answer exceeds the client's limit. It replies with the TC (truncated) flag set and little or no data.
3. The client discards that reply, opens a TCP connection to port 53 on the same server, and sends the same query.
4. The server sends the complete answer over TCP.
The client does this by itself; from the outside the lookup just takes slightly longer.
What makes answers large.
- DNSSEC signatures and keys.
- TXT records holding SPF policies, verification strings or keys.
- Names with many address records, or long chains of aliases.
- Responses that list many name servers with their addresses.
Where it goes wrong.
- TCP port 53 is blocked between the client or resolver and the server. The truncated reply arrives, the retry fails, and the lookup ends in a timeout or SERVFAIL.
- A device on the path drops UDP DNS packets over 512 bytes, or drops fragments. Then not even the truncated flag arrives — the large reply simply vanishes, and the client times out.
- An old client or application does not retry over TCP.
TCP is also used for zone transfers between servers, and increasingly for ordinary queries where privacy or reliability matters; DNS over TLS runs on TCP port 853.
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
Truncation and TCP fallback
DNS starts with UDP, but TCP isn't optional. RFC 1035 limits classic UDP messages to 512 bytes. A longer answer is cut short and the TC bit is set. RFC 7766 requires all general-purpose DNS implementations to support both UDP and TCP, and says a client that receives TC should retry over TCP. Over TCP, each message is preceded by a 2-byte length field. Clients and servers should reuse connections and pipeline queries, and resolvers must accept responses in any order.
Why answers get truncated
| Cause | Example |
|---|---|
| No EDNS, so a 512-byte limit | Old clients or middleboxes stripping EDNS |
| EDNS buffer smaller than the answer | Large DNSSEC responses, many A records, long TXT records |
| Server policy | Response rate limiting truncates to force TCP |
What breaks when TCP 53 is blocked
| Traffic | Effect |
|---|---|
| Large answers (DNSSEC, SPF/TXT, many records) | Fail after truncation |
| Zone transfers (AXFR/IXFR) | Fail |
| Normal small lookups | Work, which makes the problem look intermittent |
Firewalls must allow TCP 53 to and from DNS servers, exactly like UDP 53.
Connection handling (RFC 7766)
| Rule | Reason |
|---|---|
| Reuse connections and pipeline queries | Avoid a TCP handshake per query |
| Clients close idle connections | Free server resources |
| Server idle timeout on the order of seconds | Protect servers from idle connections |
| Send the length and the message together | Single-segment transmission |
host$ dig @10.20.0.53 example.net DNSKEY +bufsize=512 +noall +comments | grep flags
;; flags: qr tc rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
host$ dig @10.20.0.53 example.net DNSKEY +bufsize=512 | grep -E "Truncated|SERVER"
;; Truncated, retrying in TCP mode.
;; SERVER: 10.20.0.53#53(10.20.0.53) (TCP)
host$ dig @10.20.0.53 example.net DNSKEY +tcp +noall +answer | wc -l
host$ sudo tcpdump -ni eth0 'port 53 and (tcp or udp[10] & 0x02 != 0)'
The tcpdump filter catches TCP DNS traffic plus UDP DNS responses with the TC bit set. TC is bit 0x02 in the third byte of the DNS header, which is offset 10 from the start of the UDP header.
Documented example, not captured output.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Network & Protocols → DNS Truncation & TCP Fallback. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc9293.html · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Operational notes
Former standalone Cheat Sheet content now lives directly inside the Topic where it belongs.
DNS UDP → TCP Fallback
TC flag and TCP/53 verification.
1. Capture UDP response.
2. Check TC=1.
3. Observe TCP/53 handshake.
4. Verify full answer over TCP.
5. Check firewall/NAT/PMTU if TCP fails.