Skip to main content

DNS Code Reference

OxiDNS usually accepts both decimal numbers and mnemonic names in qtype, qclass, and rcode matchers, as well as in reject [rcode]. Mnemonic names are case-insensitive, so SERVFAIL, servfail, and ServFail all refer to the same RCODE.

Unknown or future QTYPE, QCLASS, and RCODE values can be matched with decimal numbers. reject [rcode] is the exception: it can only generate base DNS RCODEs 0..15; extended RCODEs require EDNS OPT and are not generated by that built-in action.

RCODE Response Codes

NumberCodeMeaning
0NOERRORThe query succeeded and the response has no error. A response with no answers is usually NODATA, not NXDOMAIN.
1FORMERRThe request format is invalid and the server cannot parse it.
2SERVFAILServer failure, often caused by upstream failure, validation failure, or an internal error.
3NXDOMAINThe queried domain name does not exist.
4NOTIMPThe server does not implement the requested operation.
5REFUSEDThe server refuses to process the query, commonly for policy or authorization reasons.
6YXDOMAINDNS UPDATE: a name exists when it should not.
7YXRRSETDNS UPDATE: an RRSet exists when it should not.
8NXRRSETDNS UPDATE: an RRSet that should exist does not exist.
9NOTAUTHThe server is not authoritative for the zone, or the operation is not authorized.
10NOTZONEThe name is not contained in the specified zone.
11..15UnassignedEmpty range in base RCODEs. reject can accept these numbers, but they are usually not recommended for normal policies.
16BADVERS / BADSIGEDNS: bad OPT version; TSIG: signature failure. The meaning depends on context.
17BADKEYTSIG/TKEY key is not recognized.
18BADTIMETSIG signature is outside the valid time window.
19BADMODEBad TKEY mode.
20BADNAMEDuplicate or invalid TKEY name.
21BADALGAlgorithm not supported.
22BADTRUNCBad TSIG truncation.
23BADCOOKIEMissing or invalid EDNS Cookie.

Common policy examples:

- matches: "rcode SERVFAIL,3"
exec: "forward 8.8.8.8"

- matches: "qname domain:blocked.example"
exec: "reject NXDOMAIN"

QCLASS Query Classes

NumberCodeMeaning
1INInternet; used by almost all ordinary DNS queries.
2CSCSNET; historical and rarely used today.
3CHCHAOS; sometimes used by diagnostic queries.
4HSHesiod; historical.
254NONEUsed by DNS UPDATE to indicate no class.
255ANY / *Any class, mainly used for special queries or matching expressions.

Common policy example:

- matches: "qclass IN"
exec: "$forward_main"

QTYPE Query Types

NumberCodeMeaning
1AIPv4 address record.
2NSAuthoritative name server record.
5CNAMECanonical name alias record.
6SOAStart of authority record; also commonly used for negative-cache TTLs.
12PTRReverse lookup pointer record.
15MXMail exchange record.
16TXTText record, often used for SPF, verification, and policy text.
28AAAAIPv6 address record.
33SRVService locator record.
35NAPTRNaming Authority Pointer record, often used for service discovery.
41OPTEDNS pseudo-record; not an ordinary resource record.
43DSDNSSEC delegation signer record.
46RRSIGDNSSEC record signature.
47NSECDNSSEC denial-of-existence record.
48DNSKEYDNSSEC public key record.
50NSEC3DNSSEC NSEC3 denial-of-existence record.
51NSEC3PARAMNSEC3 parameter record.
52TLSADANE TLSA certificate association record.
64SVCBService Binding record.
65HTTPSHTTPS Service Binding record.
99SPFDedicated SPF record type; in real deployments, TXT is more common.
249TKEYTransaction key negotiation record.
250TSIGTransaction signature pseudo-record.
251IXFRIncremental zone transfer.
252AXFRFull zone transfer.
255ANY / *Request records of any type; recursive resolvers often restrict or minimize responses.
256URIURI record.
257CAACertification Authority Authorization record.
261RESINFOResolver information record.

Common policy example:

- matches: "qtype A,AAAA,HTTPS,65"
exec: "$forward_main"

If a type is not listed here, match it with its decimal number. If OxiDNS has a built-in name for that type, the mnemonic name is accepted too.