Tc - Set Truncated Flag (Force TCP Mode)

Tc - Set Truncated Flag (Force TCP Mode)

This modifier directs PolarDNS to respond with only the DNS header with the Truncated (TC) bit flag set. This flag signals to the resolver/client that the response is too large, prompting it to retry the query over TCP.

In essence, this modifier allows us to enforce the use of TCP mode for communication between the resolver/client and PolarDNS.

This modifier is compatible with and can be combined with any other existing feature or modifier.

Category: Packet manipulation

Format

*.tc.*

This module has no parameters.

Examples

In this example, we use the basic always feature which always resolves to an IP address. We request the Truncated (TC) bit to be set in the DNS response. As a result, the client retries the query using TCP mode:

# dig always.tc.yourdomain.com @127.0.0.1

;; Truncated, retrying in TCP mode.

; <<>> DiG 9.18.10-2-Debian <<>> always.tc.yourdomain.com @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28291
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;always.tc.yourdomain.com.	IN	A

;; ANSWER SECTION:
always.tc.yourdomain.com. 60	IN	A	2.3.4.5

;; Query time: 4 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (TCP)
;; WHEN: Wed Oct 23 13:36:54 +04 2024
;; MSG SIZE  rcvd: 58

Download PCAP File


In this example, we use the size feature which returns multiple anwers at once. Once again we request the Truncated (TC) bit to be set in the DNS response. As a result, the client retries the query using TCP mode:

# dig size.tc.yourdomain.com @127.0.0.1

;; Truncated, retrying in TCP mode.

; <<>> DiG 9.18.10-2-Debian <<>> size.tc.yourdomain.com @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34423
;; flags: qr aa; QUERY: 1, ANSWER: 29, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;size.tc.yourdomain.com.		IN	A

;; ANSWER SECTION:
size.tc.yourdomain.com.	60	IN	A	127.0.0.88
size.tc.yourdomain.com.	60	IN	A	127.0.0.18
size.tc.yourdomain.com.	60	IN	A	127.0.0.208
size.tc.yourdomain.com.	60	IN	A	127.0.0.244
size.tc.yourdomain.com.	60	IN	A	127.0.0.30
size.tc.yourdomain.com.	60	IN	A	127.0.0.208
size.tc.yourdomain.com.	60	IN	A	127.0.0.149
size.tc.yourdomain.com.	60	IN	A	127.0.0.73
size.tc.yourdomain.com.	60	IN	A	127.0.0.189
size.tc.yourdomain.com.	60	IN	A	127.0.0.227
size.tc.yourdomain.com.	60	IN	A	127.0.0.31
size.tc.yourdomain.com.	60	IN	A	127.0.0.145
size.tc.yourdomain.com.	60	IN	A	127.0.0.243
size.tc.yourdomain.com.	60	IN	A	127.0.0.53
size.tc.yourdomain.com.	60	IN	A	127.0.0.114
size.tc.yourdomain.com.	60	IN	A	127.0.0.115
size.tc.yourdomain.com.	60	IN	A	127.0.0.139
size.tc.yourdomain.com.	60	IN	A	127.0.0.225
size.tc.yourdomain.com.	60	IN	A	127.0.0.25
size.tc.yourdomain.com.	60	IN	A	127.0.0.98
size.tc.yourdomain.com.	60	IN	A	127.0.0.159
size.tc.yourdomain.com.	60	IN	A	127.0.0.235
size.tc.yourdomain.com.	60	IN	A	127.0.0.137
size.tc.yourdomain.com.	60	IN	A	127.0.0.227
size.tc.yourdomain.com.	60	IN	A	127.0.0.187
size.tc.yourdomain.com.	60	IN	A	127.0.0.113
size.tc.yourdomain.com.	60	IN	A	127.0.0.120
size.tc.yourdomain.com.	60	IN	A	127.0.0.109
size.tc.yourdomain.com.	60	IN	A	127.0.0.89

;; Query time: 4 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (TCP)
;; WHEN: Wed Oct 23 13:36:56 +04 2024
;; MSG SIZE  rcvd: 504

Download PCAP File


From the same category

See also


Go back to catalogue.