DNSKEY record at a glance

FieldValue
Type code48
Defined inRFC 4034, section 2
ValueFlags, protocol (always 3), algorithm and the public key
Where it livesAt the zone apex
Needed whenThe zone is signed with DNSSEC

Here is how a DNSKEY set looks in a zone file:

example.com.  3600  IN  DNSKEY  257 3 13 mdsswUyr3DPW132mOi8V9xESWE8jTo0dxCjjnopKl+GqJxpVXckHAeF+KkxLbxILfDLUT0rAK9iUzy1L53eKGQ==
example.com.  3600  IN  DNSKEY  256 3 13 oJMRESz5E4gYzS/q6XDrvU1qMPYIjCWzJaOau8XNEZeqCYKD5ar0IRd8KqXXFJkqmVfRvMGPmM1x8fGAa2XhSA==

The first key has flags 257, marking it as a key signing key (KSK); the second has 256, a zone signing key (ZSK). Both use algorithm 13. The key material shown is illustrative.

KSK and ZSK

Most zones use two kinds of key. The zone signing key (ZSK, flags 256) signs the ordinary records: A, MX, TXT and so on. The key signing key (KSK, flags 257) signs only the DNSKEY set itself, and it is the key the parent's DS record points to. Splitting the roles means the ZSK can be replaced often without touching the registrar, while the KSK, which needs a DS change, is rolled rarely.

Some providers use a single combined key (a CSK) with flags 257 that does both jobs. That is valid and common with modern elliptic curve algorithms.

Algorithms and size

The algorithm number says how the key signs. Algorithm 13 (ECDSA P-256 with SHA-256) is the most widely recommended today because its keys and signatures are small. Algorithm 8 (RSA with SHA-256) is still common, and algorithm 15 (Ed25519) is growing. Older algorithms such as 5 and 7 (RSA with SHA-1) are deprecated by RFC 8624.

Large RSA keys, several keys during a rollover, and their signatures can make the DNSKEY answer bigger than a typical UDP packet. Resolvers then retry over TCP, so TCP port 53 must be open to your name servers. EDNS and TCP fallback explains why.

Key tags and rollovers

Each key has a key tag, a 16-bit number computed from the key. Signatures (RRSIG) and DS records refer to a key by its tag and algorithm, which is how you match them up when debugging. During a rollover the zone publishes the old and new keys side by side until caches have seen both. DNSSEC key rollovers walks through the steps.

How to look up a DNSKEY record

Each tool below sends the query to your default resolver unless you name a server. Swap in your own domain for example.com, and add a public resolver such as 1.1.1.1 to compare answers with what your network sees.

dig (macOS, Linux, WSL)

CommandWhat it does
dig example.com DNSKEYThe DNSKEY set, with TTL
dig +multi example.com DNSKEYEach key on several lines, with a comment giving KSK or ZSK, the algorithm and the key tag
dig +dnssec example.com DNSKEYThe keys plus the RRSIG that signs them
dig +short example.com DSThe parent’s DS, to compare its key tag with the KSK
delv example.com DNSKEYValidate the DNSKEY set against the chain of trust

nslookup (Windows, macOS, Linux)

CommandWhat it does
nslookup -type=DNSKEY example.comThe DNSKEY set from your default DNS server
nslookup -type=DNSKEY example.com ns1.example.netThe keys straight from an authoritative server

PowerShell (Windows)

CommandWhat it does
Resolve-DnsName -Name example.com -Type DNSKEYThe DNSKEY records with flags, protocol, algorithm and key columns
Resolve-DnsName example.com -Type DNSKEY -DnssecOkAlso return the RRSIG records
Resolve-DnsName example.com -Type DNSKEY -TcpOnlyQuery over TCP, to test that large answers can get through

Common mistakes

  • TCP port 53 blocked to the name servers. Large DNSKEY answers then fail for some resolvers.
  • Signatures left to expire. RRSIGs have an end date; a signer that stops running breaks the zone when they lapse.
  • Removing a key too early in a rollover. Caches that still hold old signatures can no longer check them.
  • A KSK that no DS matches. The zone is signed but not linked to its parent, so validators treat it as insecure, or as bogus if an old DS remains.

DNSKEY records in Domain Visualizer

Domain Visualizer looks up DNSKEY and DS at the apex on every scan, so you can see whether a zone publishes keys and whether its parent links to them.

FAQ

Why are there several DNSKEY records?

Usually one is the key signing key and one is the zone signing key. During a rollover a zone also publishes the old and new keys side by side for a while.

What does the 3 in a DNSKEY record mean?

It is the protocol field. RFC 4034 fixes it at 3 for DNSSEC, and a key with any other value is not used for validation.

Do I need to manage DNSKEY records myself?

Not with most managed DNS providers. They create, publish and roll the keys when you enable DNSSEC. You only handle the DS record at your registrar.

Sources and further reading