Changing DNS: Dynamic Updates, Zone Transfers and NOTIFY
How DNS data changes and spreads: signed dynamic updates with nsupdate and TSIG, prerequisites and update errors, the primary's journal, NOTIFY to secondaries, full (AXFR) and incremental (IXFR) zone transfers, restricting and encrypting transfers, all captured in the lab.
kvi5hnuCode Sprout team member13 min readOn this page
So far, zones in this course have been static files loaded at startup. Real zones change: DHCP servers register new hosts, certificate tools publish validation records, and administrators add services. Those changes have to reach every authoritative server for the zone, usually within seconds. This article covers the three protocol pieces that make that happen: dynamic update (RFC 2136) to change a zone, NOTIFY (RFC 1996) to tell secondaries about the change, and zone transfers, full (AXFR, RFC 5936) or incremental (IXFR, RFC 1995), to copy it.
Zone transfers: copying a zone
A secondary server gets its copy of a zone from the primary with a zone transfer. The simplest is a full transfer, AXFR: a query of type AXFR, always over TCP, answered with every record in the zone, starting and ending with the SOA record. ns2 in the lab is allowed to transfer example.com from ns1. Running dig from ns2's address, the first lines and the last line of the transfer:
example.com. SOA ns1.example.com. hostmaster.example.com. 2026112101
example.com. NS ns1.example.com.
example.com. NS ns2.example.com.
example.com. A 198.51.100.10
example.com. AAAA 2001:db8:2::10
example.com. MX 10 mail.example.com.
example.com. MX 20 mail2.example.net.
example.com. TXT "v=spf1 mx -all"
example.com. SOA ns1.example.com. hostmaster.example.com. 2026112101
;; XFR size: 31 records (messages 1, bytes 820)
The whole 31-record zone fit in one 820-byte message. Large zones take many messages on the same TCP connection. The repeated SOA at the end tells the receiver the transfer is complete.
The same request from the client is refused, because the primary allows transfers only to its secondaries:
; (1 server found)
; Transfer failed.
That restriction matters. An open AXFR hands anyone a complete list of a zone's hosts, which is a gift for attackers mapping a network. Restrict transfers to known secondaries by address, and better, by TSIG key (below).
Dynamic updates
Editing zone files by hand doesn't scale and is error-prone. DNS UPDATE (opcode 5) lets an authorized client add or delete records on the primary server over the network. It reuses the normal message format, with the four sections renamed:

