Lesson 5 of 9 · 25m
Running Authoritative DNS: Primaries, Secondaries, Transfers, and TSIG
How authoritative service stays boring: hidden primaries, NOTIFY/AXFR mechanics, transfer authentication, serial discipline, and failure isolation.
Authoritative DNS is simple in the way aviation is simple: the mechanics are understandable, and complacency is what hurts people. Your job is to serve correct zone data consistently from independent machines while making unauthorized updates and accidental transfers hard.
Separate editing from serving
A strong pattern is a hidden primary: one machine where zone data is edited and signed, not listed in public NS records, feeding public secondaries that absorb query load.
admin/edit host ──> hidden primary ──NOTIFY/IXFR──> public ns1
└──NOTIFY/IXFR──> public ns2The hidden primary can be firewalled from general query traffic, reducing attack surface and making administration less exciting.
NOTIFY triggers, IXFR/AXFR replicate
After a zone change, the primary sends NOTIFY; secondaries compare serials and request incremental (IXFR) or full (AXFR) transfers. This is replication, not caching.
zone "sudosecurity.org" {
type primary;
file "/etc/bind/zones/sudosecurity.org.zone";
notify yes; also-notify { 203.0.113.53; 203.0.113.54; };
allow-transfer { key "ops-transfer"; };
};The secondary declares the primary and uses the same transfer key. Exact syntax varies by server and version; the invariant does not: transfers are restricted and authenticated.
TSIG authenticates server-to-server operations
TSIG signs DNS messages with a shared secret. It is not encryption and not user authentication; it proves the peer knows the key. Test with dig @198.51.100.20 sudosecurity.org AXFR -y hmac-sha256:ops-transfer:$TSIG_SECRET.
key "ops-transfer" { algorithm hmac-sha256; secret "base64-shared-secret-from-your-secret-store"; };Public AXFR leaks internal host inventory and makes reconnaissance free. There are narrow transparency cases, but exposure should be a decision, never an accident.
Diversity is the point of secondaries
Two nameservers on the same VPS, network, kernel image, and automation credential are one failure domain wearing a trench coat. Spread across machines, providers or networks, administrative paths, and preferably software failure modes. Monitor every advertised NS individually; the zone can look healthy while one server is lame.
dig @ns1.sudosecurity.org sudosecurity.org SOA +noall +answer
dig @ns2.sudosecurity.org sudosecurity.org SOA +noall +answerSerials need not match in every instant during transfer, but persistent skew means replication is broken. A lame server is worse: the parent delegates to it, yet it does not answer authoritatively.
Rollback is a forward move
Rollback means publishing the previous data with a higher serial, not restoring the old serial. Reusing the old serial tells secondaries, quite reasonably, that nothing changed.
Field notes
- Protect the hidden primary with firewall rules even when TSIG is required; defense in depth is cheap here.
- Treat transfer keys as production secrets with rotation and access logging.
- Test disaster recovery by rebuilding a secondary from scratch; untested files in
/var/libare archaeology, not recovery. - Provisioning automation should validate and generate serials, never edit authoritative files ad hoc.
Was this lesson helpful?