Moving to a better DNS serial numbering scheme

binddomain-name-system

I have recently 'inherited' a tiny bind9 DNS server (64MB RAM running bind9+ssh only) where the zones were crafted using a GUI application then scp'd into the server as root. I didn't really mind that part, but turns out the GUI application made inconsistent serial numbers every edit, resulting in serials such as 1245486432 instead of the 'common' (?) YYYYMMDDSS.

Is there a 'safe' way to increase/decrease the serial number without causing any sort of inconsistencies between DNS servers and caches?

Best Answer

The serial is used by slaves to determine whether the zonefile they have is the same revision that the master holds. When the master's serial is incremented, they know that they have to AXFR a new copy. The only harm will come from decrementing because the slaves will think they have a later revision than the master is holding.

There are two solutions to this. The simplest is to decrement your master, remove copies from the slaves and then have them reload. However this won't work if you're not in full control of the slaves. In which case a solution is provided in the Reference Manual.

Add 2147483647 (2^31-1) to the number, reload the zone and make sure all slaves have updated to the new zone serial number, then reset the number to what you want it to be, and reload the zone again.

Just of note, it's best to use the last two digits of the serial to store a revision, rather than seconds. ie YYYYMMDDRR. This allows to you make multiple updates within the same day.