The Domain Name System (DNS) keeps several copies of every zone, and Zone transfers and NOTIFY explains why: the start of authority () timers, the refresh cycle, the serial arithmetic, the configuration that restricts and encrypts a transfer. This part goes one level down, to the octets. It writes out by hand, field by field, the six messages that move a change from the server where it is made to every server that copies it: the NOTIFY that announces the change, the SOA query that checks it, the full transfer, ("Authoritative Transfer"), and the incremental one, ("Incremental Transfer"), that copy it, the dynamic UPDATE that can make it, and the Secret Key Transaction Authentication for DNS () record that signs any of them. Every byte shown was produced by a short script that follows the Requests for Comments (RFCs) cited beside each field, so the dumps are exact. After reading, you can decode each message from a hex dump, find any field by its offset, rebuild a TSIG message authentication code (MAC) input and check it yourself, name the rule each byte obeys, and tell a healthy exchange from a broken or abused one. The header's twelve octets are taken apart in The DNS header: opcode, status and flags; this part assumes them and spends its time on what follows.
Conventions, and the frame every message shares
The zone is example.com., one of the second-level names 2606 reserved in 1999 for names that, "without fear of conflicts with current or future actual names in the global DNS", serve among other things for "examples in documentation" (RFC 2606, sections 2 and 3). Addresses come from the three Internet Protocol version 4 (IPv4) blocks RFC 5737 describes as "provided for use in documentation": 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 (RFC 5737, sections 1 and 3). The primary is 192.0.2.53, the secondary 198.51.100.53. Octets are written in hexadecimal, two digits each, with the offset of the first octet of each line on the left, counted from zero.
Four rules from RFC 1035 hold for every message below. The header is 12 octets: a 16-bit identifier (ID), a 16-bit flags word and four 16-bit section counts (RFC 1035, section 4.1.1). A name is a sequence of labels, each one length octet followed by that many characters, ending in a zero octet for the root. A name, or the tail of one, that already appeared in the message may be replaced by a two-octet pointer whose "first two bits are ones" and whose remaining 14 bits give "an offset from the start of the message (i.e., the first octet of the ID field in the domain header)" (RFC 1035, section 4.1.4). The question always starts at offset 12, so c0 0c means "the name at offset 0x0c", which in every message here is example.com.. Over the Transmission Control Protocol (TCP), "The message is prefixed with a two byte length field which gives the message length, excluding the two byte length field" (RFC 1035, section 4.2.2).
That length field is the only ceiling a transfer message has: RFC 5936 reads it as unsigned, "thus causing a limit of 65535 octets", a limit "not changed by EDNS0" (the Extension Mechanisms for DNS, version 0), and it adds that "the TC (truncation) bit is never set by an AXFR server nor considered/read by an AXFR client" (RFC 5936, section 2). The compression pointer sets a softer one. Its offset has 14 bits, so a pointer can reach back only into the first 16,384 octets of a message, and RFC 9103 notes that "For some DNS implementations, this limits the size of an individual XFR response used in practice to something around the order of 16 KB" (RFC 9103, section 7.11).
The flags word is the fastest way to tell these messages apart, because the operation code (opcode) sits in bits 1 to 4 and moves the second hex digit:
| Message | Opcode | Flags word in the request | Flags word in the response |
|---|---|---|---|
| SOA query, AXFR, IXFR | 0, QUERY | 00 00 (recursion not requested) | 84 00 (, AA) |
| NOTIFY | 4 | 24 00 (opcode 4, AA) | a4 00 (QR, opcode 4, AA) |
| UPDATE | 5 | 28 00 | a8 0r, with the response code () in the last digit |
The arithmetic is the same each time: the opcode shifted left by 11 bits, plus 0x8000 for QR (query/response), plus 0x0400 for AA (authoritative answer). Opcode 4 gives 0x2000, and with AA 0x2400; opcode 5 gives 0x2800. The Internet Assigned Numbers Authority () registry, updated 2026-11-18 and read 2026-11-23, still lists 4 as Notify (RFC 1996) and 5 as Update (RFC 2136) (IANA, DNS OpCodes).
Message 1: the NOTIFY that starts the cycle
RFC 1996 (August 1996) lets a primary tell its secondaries that a zone changed instead of waiting for them to poll. The request it specifies has "query ID: (new)", "op: NOTIFY (4)", "resp: NOERROR", "flags: AA", "qcount: 1", the zone name and class, and "qtype: T_SOA" (RFC 1996, section 4.5). Written out for example.com, it is 29 octets:
0000 4b 1d 24 00 00 01 00 00 00 00 00 00 07 65 78 61
0010 6d 70 6c 65 03 63 6f 6d 00 00 06 00 01
| Offset | Octets | Field | Value |
|---|---|---|---|
| 0x00 | 4b 1d | ID | 0x4b1d, chosen by the primary |
| 0x02 | 24 00 | Flags | QR 0, opcode 4 (NOTIFY), AA 1, RCODE 0 |
| 0x04 | 00 01 | QDCOUNT | 1 |
| 0x06 to 0x0b | 00 00 ×3 | ANCOUNT, NSCOUNT, ARCOUNT | 0, 0, 0 |
| 0x0c | 07 65 78 61 6d 70 6c 65 | Label 1 | length 7, "example" |
| 0x14 | 03 63 6f 6d | Label 2 | length 3, "com" |
| 0x18 | 00 | Root | end of name |
| 0x19 | 00 06 | QTYPE | 6, SOA |
| 0x1b | 00 01 | QCLASS | 1, IN |
The secondary's answer is the same 29 octets with one octet changed: the flags become a4 00, QR set. RFC 1996 says so in as many words: the response "is intended to be identical to the NOTIFY request, except that the QR bit is also set. The query ID of the response must be the same as was received in the request" (RFC 1996, section 4.7). Every unused field must be zero, and "implementations must ignore all messages for which this is not the case" (section 3.2).
What the bytes do not show is the timing around them. NOTIFY travels over the User Datagram Protocol (UDP) "unless the master has reason to believe that TCP is necessary" (section 3.4), and over UDP the primary resends until it gets a response "with a matching query ID, QNAME, IP source address, and UDP source port number"; the RFC proposes "a 60 second interval" and "a maximum of 5 retransmissions" as defaults (section 3.6). A primary may also wait before sending, a delay "chosen at random, so that each slave will begin its transfer at a unique time", never longer than the SOA REFRESH, with "Random delays of between 30 and 60 seconds" suggested for servers on one local network (section 4.3). A secondary that receives the same NOTIFY again before it has finished acting on the first "should defer action", to avoid "pummeling the master server" (section 4.4); one that does not implement the opcode answers NOTIMP, "Not Implemented", and the primary treats that as done (section 3.12).
A NOTIFY may carry the new SOA in its answer section (ANCOUNT greater than 0), but only as "an unsecure hint" (section 3.7), and "In no case shall the answer section of a NOTIFY request be used to update a slave's local data, or to indicate that a zone transfer needs to be undertaken, or to change the slave's zone refresh timers" (section 3.8). The secondary must also ignore a NOTIFY "from a host that is not a known master for the zone" and log it (section 3.10). Those two rules are the whole defence of an unsigned NOTIFY, which is why it is worth signing (message 6). Its existence also leaks: "Unencrypted NOTIFY messages identify configured secondaries on the primary" (RFC 9103, section 5.3.1). Over DNS over QUIC (), NOTIFY is one of only two opcodes, with QUERY, that a client may send in the zero round-trip (0-RTT) data of a resumed session, because both are "replayable" (RFC 9250, section 4.5).
Message 2: the SOA check and its answer
On a NOTIFY the secondary "should behave as though the zone given in the QNAME had reached its REFRESH interval": it asks for the SOA and compares serials (RFC 1996, section 3.11). The question is the NOTIFY's, under opcode 0 and with recursion not requested, so the first four octets become 7a 01 00 00 and the rest is identical. The answer is 102 octets and carries the first resource record (RR) of this part:
0000 7a 01 84 00 00 01 00 01 00 00 00 00 07 65 78 61
0010 6d 70 6c 65 03 63 6f 6d 00 00 06 00 01 c0 0c 00
0020 06 00 01 00 00 0e 10 00 3d 03 6e 73 31 07 65 78
0030 61 6d 70 6c 65 03 63 6f 6d 00 0a 68 6f 73 74 6d
0040 61 73 74 65 72 07 65 78 61 6d 70 6c 65 03 63 6f
0050 6d 00 78 c4 05 2e 00 00 1c 20 00 00 03 84 00 12
0060 75 00 00 00 0e 10
| Offset | Octets | Field | Value |
|---|---|---|---|
| 0x02 | 84 00 | Flags | QR, AA |
| 0x06 | 00 01 | ANCOUNT | 1 |
| 0x1d | c0 0c | Owner | pointer to offset 12: example.com. |
| 0x1f | 00 06 / 00 01 | TYPE / CLASS | SOA / IN |
| 0x23 | 00 00 0e 10 | (time to live) | 3,600 seconds |
| 0x27 | 00 3d | RDLENGTH | 61 octets of record data (RDATA) |
| 0x29 | 03 6e 73 31 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00 | MNAME | ns1.example.com. (17 octets) |
| 0x3a | 0a 68 6f 73 74 6d 61 73 74 65 72 … | RNAME | hostmaster.example.com. (24 octets) |
| 0x52 | 78 c4 05 2e | SERIAL | 2,026,112,302 |
| 0x56 | 00 00 1c 20 | REFRESH | 7,200 |
| 0x5a | 00 00 03 84 | RETRY | 900 |
| 0x5e | 00 12 75 00 | EXPIRE | 1,209,600 (14 days) |
| 0x62 | 00 00 0e 10 | MINIMUM | 3,600 |
The RDLENGTH checks itself: 17 + 24 + 5 × 4 = 61 = 0x3d. The two names in the RDATA are written in full here; a server may compress them as well. The serial is the YYYYMMDDnn convention of the previous part read as one 32-bit number: 2026112302 is 0x78c4052e. If the secondary holds 2026112301 (0x78c4052d), the RFC 1982 comparison says the primary is newer and the secondary transfers.
Message 3: AXFR over TCP, a whole zone in one stream
The AXFR query is the SOA query's twin with QTYPE 252, 00 fc, "the pseudo-RR type for zone transfer" (RFC 5936, section 2.1.2), sent over TCP behind its length prefix:
0000 00 1d 2f 3e 00 00 00 01 00 00 00 00 00 00 07 65
0010 78 61 6d 70 6c 65 03 63 6f 6d 00 00 fc 00 01
The first two octets, 00 1d, say 29: the DNS message that follows. Everything after them is a 29-octet query with ID 0x2f3e, flags 0x0000, one question, and 00 fc 00 01 closing it. The answer below is a whole zone of eight records sent as a single message, 292 octets announced by the prefix 01 24:
0000 01 24 2f 3e 84 00 00 01 00 08 00 00 00 00 07 65
0010 78 61 6d 70 6c 65 03 63 6f 6d 00 00 fc 00 01 c0
0020 0c 00 06 00 01 00 00 0e 10 00 3d 03 6e 73 31 07
0030 65 78 61 6d 70 6c 65 03 63 6f 6d 00 0a 68 6f 73
0040 74 6d 61 73 74 65 72 07 65 78 61 6d 70 6c 65 03
0050 63 6f 6d 00 78 c4 05 2e 00 00 1c 20 00 00 03 84
0060 00 12 75 00 00 00 0e 10 c0 0c 00 02 00 01 00 01
0070 51 80 00 06 03 6e 73 31 c0 0c c0 0c 00 02 00 01
0080 00 01 51 80 00 06 03 6e 73 32 c0 0c 03 6e 73 31
0090 c0 0c 00 01 00 01 00 01 51 80 00 04 c0 00 02 35
00a0 03 6e 73 32 c0 0c 00 01 00 01 00 01 51 80 00 04
00b0 c6 33 64 35 03 77 77 77 c0 0c 00 01 00 01 00 00
00c0 01 2c 00 04 c0 00 02 0a c0 0c 00 0f 00 01 00 00
00d0 0e 10 00 09 00 0a 04 6d 61 69 6c c0 0c c0 0c 00
00e0 06 00 01 00 00 0e 10 00 3d 03 6e 73 31 07 65 78
00f0 61 6d 70 6c 65 03 63 6f 6d 00 0a 68 6f 73 74 6d
0100 61 73 74 65 72 07 65 78 61 6d 70 6c 65 03 63 6f
0110 6d 00 78 c4 05 2e 00 00 1c 20 00 00 03 84 00 12
0120 75 00 00 00 0e 10
Offsets in this dump count the prefix, so the DNS message starts at 0x02 and a pointer c0 0c means offset 0x0e of the dump.
| Dump offset | Record | How it is written |
|---|---|---|
| 0x1f | example.com. SOA, serial 2026112302 | owner c0 0c; the 73-octet record of message 2 |
| 0x68 | example.com. NS (name server) ns1.example.com. | RDATA 03 6e 73 31 c0 0c: one new label, then a pointer (6 octets) |
| 0x7a | example.com. NS ns2.example.com. | the same shape, "ns2" |
| 0x8c | ns1.example.com. A 192.0.2.53 | owner 03 6e 73 31 c0 0c; RDATA c0 00 02 35 |
| 0xa0 | ns2.example.com. A 198.51.100.53 | RDATA c6 33 64 35 |
| 0xb4 | www.example.com. A 192.0.2.10 | TTL 00 00 01 2c, 300 seconds |
| 0xc8 | example.com. (mail exchanger) 10 mail.example.com. | RDATA 00 0a 04 6d 61 69 6c c0 0c: preference 10, then the name |
| 0xdd | example.com. SOA, serial 2026112302 again | the closing bracket |
The header says what RFC 5936 requires of every response message: the ID "MUST be copied from request" (and new servers must set it "in each AXFR response message for the session"), QR 1, opcode 0, AA 1 when there is no error, TC 0, QDCOUNT 1 in the first message and 0 or 1 after, ANCOUNT equal to the records in the answer, NSCOUNT 0 (RFC 5936, section 2.2.1). RA, recursion available, "SHOULD be 0", since "AXFR cannot be retrieved recursively" (same section, note c). The structure is the one rule the previous part quoted: the first message begins with the zone's SOA, the last ends with the same SOA, and intermediate messages never carry it (RFC 5936, section 2.2). Here first and last are the same message, which the RFC allows ("a series of length 1").
Between the two SOAs the order is free: the zone is "an unordered collection (or to use the mathematical term, a "set") of RRs", and "clients MUST accept any ordering and grouping of the non-SOA RRs" (section 2.2). Each message should carry enough records "to reasonably amortize the per-message overhead"; "Some old AXFR clients each response message to contain only a single RR", and a server may be configured to send them that way (section 2.2). Compression has a twist of its own: since the secondary must serve the zone exactly as received, it "SHOULD be performed in a case-preserving manner", so that, for compression, "a" is not equal to "A" (RFC 5936, section 3.4).
Three behaviours are invisible in a single dump and matter in a capture. An error ends the session with one message whose RCODE carries the condition and whose question is copied, without the closing SOA; a server that is not authoritative "SHOULD set the value to NotAuth(9)" (sections 2.2 and 2.2.1, note e). The client cannot cancel a transfer except by closing the connection, which cancels "all other outstanding activity using the connection" (RFC 5936, section 4.1.1), while a server "MUST be able to handle multiple AXFR sessions on a single TCP connection" (section 4.1.2); over DoQ, by contrast, each transfer has its own stream, which gives "a way for secondaries to cancel a single zone transfer occurring on a given stream without having to close the QUIC connection" (RFC 9250, section 4.3.1). And a received copy is never served half-built: the client loads it "in an atomic operation" after "successful completion of the AXFR operation and some sanity checks", and on any error "MUST continue to serve the previous version of the zone" (RFC 5936, section 6).
Zone transfer over Transport Layer Security (TLS), XoT, changes none of these octets. They travel inside a TLS 1.3 connection to port 853 instead of in the clear to port 53, the same length prefix in front of each message, and RFC 9103 adds two allowances a decoder must expect: padding, and "'empty' AXoT responses that contain only an RR containing the (0) option for padding", which secondaries "MUST be resilient to receiving" (RFC 9103, section 7.9.1). It also makes EDNS stricter for transfers: if the AXFR request carried an OPT record, responders "MUST include an OPT record in each of the subsequent AXFR responses" (RFC 9103, section 6.3.4).
Message 4: IXFR, only what changed
The incremental transfer of RFC 1995 (August 1996) asks with QTYPE 251, 00 fb, and tells the server what the client already has: "the authority section containing the SOA record of client's version of the zone" (RFC 1995, section 3). A secondary at serial 2026112301 sends 102 octets behind the prefix 00 66:
0000 00 66 5c 02 00 00 00 01 00 00 00 01 00 00 07 65
0010 78 61 6d 70 6c 65 03 63 6f 6d 00 00 fb 00 01 c0
0020 0c 00 06 00 01 00 00 0e 10 00 3d 03 6e 73 31 07
0030 65 78 61 6d 70 6c 65 03 63 6f 6d 00 0a 68 6f 73
0040 74 6d 61 73 74 65 72 07 65 78 61 6d 70 6c 65 03
0050 63 6f 6d 00 78 c4 05 2d 00 00 1c 20 00 00 03 84
0060 00 12 75 00 00 00 0e 10
The header's counts read 1, 0, 1, 0: one question and one authority record, which is the IXFR signature in a capture. The serial at dump offset 0x54 is 78 c4 05 2d, 2026112301, one less than the primary's.
The server can answer in three shapes, and the first two records tell them apart. If the client is current, or a UDP reply would not fit, the answer is "a single SOA record of the server's current version" (RFC 1995, section 2): the same 104 octets as the query with the flags at 84 00, the counts at 1, 1, 0, 0 and the serial at 2026112302. If the server keeps no history for that serial, it sends the whole zone exactly as an AXFR would, "except the query type is IXFR" (section 4). Otherwise it sends difference sequences, and "An incremental response is different from that of a non-incremental response in that it begins with two SOA RRs" (section 4). Suppose the only change between the two serials was the address of www, from 192.0.2.9 to 192.0.2.10:
| Position | Record | Role (RFC 1995, section 4) |
|---|---|---|
| 1 | example.com. SOA serial 2026112302 | the server's current version, opening |
| 2 | example.com. SOA serial 2026112301 | the older SOA: deletions follow |
| 3 | www.example.com. A 192.0.2.9 | deleted |
| 4 | example.com. SOA serial 2026112302 | the newer SOA: additions follow |
| 5 | www.example.com. A 192.0.2.10 | added |
| 6 | example.com. SOA serial 2026112302 | the current version, closing |
A change is a deletion followed by an addition ("Modification of an RR is performed first by removing the original RR and then adding the modified one"), sequences run "oldest first newest last", and the client replaces its copy only "after all the differences have been successfully processed" (section 4). A server may condense several versions into one sequence, and "Clients can't detect from the response whether the server has condensed the reply or not" (section 6). Zone transfers and NOTIFY tabulates RFC 1995's own three-version example; the rule to carry from it is that a parser classifies an IXFR answer by its second record: an SOA there means incremental, anything else means a full zone.
History is finite. A server "may delete them anytime", and should purge "if the total length of an IXFR response would be longer than that of an AXFR response" (RFC 1995, section 5); a server without the client's version "should not flag an error" but "attempt to perform a full zone transfer" (section 6). RFC 1995 expected the first IXFR attempt over UDP; RFC 9103 recorded in 2021 that (Berkeley Internet Name Domain) and the Name Server Daemon (NSD) "do IXFR using TCP by default in their latest releases", and asked implementations to keep "the same TCP connection for both AXFR and IXFR requests to the same primary" and to answer SERVFAIL when a transfer limit is hit, "since it is a transient error" (RFC 9103, sections 5.2, 6.3.2 and 6.3.3).
Message 5: UPDATE, the change itself
When the change comes from a program rather than an edited file (a Dynamic Host Configuration Protocol server registering a laptop, a certificate client publishing a challenge), it arrives as a DNS UPDATE, opcode 5, defined by RFC 2136 (April 1997). UPDATE renames the four sections and their counts: Zone (ZOCOUNT), Prerequisite (PRCOUNT), Update (UPCOUNT) and Additional Data (ADCOUNT), and "UPDATE uses only one flag bit (QR)" (RFC 2136, section 2.2). The request below adds www.example.com. 300 IN A 192.0.2.10 on one condition, that the name owns nothing yet. It is 65 octets:
0000 6e 03 28 00 00 01 00 01 00 01 00 00 07 65 78 61
0010 6d 70 6c 65 03 63 6f 6d 00 00 06 00 01 03 77 77
0020 77 c0 0c 00 ff 00 fe 00 00 00 00 00 00 03 77 77
0030 77 c0 0c 00 01 00 01 00 00 01 2c 00 04 c0 00 02
0040 0a
| Offset | Octets | Section and field | Meaning |
|---|---|---|---|
| 0x02 | 28 00 | Header flags | opcode 5, UPDATE |
| 0x04 | 00 01 00 01 00 01 00 00 | ZOCOUNT, PRCOUNT, UPCOUNT, ADCOUNT | 1, 1, 1, 0 |
| 0x0c | 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00 00 06 00 01 | Zone: ZNAME, ZTYPE, ZCLASS | example.com., SOA, IN: "the ZTYPE must be SOA" (section 2.3) |
| 0x1d | 03 77 77 77 c0 0c | Prerequisite: NAME | www.example.com. |
| 0x23 | 00 ff / 00 fe | TYPE / CLASS | ANY (255) / NONE (254) |
| 0x27 | 00 00 00 00 / 00 00 | TTL / RDLENGTH | 0 / 0 |
| 0x2d | 03 77 77 77 c0 0c | Update: NAME | www.example.com. |
| 0x33 | 00 01 / 00 01 | TYPE / CLASS | A / IN, the zone's class: an addition |
| 0x37 | 00 00 01 2c | TTL | 300 |
| 0x3b | 00 04 / c0 00 02 0a | RDLENGTH / RDATA | 4 / 192.0.2.10 |
UPDATE says everything with the CLASS and TYPE fields of ordinary records, which is why a hand-decoder needs the two tables of RFC 2136 open beside it (RFC 2136, sections 3.2.4 and 3.4.2.6):
| Section | CLASS | TYPE | RDATA | Meaning |
|---|---|---|---|---|
| Prerequisite | ANY | ANY | empty | Name is in use |
| Prerequisite | ANY | rrset | empty | RRset exists (value independent) |
| Prerequisite | NONE | ANY | empty | Name is not in use |
| Prerequisite | NONE | rrset | empty | RRset does not exist |
| Prerequisite | zone | rrset | rr | RRset exists (value dependent) |
| Update | ANY | ANY | empty | Delete all RRsets from a name |
| Update | ANY | rrset | empty | Delete an RRset |
| Update | NONE | rrset | rr | Delete an RR from an RRset |
| Update | zone | rrset | rr | Add to an RRset |
The prerequisite in the dump is the third row, "Name is not in use", which "IS satisfied by empty nonterminals" (section 2.4). If www already existed, the server would refuse with YXDOMAIN, "Some name that ought not to exist, does exist", RCODE 6 (section 2.2). The response copies the ID and opcode and may drop the sections, "placing zeros (0) in the these "count" fields" (section 3.8), so the two possible answers are twelve octets each: 6e 03 a8 00 followed by eight zeros for NOERROR, and 6e 03 a8 06 followed by eight zeros for YXDOMAIN.
The server's duties close the loop with the first four messages. It must apply an update atomically, so that "a QUERY should not be able to retrieve RRsets which have been partially modified by a concurrent UPDATE" (section 3.7), and "commit the change to nonvolatile storage before sending a response" (section 3.5). The serial must move with the content: if the update did not change it, the server "shall increment it automatically before the SOA or any changed name or RR or RRset is included in any response or transfer", and a replacement SOA with a lower serial "will be silently ignored" (RFC 2136, section 3.6). The serial moves, the primary sends message 1, the secondary sends message 2, and message 4 carries exactly the two records of this UPDATE.
The command that builds the same request with BIND's nsupdate reads, in the man page's own examples, prereq nxdomain nickname.example.com followed by update add … and send; for this zone:
nsupdate -k /etc/bind/update-key.conf
> server 192.0.2.53
> prereq nxdomain www.example.com
> update add www.example.com 300 A 192.0.2.10
> send
nsupdate "does not support zone-relative names": "a name without a trailing dot is interpreted relative to the DNS root" (BIND 9 manual pages, nsupdate), so every name is written in full. RFC 2136 itself was blunt about its own risk: without signed requests "anyone who can reach an authoritative name server" could "alter the contents of any zones on that server", and it "very strongly" recommended never deploying it without "equivalently strong security measures" (RFC 2136, section 8.1). RFC 3007 (November 2000) followed with secure dynamic update, where "Secure communication based on authenticated requests and transactions is used to provide authorization" (RFC 3007, Abstract). In practice that authentication is TSIG.
Message 6: TSIG, signing the AXFR request
RFC 8945 (November 2020) is the current TSIG specification, an Internet Standard (STD 93) that obsoleted RFC 2845 and RFC 4635 (RFC Editor, RFC 8945 metadata). It adds one record to the additional section, a "meta-RR" of type 250 that "MUST NOT be cached" and "is discarded once it has been used" (RFC 8945, section 4.1). Here it signs the AXFR query of message 3 with a key named xfr-key.example. and the algorithm hmac-sha256. The secret is 32 octets, the (Secure Hash Algorithm, 256 bits) digest of the text "ronutz.com worked example key: never use", which in is xtDZlsMBh3K+bdb4I5aqSDA6JbFMVL4dXgE0dT1YxNc=, so that anyone can rebuild it. Time Signed is 2026-11-23 21:00:00 Coordinated Universal Time (), 18:00 in São Paulo. The signed query is 117 octets behind the prefix 00 75:
0000 00 75 2f 3e 00 00 00 01 00 00 00 00 00 01 07 65
0010 78 61 6d 70 6c 65 03 63 6f 6d 00 00 fc 00 01 07
0020 78 66 72 2d 6b 65 79 07 65 78 61 6d 70 6c 65 00
0030 00 fa 00 ff 00 00 00 00 00 3d 0b 68 6d 61 63 2d
0040 73 68 61 32 35 36 00 00 00 6b 04 a9 50 01 2c 00
0050 20 33 63 3d 1c 6d b7 9b 5a af e5 4e d9 d1 43 f4
0060 c5 de 68 35 cb 73 ee f1 36 64 51 80 8c 6f 0a 3b
0070 af 2f 3e 00 00 00 00
The header differs from message 3 in one place, ARCOUNT at dump offset 0x0c, now 00 01. The TSIG record starts at 0x1f:
| Dump offset | Octets | Field (RFC 8945, section 4.2) | Value |
|---|---|---|---|
| 0x1f | 07 78 66 72 2d 6b 65 79 07 65 78 61 6d 70 6c 65 00 | NAME | xfr-key.example., the key's name |
| 0x30 | 00 fa | TYPE | 250, TSIG |
| 0x32 | 00 ff | CLASS | "This MUST be ANY" (255) |
| 0x34 | 00 00 00 00 | TTL | "This MUST be 0" |
| 0x38 | 00 3d | RDLENGTH | 61 |
| 0x3a | 0b 68 6d 61 63 2d 73 68 61 32 35 36 00 | Algorithm Name | hmac-sha256., which "MUST NOT be compressed" |
| 0x47 | 00 00 6b 04 a9 50 | Time Signed | 1,795,467,600 seconds since 1970, an "unsigned 48-bit integer" |
| 0x4d | 01 2c | Fudge | 300 seconds |
| 0x4f | 00 20 | MAC Size | 32 |
| 0x51 | 33 63 3d 1c … 6f 0a 3b af | MAC | 32 octets |
| 0x71 | 2f 3e | Original ID | the message ID |
| 0x73 | 00 00 | Error | "In requests, this MUST be zero" |
| 0x75 | 00 00 | Other Len | 0 |
The MAC is an (hash-based message authentication code) over a byte string the RFC defines field by field. For a request it is the DNS message "before the TSIG RR has been added to the additional section and before the DNS Message Header's ARCOUNT has been incremented", followed by the "TSIG Variables" (RFC 8945, sections 4.3.2, 4.3.3 and 5.1). Here that is the 29 octets of message 3 (ARCOUNT still 0, no length prefix, which belongs to TCP and not to the message) and these 48 octets:
0000 07 78 66 72 2d 6b 65 79 07 65 78 61 6d 70 6c 65 key name, canonical (lower case)
0010 00 00 ff 00 00 00 00 0b 68 6d 61 63 2d 73 68 61 ... CLASS ANY, TTL 0, algorithm name
0020 32 35 36 00 00 00 6b 04 a9 50 01 2c 00 00 00 00 ... Time Signed, Fudge, Error, Other Len
Two fields of the record are absent from the input on purpose: "The RR RDLENGTH and RDATA MAC Size are not included in the input to MAC computation, since they are not guaranteed to be knowable before the MAC is generated", and the Original ID is not there either because "it has already been substituted for the message ID in the DNS header and hashed" (section 4.3.3). HMAC-SHA256 of the 77 octets with the example secret gives 33 63 3d 1c 6d b7 9b 5a af e5 4e d9 d1 43 f4 c5 de 68 35 cb 73 ee f1 36 64 51 80 8c 6f 0a 3b af, the MAC in the dump. The server repeats the arithmetic in reverse: it removes the TSIG record, decrements ARCOUNT, puts the Original ID back in the header "if those IDs differ" (section 4.3.2), and compares. This is the same construction the HMAC verification article works through for web tokens, with the DNS deciding what is fed to it.
The order of the server's checks is now part of the standard: "1. Check key 2. Check MAC 3. Check time values 4. Check truncation policy" (RFC 8945, section 5.2). Each failure has its code, carried in the Error field of an answer whose RCODE is 9, NOTAUTH:
| Check | TSIG Error | Answer signed? (RFC 8945, sections 5.2 and 5.3.2) |
|---|---|---|
| Unknown key or algorithm | 17, BADKEY | No: "This response MUST be unsigned" |
| MAC does not verify | 16, BADSIG | No |
| Server time outside Time Signed ± Fudge | 18, BADTIME | Yes, with the server's time in Other Data and Other Len 6 |
| MAC shorter than local policy allows | 22, BADTRUNC | Yes |
The order is the lesson of 2017. RFC 2845 "required that the time values be checked before the request's MAC. If the time was invalid, some implementations failed to carry out further checks and could use an invalid request MAC in the signed reply"; RFC 8945 makes the request MAC "invalid until it has been validated" and checks it first, while "TSIG on the wire is still the same mechanism described in [RFC2845]; only the checking semantics have been changed" (RFC 8945, sections 1.3 and 10.1). The flaws it cites were real. In the Internet Systems Consortium (ISC) advisories of 29 June 2017, Common Vulnerabilities and Exposures () entry CVE-2017-3142 let an attacker "who has knowledge of a valid TSIG key name" get around TSIG on AXFR requests, so that a server relying on keys alone "could be manipulated into" accepting bogus NOTIFY packets or handing over the zone (severity Medium, Common Vulnerability Scoring System () 5.3, reported by Clément Berthaux of Synacktiv), and CVE-2017-3143 let the same attacker get "an unauthorized dynamic update" accepted (severity High, CVSS 7.5); both affected BIND from 9.4.0 to 9.11.1- across four open-source branches, and two subscription branches (ISC, CVE-2017-3142; ISC, CVE-2017-3143). ISC's mitigation is the one this article ends on: access control lists "that require both address range validation and use of TSIG authentication".
The answer is signed too, and the chain is what makes a signed transfer trustworthy. The first response's MAC covers the request's MAC (its size and octets, "exactly as transmitted"), the response and its TSIG variables; for a transfer of many messages, each later MAC covers "Prior MAC (running)", the messages since the last TSIG, and only the "TSIG Timers" of the current one. "The TSIG MUST be included on all DNS messages in the response", but a client "MUST accept up to 99 intermediary messages without a TSIG and MUST verify that both the first and last message contain a TSIG", and it "MUST close the connection" on any failure (RFC 8945, sections 4.3.1 and 5.3.1). The protocol overview names the limit honestly: the chain detects "any interruption in the packet sequence, although not its premature termination" (section 1.2), which is why the closing SOA of message 3 still matters.
Three numbers complete the record. The MAC may be truncated by agreement, but never below "the larger of 10 (octets) and half the length of the hash function in use" (section 5.2.2.1). The algorithm table makes hmac-sha256 "MUST" to implement and "RECOMMENDED" to use, keeps hmac-sha1 at "NOT RECOMMENDED" and HMAC- at "MUST NOT" (section 6). And "The RECOMMENDED value in most situations is 300 seconds" for Fudge, which means two servers whose clocks drift apart by more than five minutes stop transferring (section 10). What TSIG does not do is just as precise: it "does not authenticate source data, only its transmission between two parties who share some secret" (section 10), and it gives no confidentiality, which is the job of XoT; RFC 9103's table credits TSIG with data origin authentication and mutual TLS with authenticating both ends, and concludes that "Using just mutual TLS can be considered a standalone solution" (RFC 9103, section 10).
Doing it yourself, with the tools' own syntax
Every message above can be sent from a shell. BIND's dig asks for a transfer with the type AXFR, and "When an incremental zone transfer (IXFR) is required, set the type to ixfr=N", where N is the client's serial, and it notes that "AXFR queries always use TCP" (BIND 9 manual pages, dig). It signs with -k keyfile or -y [hmac:]keyname:secret, and the nsupdate page warns that a secret given with -y "may be visible in the output from ps1 or in a history file maintained by the user's shell". Against the example primary:
dig @192.0.2.53 example.com SOA +norecurse
dig @192.0.2.53 example.com AXFR
dig @192.0.2.53 example.com IXFR=2026112301
dig @192.0.2.53 example.com AXFR -k /etc/bind/xfr-key.conf
The other clients spell the same requests differently. BIND's host lists a zone with -l, which "performs a zone transfer of zone name", and uses TCP automatically "for queries that require it, such as zone transfer (AXFR) requests" (same manual). Knot DNS's kdig, version 3.6.2 as documented, accepts IXFR=serial as a query type and offers +msgdelay=T to "Wait the specified number of milliseconds before receiving each AXFR/IXFR message" (Knot DNS, kdig). Windows nslookup keeps the old ls command, whose -d "Lists all records for the DNS domain" by transfer (Microsoft, nslookup ls), while BIND's nslookup answers that "This command is not implemented" (BIND 9 manual pages, nslookup). The dig command builder writes the dig forms, and the dig output explainer reads what comes back.
A capture shows the same bytes. A healthy cycle reads: a UDP NOTIFY with flags 24 00 and its a4 00 reply, a UDP SOA query from the secondary, then a TCP connection to port 53 carrying a query whose counts are 1, 0, 1, 0 (IXFR) or 1, 0, 0, 0 with type 00 fc (AXFR), answered by messages that open and close with the same SOA. A broken one is just as recognizable: a NOTIFY repeated every 60 seconds with no reply (a filtered or silent secondary), an IXFR answered by a full zone every time (a primary that keeps no history), or a transfer answered with RCODE 5, REFUSED, or 9 with a TSIG Error (a key or clock problem, readable from the table above).
The Brazilian angle
In Brazil the "at least two servers" of RFC 1034 is also a registration rule. Resolution /RES/2008/008 of the Brazilian Internet Steering Committee (CGI.br), of 28 November 2008, requires whoever registers a .br domain to "provide, within a maximum of 14 (fourteen) days from the date and time the domain registration ticket is issued, at least 2 (two) DNS servers configured and answering for the domain being registered", and makes the holder responsible for "keeping the DNS servers working correctly" (CGI.br, Resolução CGI.br/RES/2008/008/P, art. 4, II, and art. 5, V). Two servers that answer the same means a transfer between them, or two copies kept in step by some other method.
The registry's own engineers have taught the network side for years. A 2007 Registro.br presentation on firewalls and DNS, by Hugo Koji Kobayashi, lists zone transfers (AXFR) first among the cases in which DNS uses TCP, and asks that authoritative servers accept queries "to port 53 UDP and TCP" with their replies (Registro.br, Firewalls e DNS, 30 June 2007): the firewall that passes UDP 53 alone lets NOTIFY and the SOA check through and silently breaks every transfer that follows. A Semana de Capacitação handout published by (undated; its output shows DiG 9.18.33 on Debian 12) builds the whole of this article with NSD: a TSIG key with the algorithm sha256 shared by both servers, notify and provide-xfr naming the secondary and the key on the primary, allow-notify and request-xfr: AXFR naming the primary and the key on the secondary, and nsd-control force_transfer to pull the zone at once (NIC.br, DNS Autoritativo). The handout prints the key it generates. Any secret printed in a document, the one in message 6 included, is an example and must never protect a real zone.
What defenders can do
- Refuse transfers to strangers. RFC 5936 asks implementations not to make "open to all" the default (section 5). The United States Computer Emergency Readiness Team (US-CERT), now part of the Cybersecurity and Infrastructure Security Agency (CISA), issued alert TA15-103A on 13 April 2015 because scans still found many servers answering transfer requests from anyone, which reveals "internal network structure and potentially sensitive information"; its fix is to respond "only to zone transfer (AXFR) requests from known IP addresses" (CISA, TA15-103A). The alert expands AXFR as "Asynchronous Transfer Full Range"; the DNS terminology RFC calls it "Authoritative Transfer" (RFC 9499, section 6).
- Require the key and the address together. A key name is not a secret, as 2017 showed; ISC's mitigation for both CVEs was an access control list () that checks both.
- Treat NOTIFY as a hint from a known primary. Ignore it from anyone else (RFC 1996, section 3.10) and sign it. ISC notes that a bogus NOTIFY "cannot be used to force a zone transfer from a malicious server, but could trigger a high rate of zone refresh cycles" (ISC, CVE-2017-3142).
- One key per pair, hmac-sha256, synchronized clocks. Secrets "SHOULD NOT be shared by more than two entities", one algorithm per key name, and a 300-second Fudge that only works with the Network Time Protocol () running on both ends (RFC 8945, section 10).
- Authenticate every UPDATE. RFC 2136's own warning stands; give each client a key whose update policy covers only its names.
- Encrypt transfers that cross networks you do not control. XoT with mutual TLS, port 853, TLS 1.3 at least (RFC 9103, sections 7 and 10).
- Log and limit. Record refused transfers and failed TSIG checks, and cap concurrent transfers per client, answering SERVFAIL at the cap (RFC 9103, section 6.3.3).
What to remember
- Every message shares the 12-octet header; over TCP each one is preceded by a two-octet length, and a pointer
c0 0cis the zone name at offset 12. - NOTIFY is opcode 4 with AA (
24 00), answered by the same octets with QR set (a4 00); it only says "check the SOA now". - AXFR is QTYPE 252 over TCP; its answer opens and closes with the same SOA, every message copies the ID, and order between the SOAs is free.
- IXFR is QTYPE 251 with the client's SOA in the authority section; an answer whose second record is an SOA is incremental.
- UPDATE is opcode 5; CLASS ANY and NONE turn ordinary records into conditions and deletions, and the serial must move with every change.
- TSIG is the last additional record, type 250, class ANY, TTL 0; its MAC covers the unsigned message plus the TSIG variables, the server checks key, then MAC, then time, and every signed transfer must be signed at least on its first and last messages and once in every hundred.
Sources
- P. Mockapetris, RFC 1035, Domain names: implementation and specification, IETF, November 1987, text copy: sections 4.1.1, 4.1.4 and 4.2.2, the header, compression and the TCP length prefix (accessed 23 November 2026)
- M. Ohta, RFC 1995, Incremental Zone Transfer in DNS, IETF, August 1996, text copy: sections 2 to 7, the IXFR query, its three answer shapes, purging and condensation (accessed 23 November 2026)
- P. Vixie, RFC 1996, A Mechanism for Prompt Notification of Zone Changes (DNS NOTIFY), IETF, August 1996, text copy: sections 3 and 4, transport, retries, the answer-section hint and the request and response fields (accessed 23 November 2026)
- P. Vixie, S. Thomson, Y. Rekhter and J. Bound, RFC 2136, Dynamic Updates in the Domain Name System (DNS UPDATE), IETF, April 1997, text copy: sections 2, 3.2.4, 3.4.2, 3.5 to 3.8 and 8, the message format, meta-values, atomicity, serial and security (accessed 23 November 2026)
- D. Eastlake and A. Panitz, RFC 2606, Reserved Top Level DNS Names, IETF, June 1999, text copy: section 3, the example second-level names (accessed 23 November 2026)
- B. Wellington, RFC 3007, Secure Domain Name System (DNS) Dynamic Update, IETF, November 2000, text copy: Abstract (accessed 23 November 2026)
- J. Arkko, M. Cotton and L. Vegoda, RFC 5737, IPv4 Address Blocks Reserved for Documentation, IETF, January 2010, text copy: section 3 (accessed 23 November 2026)
- E. Lewis and A. Hoenes (ed.), RFC 5936, DNS Zone Transfer Protocol (AXFR), IETF, June 2010, text copy: sections 2, 2.1, 2.2, 3.4, 4.1, 5 and 6, header values, response structure, compression, connections, authorization and integrity (accessed 23 November 2026)
- F. Dupont, S. Morris, P. Vixie, D. Eastlake 3rd, O. Gudmundsson and B. Wellington, RFC 8945, Secret Key Transaction Authentication for DNS (TSIG), IETF, November 2020, STD 93, text copy: sections 1.2, 1.3, 3, 4, 5, 6 and 10, the record, the MAC input, the checks, multi-message signing and algorithms (accessed 23 November 2026)
- RFC Editor, RFC 8945 metadata, JSON record: status Internet Standard, obsoletes RFC 2845 and RFC 4635 (accessed 23 November 2026)
- W. Toorop, S. Dickinson, S. Sahib, P. Aras and A. Mankin, RFC 9103, DNS Zone Transfer over TLS, IETF, August 2021, text copy: sections 5.2, 5.3.1, 6.3, 7.9 to 7.11 and 10, connection reuse, limits, padding, compression reach and authentication properties (accessed 23 November 2026)
- C. Huitema, S. Dickinson and A. Mankin, RFC 9250, DNS over Dedicated QUIC Connections, IETF, May 2022, text copy: sections 4.3 and 4.5, per-stream transfers and 0-RTT opcodes (accessed 23 November 2026)
- P. Hoffman and K. Fujiwara, RFC 9499, DNS Terminology, IETF, March 2024, BCP 219, text copy: section 6, zone transfer, AXFR and IXFR (accessed 23 November 2026)
- IANA, Domain Name System (DNS) Parameters, registry page last updated 2026-11-18: DNS OpCodes (accessed 23 November 2026)
- Internet Systems Consortium, CVE-2017-3142: An error in TSIG authentication can permit unauthorized zone transfers, knowledge base, posted 29 June 2017: description, impact, CVSS, versions and mitigation (accessed 23 November 2026)
- Internet Systems Consortium, CVE-2017-3143: An error in TSIG authentication can permit unauthorized dynamic updates, knowledge base, posted 29 June 2017: description, impact, CVSS and mitigation (accessed 23 November 2026)
- US-CERT (CISA), Alert TA15-103A, DNS Zone Transfer AXFR Requests May Leak Domain Information, 13 April 2015: overview, impact and solution (accessed 23 November 2026)
- Internet Systems Consortium, BIND 9 manual pages, 9.21.29-dev documentation: dig, host, nslookup and nsupdate (vendor documentation, accessed 23 November 2026)
- CZ.NIC, kdig: Advanced DNS lookup utility, Knot DNS 3.6.2 documentation: IXFR=serial and +msgdelay (vendor documentation, accessed 23 November 2026)
- Microsoft, nslookup ls, Windows Server documentation: the -d option and its output (vendor documentation, accessed 23 November 2026)
- Comitê Gestor da Internet no Brasil, Resolução CGI.br/RES/2008/008/P, 28 November 2008, PDF: article 4, II, and article 5, V, two DNS servers within 14 days (accessed 23 November 2026)
- Hugo Koji Kobayashi, Firewalls e DNS: como e por que configurar corretamente, Registro.br, 30 June 2007, PDF slides: when DNS uses TCP and what an authoritative server's firewall must allow (accessed 23 November 2026)
- NIC.br, DNS Autoritativo, Semana de Capacitação handout, undated PDF: NSD primary and secondary with a TSIG key, notify, provide-xfr, allow-notify and request-xfr (accessed 23 November 2026)