Rc - Set Custom Status (Reply Code)

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 condition
    • 1 (FORMERR) — Format error (server unable to interpret query)
    • 2 (SERVFAIL) — Server failure (unable to process due to internal error)
    • 3 (NXDOMAIN) — Non-existent domain
    • 4 (NOTIMP) — Not implemented (query type not supported)
    • 5 (REFUSED) — Query refused (policy reasons)
    • 6 (YXDOMAIN) — Name exists when it should not
    • 7 (YXRRSET) — RR set exists when it should not
    • 8 (NXRRSET) — RR set does not exist
    • 9 (NOTAUTH) — Server is not authoritative for the zone
    • 10 (NOTZONE) — Name is not within the zone
    • 11 (DSOTYPENI) — DS record type not implemented
    • 12 (RESERVED12) — Reserved for future use
    • 13 (RESERVED13) — Reserved for future use
    • 14 (RESERVED14) — Reserved for future use
    • 15 (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

Download PCAP File

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

Download PCAP File

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

See also


Go back to catalogue.