Promoting a Secondary Server to Primary
  • 04 May 2021
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Promoting a Secondary Server to Primary

  • Dark
    Light
  • PDF

Article Summary

How do I promote a secondary server to primary if the current primary is offline too long?

  1. Make sure the expiry timer is sufficiently high, somewhere between multiple days and a month.
  2. For the zone definitions in /etc/named.conf (or equivalent):
    (a) Change the type statements from secondary to primary and remove the masters statement.
    (b) Add allow-update and allow-transfer statements as appropriate.
    (c) Possibly add also-notify statements as appropriate.
  3. Add key definitions if needed.
  4. If masterfile-format text; wasn't used in named.conf.local, convert the zone files to text using named-compilezone including the -j parameter.
  5. If the server's name is different than the former primary, then the SOA record for each (to-be) primary zone must be updated. Since rndc freeze/thaw doesn't work on secondary zones, the server probably needs to be shut down.
  6. Change the MNAME in the SOA record to the new server name.

Alternatively, you could try this method:

  1. Create an intermediary file that is a list of the zones needed to be able to quickly switch between primary and secondary.
  2. 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.
  3. 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. )