Every DNS query and reply has the same shape on the wire: a 12-byte header full of flags, then up to four sections (question, answer, authority, additional). For the lookup that sends these messages, start with how DNS works.
The message
This is a real response to hugosibony.com A, drawn as its five parts. Click any field to see what it does.
hugosibony.com A 104.21.86.12 Click any field to inspect it.
The second word packs eleven control fields into 16 bits: one QR bit, a 4-bit Opcode, six single-bit flags (AA, TC, RD, RA, Z, AD, CD) and a 4-bit RCODE. Click any sub-field below to see it on its own.
hugosibony.com. 300 IN A 104.21.86.12
hugosibony.com. 300 IN A 172.67.213.189 Empty. This is a direct answer, so no NS records are attached. On a referral, this section would list the nameservers to ask next.
The lone additional record is the EDNS(0) OPT pseudo-record (TYPE 41). It advertises the sender’s UDP payload size and carries the DO (DNSSEC OK) bit, modern DNS’s extension mechanism (RFC 6891).
The flags carry the message’s whole personality: QR (question or answer), RD and RA (was recursion asked for, is it offered), AA (authoritative), RCODE (NOERROR, NXDOMAIN, SERVFAIL), and the DNSSEC bits AD and CD.
The records
The answer section is a list of resource records. A gets the headlines, but a domain holds a handful of record types, each with a job: mail routing, aliases, delegation, text for verification, DNSSEC keys.
The building blocks of a zone. Pick a type to see its numeric code, defining RFC, and a real-shaped example.
A
Maps a name to an IPv4 address.
hugosibony.com. 300 IN A 104.21.86.12 AAAA
Maps a name to an IPv6 address.
hugosibony.com. 300 IN AAAA 2606:4700:3030::6815:560c CNAME
Canonical-name alias, points a name at another name.
www.github.com. 3600 IN CNAME github.com. MX
Mail exchanger for the domain, with a priority.
example.com. 3600 IN MX 10 mail.example.com. TXT
Arbitrary text, used for SPF, DKIM and domain verification.
example.com. 3600 IN TXT "v=spf1 include:_spf.example.com ~all" NS
Delegates a zone to its authoritative nameservers.
hugosibony.com. 21600 IN NS brad.ns.cloudflare.com. SOA
Start of authority, the zone's primary NS, admin email, serial, timers, and the minimum TTL used for negative caching.
hugosibony.com. 1800 IN SOA brad.ns.cloudflare.com. dns.cloudflare.com. 2407153759 10000 2400 604800 1800 PTR
Reverse lookup, maps an IP back to a name (in-addr.arpa).
1.2.0.192.in-addr.arpa. IN PTR host.example.com. SRV
Locates a service, its host and port.
_sip._tcp.example.com. IN SRV 10 60 5060 sipserver.example.com. CAA
Declares which CAs may issue certificates for the domain.
example.com. IN CAA 0 issue "letsencrypt.org" HTTPS
Service binding for HTTPS (ALPN and hints like ECH), lets clients skip a round trip.
hugosibony.com. 300 IN HTTPS 1 . alpn="h3,h2" ipv4hint="104.21.86.12,172.67.213.189" OPT
EDNS(0) pseudo-record, not real zone data. Lives in the Additional section, advertises UDP payload size and carries the DO (DNSSEC OK) bit.
;; OPT PSEUDOSECTION: EDNS: version: 0, flags: do; udp: 1232 DS
Delegation Signer, a hash of a child zone's DNSKEY, published in the parent to build the DNSSEC chain of trust.
example.com. 3600 IN DS 370 13 2 BE74359954660069D5C63D200C39F5603827D7DD02B56F120EE9F3A86764247C DNSKEY
A zone's DNSSEC public key.
example.com. 3600 IN DNSKEY 257 3 13 mdsswUyr3DPW132mOi8V9xESWE8jTo0dxCjjnopKl+GqJxpVXckHAeF+KkxLbxIL... RRSIG
A DNSSEC signature over an RRset.
example.com. 3600 IN RRSIG A 13 2 3600 20240201000000 20240101000000 12345 example.com. J5A6...== Authenticity: DNSSEC
Nothing above proves an answer is genuine. A resolver on the path could forge one, and a plain lookup would never notice. DNSSEC fixes that with signatures. Each zone signs its records with a private key and publishes the signature as an RRSIG and the public key as a DNSKEY. The parent zone vouches for that key with a DS record, so trust chains from the root down to the name. A validating resolver checks the chain and sets the AD bit in the header when it holds.
DNSSEC proves an answer is authentic; it does not hide it. Confidentiality is a separate job, done by encryption.
References
- RFC 1035 §4.1: message format, header, question, and resource-record layout.
- RFC 4035 and RFC 6840: the
ADandCDDNSSEC header bits. - RFC 6891: EDNS(0) and the OPT pseudo-record.
- RFC 4033 and RFC 4035: DNSSEC, the chain of trust, and validation.
- IANA DNS parameters: the record-type and header-flag registries.
- Defining RFCs for the types shown: 3596 (AAAA), 2782 (SRV), 8659 (CAA), 9460 (HTTPS/SVCB), 4034 (DS, DNSKEY, RRSIG).
DNS series
- How DNS works
- Inside a DNS packet (this post)
- Encrypting DNS
- How malware abuses DNS
Practical companion: Which resolver to choose.