OPT Record

EDNS(0) Option

Type code
41
Status
Query or pseudo-record type, never stored in a zone
Defined in
RFC 6891

What the OPT record is for

The original DNS limited UDP messages to 512 octets and left little room for new flags. EDNS(0) (RFC 6891) extends the protocol with one OPT pseudo-record in the additional section of a query or response. It reuses the fixed record fields: CLASS holds the largest UDP payload the sender can receive, and TTL holds an extended RCODE, the EDNS version and flags.

The DO (DNSSEC OK) bit defined in RFC 3225 lives in those flags; a resolver sets it to ask for DNSSEC records. The RDATA carries options such as EDNS Client Subnet (RFC 7871), cookies (RFC 7873) and padding (RFC 7830).

OPT is per message. A message has at most one, and RFC 6891 says it must not be cached, forwarded, or stored in or loaded from zone files.

Wire format and fields

FieldSizeMeaning
OPTION-CODE16 bitsThe option, from the IANA EDNS0 option codes registry.
OPTION-LENGTH16 bitsThe length of OPTION-DATA in octets.
OPTION-DATAvariableThe option's value.

The RDATA is zero or more {OPTION-CODE, OPTION-LENGTH, OPTION-DATA} triples. The fixed fields are repurposed: NAME is the root (0), CLASS is the requestor's UDP payload size, and the 32-bit TTL is EXTENDED-RCODE (8 bits), VERSION (8 bits), DO (1 bit) and Z (15 bits, zero).

Common mistakes

  • Firewalls that drop DNS over UDP larger than 512 octets, or drop IP fragments. Large EDNS responses, such as DNSSEC answers, then time out instead of arriving.
  • Advertising a large payload size such as 4096. Responses that big get fragmented, and fragments are often lost; RFC 9715 recommends no more than 1400.
  • Servers or middleboxes that return FORMERR or no answer to a query with OPT. RFC 6891 requires a server without EDNS support to answer without OPT, not to drop the query.
  • Sending more than one OPT record in a message. RFC 6891 says the receiver must treat that as FORMERR.

Specifications

Related record types

Domain Intelligence APIs

Get started with our easy-to-use API docs.