Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

Nameservers give different answers: compare SOA serials with dig

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

When ns1 and ns2 return different data for the same name, the copies of the zone have diverged. Ask each server itself, with dig @server, and compare the SOA SERIAL. RFC 1035 describes SERIAL as the "unsigned 32 bit version number of the original copy of the zone". RFC 1034 says secondaries detect change by that field, and "the SERIAL field in the SOA of the zone is always advanced whenever any change is made to the zone".

Fix the copy on the primary, then let the other servers transfer. RFC 1034 says serial comparisons use sequence space arithmetic, not plain integer order.

What the symptom means

RFC 1034 section 4.2.1 says the top of a zone carries name-server records and a single SOA record. Section 4.3.5 describes one primary where changes are made, and secondary servers that poll it. The poll "is a simple query to the primary for the SOA RR of the zone". If the secondary's serial equals the primary's, "no changes have occurred". If the poll shows the zone has changed, the secondary requests a zone transfer (AXFR).

RFC 1035 section 3.3.13 orders the SOA numbers as SERIAL, REFRESH, RETRY, EXPIRE, then MINIMUM, after the two names MNAME and RNAME. MNAME is "the name server that was the original or primary source of data for this zone". REFRESH, RETRY and EXPIRE are times in seconds. If the serials match but an address or MX record does not, the copy changed without the serial advance RFC 1034 requires.

Likely causes

Cause What you see How to confirm
A secondary has not transferred since the last change Same name, different answers; SOA SERIAL values differ dig @ each server for SOA
The zone was edited on a server that is not the primary The server you edited is ahead, or MNAME names a different host Compare MNAME with the host you edited
Records changed but SERIAL was left as it was Answers differ and both SOA records show the same SERIAL Compare the record you care about, not only the serial
Your resolver receives answers from different servers on different lookups The answer flips from one lookup to the next Ask each server directly, not only the resolver in /etc/resolv.conf

Prove the cause before changing anything

All of these are read-only. The form is dig @server name type. @server "is the name or IP address of the name server to query". +multiline "prints [or does not print] records, like the SOA records, in a verbose multi-line format with human-readable comments".

1. Ask every authoritative server for its SOA.

dig +nssearch example.com

The manual says +nssearch "attempts to find the authoritative name servers for the zone containing the name being looked up, and display the SOA record that each name server has for the zone". Servers that did not respond are listed as well. Recursion is turned off for this option.

2. Ask two servers yourself, and save both replies.

dig @ns1.example.net example.com SOA +multiline > /root/soa-ns1-example.com-2026-11-22.txt
dig @ns2.example.net example.com SOA +multiline > /root/soa-ns2-example.com-2026-11-22.txt
dig @ns1.example.net example.com A > /root/a-ns1-example.com-2026-11-22.txt
dig @ns2.example.net example.com A > /root/a-ns2-example.com-2026-11-22.txt

Repeat the last pair for MX or NS if that is the record which disagrees. If you edit the zone in a console rather than a file, copy that record list into a dated note as well.

3. Read SERIAL. It is the first number after MNAME and RNAME. If the numbers differ, the servers are not serving one version. If they match and the A or MX data does not, the serial was not advanced with the edit.

Fix

Keep the saved replies. The server you change is the primary: the one you intend as the source of the zone, which should be the MNAME host unless you have deliberately moved that role.

First save the whole zone as the primary holds it now, because the SOA and A replies above do not contain the other records. If the primary refuses transfers, copy its zone file to the same saved name instead, for example cp -p <zone-file> /root/zone-ns1-example.com-2026-11-22.txt on the primary.

dig @ns1.example.net example.com AXFR > /root/zone-ns1-example.com-2026-11-22.txt

Risk: Loading a zone on the primary publishes that copy to every secondary which transfers afterwards. Loading the older records, or records from the server that fell behind, replaces the data you meant to keep.

On the primary, set the records to the copy you intend to publish. Advance SERIAL as RFC 1034 requires whenever the zone changes. Then signal that server to load the zone. RFC 1034 describes the signal and does not name a particular reload command, so use the reload your DNS host documents. Secondaries compare serials on their next poll and request AXFR when the serial shows a change. The wait is governed by REFRESH, in seconds, from the SOA they currently hold.

To undo it: put the records from the saved zone file back on the primary, advance SERIAL again, and signal the primary to load the zone. Do not set SERIAL back to the old number. RFC 1034 says an equal serial means no change, and comparisons use sequence space arithmetic, so a lower number is not a safe way to make secondaries fetch the restored copy.

Confirm the fix

  1. Run dig +nssearch example.com again. Every server that responds should show the new SERIAL.
  2. Run dig @ against each server for the name and type that disagreed. The answers should match.
  3. Ask the resolver as well, with dig example.com A and no @server. The manual says that form uses /etc/resolv.conf. A resolver can still hold an older answer until the TTL on that answer expires.

What to watch afterwards

  • Advance SERIAL on every change, then query each authoritative server, not only the resolver.
  • If a server stops answering, serial comparison cannot run. That case is "Authoritative DNS when the primary is gone: serial, expiry, and who is still allowed to answer".

Risks and limits

  • RFC 1034 describes signalling the primary to load the zone and does not name the reload command.
  • Sequence-space comparison is not ordinary integer order. RFC 1034 says the compare operation must deal properly with comparisons around the boundary between the most positive and most negative 32 bit numbers.

Sources