How do I promote a secondary server to primary if the current primary is offline too long?
- Make sure the expiry timer is sufficiently high, somewhere between multiple days and a month.
- For the zone definitions in
/etc/named.conf
(or equivalent):
(a) Change thetype
statements fromsecondary
toprimary
and remove themasters
statement.
(b) Addallow-update
andallow-transfer
statements as appropriate.
(c) Possibly addalso-notify
statements as appropriate. - Add key definitions if needed.
- If
masterfile-format text;
wasn't used innamed.conf.local
, convert the zone files to text usingnamed-compilezone
including the-j
parameter. - If the server's name is different than the former primary, then the
SOA
record for each (to-be) primary zone must be updated. Sincerndc
freeze/thaw doesn't work on secondary zones, the server probably needs to be shut down. - Change the
MNAME
in theSOA
record to the new server name.
Alternatively, you could try this method:
- Create an intermediary file that is a list of the zones needed to be able to quickly switch between primary and secondary.
- Use that file as data for a script (really different m4 macros) to create the proper configurations (at the same time) for both primary and secondary operating modes.
Each configuration is (effectively) stored in its own file:/etc/named/zones.master.conf
and/etc/named/zones.slave.conf
. - Dynamically update a sym-link to point to the operating mode of the server.
Primary:
/etc/named/zones.conf -> /etc/named/zones.master.conf
Secondary:
/etc/named/zones.conf -> /etc/named/zones.slave.conf
The main named.conf
file will then simply include the /etc/named/zones.conf
file.
(This article is based on an August, 2018 post on bind-users@lists.isc.org, by Leroy Tennison, with some edits by ISC. )