How to reset or lower the serial used in BIND DNS server’s SOA record

bindconfigurationdns

I use BIND as my DNS server at home. For my Start Of Authority (SOA record) I always use a serial in the recommended format

YYYYMMDD##

where ## is the counter for changes on that day.

Unfortunately I changed the serial and added 1 more digit by mistake.
After updating the name-daemon, I couldn't revert this anymore.

Is there a possible way to reset the serial / counter inside BIND's internal libraries?

Best Answer

"BIND's internal libraries" don't care what the serial number is. It's only agreement between the master server and slave servers that matters. In other words, BIND will happily let you decrease the serial number in a zone file without complaint.. It's just that the slaves would no longer receive updates.

Zone file serial numbers are unsigned 32-bit integers and they wrap around the largest possible 32-bit unsigned integer. So there is a way to decrease the serial number by incrementing it repeatedly until it rolls over and becomes closer to zero. There is a maximum amount by which you can increment it at a time, so you have to do this iteratively in multiple steps:

  • Increase the serial number by a large increment but no more than 2147483647
  • Wait for all of the slave servers to catch up and be up to date with the current SOA.
  • Repeat

You can always pick an increment such that you don't need to iterate more than twice.

Follow this HOWTO.

Related Question