- Zone: exactly one entry, the zone being changed.
- Prerequisite: conditions that must be true for the update to happen. There are five kinds: an RRset exists (with any value, or with exactly these values), an RRset doesn't exist, a name is in use, or a name isn't in use. They're encoded with special class and type values, such as class NONE and type ANY for "name not in use".
- Update: records to add, a specific record to delete, an RRset to delete, or all records at a name to delete.
- Additional: related records, and in practice the TSIG signature.
The server checks the prerequisites and whether the client is allowed to make the change, and applies all the changes atomically: either every change in the message happens, or none do.
Securing updates with TSIG
An update must be authenticated, or anyone could rewrite your zone. The usual method is TSIG (transaction signatures, RFC 8945): the client and server share a secret key, and each message carries a TSIG record with an HMAC (a keyed hash, here using SHA-256, that only holders of the key can compute) over the message and a timestamp. The lab generated a key with BIND's tsig-keygen:
key "upd-key" {
algorithm hmac-sha256;
secret "(base64 key, 32 random bytes)";
};
The primary's zone configuration allows updates signed with that key: allow-update { key "upd-key"; };. Because TSIG includes a timestamp, both sides' clocks must agree within a few minutes (the default "fudge" is 300 seconds), so the hosts need synchronized time, for example from NTP (the Network Time Protocol).
Other options exist. GSS-TSIG (RFC 3645) uses Kerberos instead of a shared key and is how Windows clients update Active Directory DNS zones. SIG(0) (RFC 2931) uses public keys but is rarely deployed, and BIND removed support for SIG(0)-signed requests in 2024 after a CPU-exhaustion vulnerability (CVE-2024-1975, its entry in the public list of known vulnerabilities).
Making an update with nsupdate
Before the update, both servers had the same serial:
ns1 serial: 2026112101 ns2 serial: 2026112101
The client then used nsupdate, BIND's update tool, to add an address for api.example.com, but only if that name didn't exist yet:
server 198.51.100.53
zone example.com
prereq nxdomain api.example.com
update add api.example.com 300 A 198.51.100.91
update add api.example.com 300 AAAA 2001:db8:2::91
send
nsupdate exit status: 0
A capture of the exchange, decoded by Wireshark, shows the update's section counts and the TSIG signature in both directions:
dns.flags.response dns.flags.opcode dns.flags.rcode dns.count.zones dns.count.prerequisites dns.count.updates dns.count.add_rr dns.tsig.algorithm_name
False 5 1 1 2 1 hmac-sha256
True 5 0 1 0 0 1 hmac-sha256
The request had 1 zone, 1 prerequisite and 2 updates, plus the TSIG record counted in the additional section. The response, with RCODE 0, echoed the zone and carried its own TSIG signature, so the client knows the response wasn't forged.
A moment later, the primary had incremented the serial itself, the secondary had already caught up, and the new name resolved from the secondary:
ns1 serial: 2026112102 ns2 serial: 2026112102
api.example.com. 300 IN A 198.51.100.91
When an update fails
Running the same update again failed, because the prerequisite no longer held:
update failed: YXDOMAIN
YXDOMAIN means "the name exists but shouldn't". Prerequisites let clients avoid overwriting each other: a DHCP server can register a name only if no one else holds it. An update without any key was refused:
update failed: REFUSED
And an update signed with the wrong secret failed TSIG verification:
; TSIG error with server: tsig indicates error
update failed: NOTAUTH(BADSIG)
The update RCODEs are YXDOMAIN (6), YXRRSET (7, an RRset exists but shouldn't), NXRRSET (8, an RRset doesn't exist but should), NOTAUTH (9, the server isn't authoritative, or here, the signature is wrong) and NOTZONE (10, a record is outside the zone).
The journal
A dynamically updated zone can't simply be rewritten as a text file after every change. BIND records each change in a journal file next to the zone file and merges it into the zone file periodically. After a second update, which replaced the address of short.example.com, BIND's named-journalprint showed the last changes:
example.com.zone.jnl
add api.example.com. 300 IN A 198.51.100.91
add api.example.com. 300 IN AAAA 2001:db8:2::91
del example.com. 3600 IN SOA ns1.example.com. hostmaster.example.com. 2026112102 7200 900 1209600 300
del short.example.com. 30 IN A 198.51.100.30
add example.com. 3600 IN SOA ns1.example.com. hostmaster.example.com. 2026112103 7200 900 1209600 300
add short.example.com. 30 IN A 198.51.100.31
Each transaction is recorded as "delete the old SOA, delete or add records, add the new SOA". Once a zone is dynamic, edit it only with updates, or freeze it first (rndc freeze), edit the file, and thaw it (rndc thaw). Otherwise, the journal and the file disagree and the server refuses to load the zone.
NOTIFY: telling secondaries right away
Originally, secondaries learned about changes only by polling: every refresh interval from the SOA (2 hours in this zone), they asked the primary for its SOA and transferred the zone if the serial had increased. NOTIFY (opcode 4) shortens that: when a zone changes, the primary sends a NOTIFY message to its secondaries, and they check immediately.

The capture on ns2 during the update shows exactly this sequence:
IP 198.51.100.53.43518 > 198.51.100.54.53: 57 notify [b2&3=0x2400] [1a] SOA? example.com. (80)
IP 198.51.100.54.53 > 198.51.100.53.43518: 57 notify*- 0/0/0 (29)
IP 198.51.100.54.49557 > 198.51.100.53.53: 64468 [1au] SOA? example.com. (44)
IP 198.51.100.53.53 > 198.51.100.54.49557: 64468*- 1/2/5 SOA (219)
IP 198.51.100.54.51309 > 198.51.100.53.53: Flags [S], seq 1451213787, win 64660, options [mss 1220,sackOK,TS val 1984421
IP 198.51.100.53.53 > 198.51.100.54.51309: Flags [S.], seq 1270915357, ack 1451213788, win 65232, options [mss 1220,sack
IP 198.51.100.54.51309 > 198.51.100.53.53: Flags [P.], seq 1:98, ack 1, win 506, options [nop,nop,TS val 1984421734 ecr
IP 198.51.100.53.53 > 198.51.100.54.51309: Flags [P.], seq 1:250, ack 98, win 509, options [nop,nop,TS val 3290401257 ec
ns1sent a NOTIFY forexample.com's SOA. tcpdump printsnotify,[b2&3=0x2400]is the flags word, binary0010 0100 0000 0000: opcode 4 (0100after the QR bit) and AA set.[1a]means the query carries one answer record.ns2acknowledged it (notify*-).ns2didn't trust the NOTIFY's content, but askedns1for the SOA itself and saw the higher serial.- It opened a TCP connection and sent a 97-byte request (an IXFR;
seq 1:98counts bytes 1 to 97) and got a 249-byte response with the changes. The secondary was up to date within milliseconds of the update.
The NOTIFY query, decoded:
dns.flags.opcode dns.qry.name dns.qry.type dns.count.answers
4 example.com 6 1
It carries the zone name with type SOA (6) in the question, and the new SOA in the answer section as a hint. NOTIFYs are sent to the servers listed in the zone's NS records, plus any configured with also-notify, and only accepted from the zone's configured primaries. A NOTIFY is only a hint: a forged one can at most make a secondary check its primary early.
IXFR: transferring only the changes
Re-sending a 100,000-record zone because one record changed is wasteful. An incremental zone transfer (IXFR) sends only the differences since a serial the secondary names. The secondary puts its current SOA in the request's authority section, and the primary answers with a list of changes from its journal. Asking ns1 for the changes since the serial before the second update:
example.com. SOA ns1.example.com. hostmaster.example.com. 2026112103
example.com. SOA ns1.example.com. hostmaster.example.com. 2026112102
short.example.com. A 198.51.100.30
example.com. SOA ns1.example.com. hostmaster.example.com. 2026112103
short.example.com. A 198.51.100.31
example.com. SOA ns1.example.com. hostmaster.example.com. 2026112103
The format is a series of difference sequences, each bracketed by SOA records:
- The first SOA is the current version, 2026112103.
- Then the old SOA (2026112102), followed by the records deleted in that change: the old address of
short. - Then the new SOA (2026112103), followed by the records added: the new address.
- The final SOA, again the current version, ends the transfer.
If the secondary is already current, the response is just one SOA record:
example.com. SOA ns1.example.com. hostmaster.example.com. 2026112103
If the primary no longer has the journal for the requested serial, it falls back to sending the whole zone, in AXFR format, inside the IXFR response. IXFR can start over UDP when the change is small, but servers normally use TCP.
Securing and scaling zone transfers
- Restrict transfers to your secondaries, by address and with a TSIG key, so a stolen address isn't enough.
- Encrypt them if the zone content is sensitive: XoT, zone transfer over TLS (RFC 9103), runs AXFR and IXFR over TLS on port 853. BIND and the other common authoritative servers, Knot and NSD, support it.
- Catalog zones (RFC 9432) automate adding and removing zones on secondaries: the primary publishes a special zone listing the member zones, and secondaries that transfer it configure themselves.
- Hidden primaries are common: the primary isn't listed in the NS records and isn't reachable from the Internet. It only feeds the public secondaries, often run by a DNS hosting provider.
Many large operators don't use zone transfers at all but replicate zone data through a database, which is fine: RFC 5936 makes AXFR only one way to keep servers in sync.
Common questions
What's the difference between AXFR and IXFR?
AXFR transfers the entire zone. IXFR transfers only the changes since a serial number the secondary gives, using the primary's journal, and falls back to a full transfer if it can't. IXFR saves bandwidth and time for large zones with small changes.
Why does my secondary not pick up my changes?
Most often, the SOA serial didn't increase, so the secondary thinks it's current. Other causes: the primary's NOTIFY doesn't reach the secondary, a firewall blocks TCP port 53 between them, the secondary isn't in the primary's allow-transfer list, or the TSIG key or clocks don't match. Compare dig @each-server zone SOA to see the serials.
Is it safe to allow dynamic updates on a public server?
Only with strong authentication, such as TSIG or GSS-TSIG, and narrow permissions. BIND's update-policy can limit a key to specific names or types, for example letting a certificate tool change only _acme-challenge TXT records. Never allow updates by source address alone, since UDP source addresses can be spoofed.
Why does a DNS UPDATE use prerequisites?
To make changes safe when several clients update the same zone. A prerequisite such as "this name doesn't exist" or "this record has this exact value" turns the update into a compare-and-set operation, so one client doesn't silently overwrite another's change.
Do secondaries trust the content of a NOTIFY?
No. A NOTIFY only prompts the secondary to check. It queries the primary's SOA itself and transfers the zone if the serial is newer. It also accepts NOTIFY messages only from the primaries it's configured to use.
Can I edit a zone file directly when it also gets dynamic updates?
Not safely while the server is running. The server keeps changes in a journal and may rewrite the file. Freeze the zone first (rndc freeze), edit and increase the serial, then thaw it (rndc thaw) so the server reloads it.
Summary
- Secondaries copy zones from the primary with zone transfers over TCP: AXFR for the whole zone, starting and ending with the SOA, and IXFR for the changes since a given serial.
- Restrict transfers to known secondaries, ideally with TSIG. XoT (RFC 9103) encrypts them, and catalog zones (RFC 9432) automate secondary configuration.
- DNS UPDATE (opcode 5) adds and deletes records. Its sections become zone, prerequisite, update and additional, and the changes are atomic.
- Updates must be authenticated, usually with TSIG, an HMAC with a shared key and timestamp. GSS-TSIG is used with Active Directory.
- Failed prerequisites return YXDOMAIN, YXRRSET or NXRRSET. Unsigned updates get REFUSED, and bad signatures NOTAUTH.
- Servers record dynamic changes in a journal, which also feeds IXFR. The serial increases automatically with each update.
- NOTIFY (opcode 4) tells secondaries a zone changed. They check the SOA themselves and transfer the changes, so updates spread in milliseconds instead of waiting for the SOA refresh interval.
Practice questions
1. A secondary has serial 2026112101 for a zone whose primary is at 2026112103. What does the IXFR response contain?
Answer
The current SOA (2026112103), then for each change in order: the old SOA and the records deleted, the new SOA and the records added. Here that's two difference sequences, 2026112101 to 2026112102 and 2026112102 to 2026112103, followed by the current SOA again. If the primary lacks the journal for 2026112101, it sends the whole zone instead.
2. Which prerequisite would a DHCP server use to make sure it doesn't overwrite a host name registered by another device, and what error does it get if the name is taken?
Answer
"Name is not in use" (prereq nxdomain name in nsupdate). If the name already exists, the server returns YXDOMAIN and makes no change.
3. An update signed with a correct TSIG key is rejected with BADTIME. What's wrong?
Answer
The client's and server's clocks differ by more than the allowed fudge, typically 300 seconds. TSIG includes a timestamp to prevent replay, so both machines need accurate time, for example from NTP.
4. Why is an open AXFR a security problem even though all the records are public anyway?
Answer
Individual records are public only if you know their names. AXFR lists every name in the zone, including internal hosts, test systems and service records that would be hard to guess, giving an attacker a complete map. Restrict AXFR to secondaries.
5. A zone's SOA refresh is 2 hours. You add a record on the primary and increase the serial. With NOTIFY working, when does a secondary serve it? Without NOTIFY?
Answer
With NOTIFY, within seconds: the primary notifies, the secondary checks the SOA and transfers the change. Without NOTIFY, at the secondary's next refresh, up to 2 hours later (or at its retry interval if a check failed).
6. Why does an AXFR response end with a copy of the SOA record?
Answer
A transfer can span many messages on one TCP connection, and the receiver needs to know when it has everything. The zone's SOA appears first and again last, so the second SOA marks the end of a complete transfer.
Previous: DNS Record Types: A, AAAA, CNAME, MX, NS, SOA, PTR, TXT, SRV, CAA, SVCB and HTTPS
Next: DNS in Practice: Round Robin, Split DNS, Open Resolvers, mDNS, LLMNR and DNS Attacks

More in TCP/IP Course
Quiz: TCP/IP Delicate Details
Twenty-five questions on the details that catch out experienced engineers: sequence numbers for SYN and FIN, TIME_WAIT versus tcp_fin_timeout, Karn's algorithm, socket buffer doubling, even and odd ephemeral ports, IPv6 checksums and fragmentation, negative DNS caching, and capture filter traps.
Quiz: TCP/IP Interview Questions
Thirty-three networking questions of the kind asked in developer, SRE and network engineering interviews: what happens when you load a URL, TCP versus UDP, handshakes, closing and TIME_WAIT, subnetting, NAT, DNS, MTU problems, congestion, TLS and QUIC, and debugging slow or failing connections.
Quiz: TCP/IP Course Final Exam (All Parts)
The final exam for the TCP/IP course: thirty questions across all fourteen parts, from packets and addressing through Ethernet, ARP, IP, DHCP, NAT, ICMP, UDP, DNS, TCP connections, reliability, congestion control, security, QUIC and troubleshooting.
Quiz: Modern Transports and Troubleshooting (TCP/IP Part 14)
Review modern transports and troubleshooting: QUIC packets, handshakes, 0-RTT, streams and connection migration, HTTP/3, Multipath TCP, SCTP multihoming, and a layered method for diagnosing real network faults.
Discussion
Sign in to ask a question or share what you learned.