Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

DNS Truncation & TCP Fallback

Direct answer

DNS normally uses UDP. When an answer is too large for the size the client accepts, the server sets the truncated flag, and the client repeats the question over TCP port 53.

When to use this

Use it when ordinary names resolve but a few with large answers time out — signed domains, long TXT records, many addresses.

First 30 seconds

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.

Operational verification

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
Platform / version applicability
Protocol standard + deployed implementation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformProtocol standard
Key commanddig example.com TXT
Scope / prerequisiteUse it when ordinary names resolve but a few with large answers time out — signed domains, long TXT records, many addre…
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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 +tcp fails 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 +bufsize makes 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 dig succeeds. 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 references

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.

observation · 1
Command lookup Jump straight to Cisco syntax
Key points

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.

Key checks
  • dig <name> <type> — says "Truncated, retrying in TCP mode" when it happens.
  • dig <name> <type> +notcp +ignore — shows the truncated UDP reply with the tc flag.
  • 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

CauseExample
No EDNS, so a 512-byte limitOld clients or middleboxes stripping EDNS
EDNS buffer smaller than the answerLarge DNSSEC responses, many A records, long TXT records
Server policyResponse rate limiting truncates to force TCP

What breaks when TCP 53 is blocked

TrafficEffect
Large answers (DNSSEC, SPF/TXT, many records)Fail after truncation
Zone transfers (AXFR/IXFR)Fail
Normal small lookupsWork, which makes the problem look intermittent

Firewalls must allow TCP 53 to and from DNS servers, exactly like UDP 53.

Connection handling (RFC 7766)

RuleReason
Reuse connections and pipeline queriesAvoid a TCP handshake per query
Clients close idle connectionsFree server resources
Server idle timeout on the order of secondsProtect servers from idle connections
Send the length and the message togetherSingle-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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docProtocol standard + deployed implementation RFC 9293

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%
Terminology layer

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.

Aliases that resolve here
dns tcp fallbackdns truncatedtc flag dns
Embedded quick reference

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.

Confirmation

Confirm action

Continue?