Rc - Set Custom Status (Reply Code)
This modifier allows you to set a custom response status (reply code) in the DNS response, such as NOERROR, NXDOMAIN, SERVFAIL, etc.
The reply code value is 4 bits long and is stored in the last 4 bits of the second byte in the Flags field. This allows for a total of 16 possible DNS reply codes.
This modifier is compatible with and can be combined with any other existing feature or modifier.
Category: Header manipulation
RFCs: RFC1035, RFC2136, RFC8490
Format
*.rc<CODE>.*
Where:
- The
<CODE>
parameter can either be:0
(NOERROR) — No error condition1
(FORMERR) — Format error (server unable to interpret query)2
(SERVFAIL) — Server failure (unable to process due to internal error)3
(NXDOMAIN) — Non-existent domain4
(NOTIMP) — Not implemented (query type not supported)5
(REFUSED) — Query refused (policy reasons)6
(YXDOMAIN) — Name exists when it should not7
(YXRRSET) — RR set exists when it should not8
(NXRRSET) — RR set does not exist9
(NOTAUTH) — Server is not authoritative for the zone10
(NOTZONE) — Name is not within the zone11
(DSOTYPENI) — DS record type not implemented12
(RESERVED12) — Reserved for future use13
(RESERVED13) — Reserved for future use14
(RESERVED14) — Reserved for future use15
(RESERVED15) — Reserved for future use
Examples
In this example, we use the basic always feature which always resolves to an IP address. Additionally, we request to set the status in the response to NXDOMAIN
(No such name) by including rc3
in the domain name:
# dig always.rc3.yourdomain.com @127.0.0.1
; <<>> DiG 9.18.10-2-Debian <<>> always.rc3.yourdomain.com @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 43582
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;always.rc3.yourdomain.com. IN A
;; ANSWER SECTION:
always.rc3.yourdomain.com. 60 IN A 2.3.4.5
;; Query time: 8 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Thu Mar 13 11:03:41 +04 2025
;; MSG SIZE rcvd: 59
This DNS response may cause confusion as it presents a valid A record in the response while simultaneously indicating that the domain does not exist.
In this example, we use the alias feature to generate 10 CNAME aliases. Additionally, we request to set the status in the response to FORMERR
(Format error) by including rc1
in the domain name:
# dig alias.10.rc1.yourdomain.com @127.0.0.1 +noedns
; <<>> DiG 9.18.10-2-Debian <<>> alias.10.rc1.yourdomain.com @127.0.0.1 +noedns
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: FORMERR, id: 20065
;; flags: qr aa; QUERY: 1, ANSWER: 10, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;alias.10.rc1.yourdomain.com. IN A
;; ANSWER SECTION:
alias.10.rc1.yourdomain.com. 60 IN CNAME alias858735.10.rc1.yourdomain.com.
alias.10.rc1.yourdomain.com. 60 IN CNAME alias457065.10.rc1.yourdomain.com.
alias.10.rc1.yourdomain.com. 60 IN CNAME alias358428.10.rc1.yourdomain.com.
alias.10.rc1.yourdomain.com. 60 IN CNAME alias804274.10.rc1.yourdomain.com.
alias.10.rc1.yourdomain.com. 60 IN CNAME alias753098.10.rc1.yourdomain.com.
alias.10.rc1.yourdomain.com. 60 IN CNAME alias361470.10.rc1.yourdomain.com.
alias.10.rc1.yourdomain.com. 60 IN CNAME alias142873.10.rc1.yourdomain.com.
alias.10.rc1.yourdomain.com. 60 IN CNAME alias779129.10.rc1.yourdomain.com.
alias.10.rc1.yourdomain.com. 60 IN CNAME alias679580.10.rc1.yourdomain.com.
alias.10.rc1.yourdomain.com. 60 IN CNAME alias146470.10.rc1.yourdomain.com.
;; Query time: 4 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Thu Mar 13 11:03:42 +04 2025
;; MSG SIZE rcvd: 515
This DNS response may again cause confusion as it presents a valid response while simultaneously indicating that the server was unable to interpret the query.
From the same category
- Adrr - Set Additional RRs in the Header
- Anrr - Set Answer RRs in the Header
- Aurr - Set Authority RRs in the Header
- Flgs - Set Custom Flags in the Header
- NewId - Set Random Transaction ID
- Qurr - Set Question RRs in the Header
See also
- Tc - Set Truncated Flag (Force TCP Mode)
- Noq - Remove the Query Section
- Slp - Add a Delay (Latency)
- Ttl - Set Custom TTL Value
- Len - Set Custom Length in TCP
- Cnk - Send Response in Chunks (TCP only)
- Cut - Cut N Bytes from the End of the Packet
- Add - Add N Bytes to the End of the Packet
- Rl - Recalculate Length in TCP
- Fc - Force Compression
- Nc - No Compression