--- title: "Promoting a Secondary Server to Primary" slug: "promoting-a-secondary-server-to-primary" description: "If a primary server is offline for too long, it may be desirable to change a secondary server to a primary. Here's how." updated: 2021-05-04T21:04:48Z published: 2021-05-04T21:04:48Z canonical: "kb.isc.org/promoting-a-secondary-server-to-primary" stale: true --- > ## Documentation Index > Fetch the complete documentation index at: https://kb.isc.org/llms.txt > Use this file to discover all available pages before exploring further. # Promoting a Secondary Server to Primary #### 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. )