Manual Failover

This article describes a manual failover configuration for an A record, in which you need to tell NS1 when to shift traffic to a secondary IP; normally traffic will flow to a primary IP. It is easy to achieve automatic failover with NS1 as well, and we've covered that in a separate article.

The simplest way to do manual failover is just to configure a single IP address in your A record, and then change it when you need to shift traffic. But we suggest doing a little more work up front to make failover simple and quick when you need it.

First, you'll need to create an A record -- you can start by just setting the answer to your primary IP, and setting the TTL to something low like 60 seconds. A much lower TTL will be ignored by some DNS recursors; and a much higher one will limit the effectiveness of your failover. Once you've created the A record in the portal, click "Add Filter Chain" to configure the filter chain for this record.

In this window, we'll first configure a Filter Chain that will tell NS1 how to decide which answer to return:

  1. Click "Create Filter Chain" and click the "+" on the Up filter; The Up filter prevents NS1 from returning any IPs that are marked "down".
  2. Now add the Priority filter, which tells the system to sort the answers by the priority metadata.
  3. Lastly, add the Select First N filter and click "Save Filter Chain". Select First N will be set to N=1 by default. This tells the system to return only a single answer.

Next we will add the IP address for the backup server. Click "Add Answer" and enter the IP of your backup server.

  1. If it's hidden, you can show metadata for your answers by clicking "Show Metadata" at the top right of the record under the TTL field.
  2. Click the primary IP's metadata icon and select "up" and set the pulldown to true. 
  3. Next select "priority" from the list at the left, and enter to 1. Click Save.
  4. Click the secondary IP's metadata icon, and add the up and priority metadata, but this time enter priority as 2. Click Save.

Your record configuration should now look like this:

At this time, your record will work and will return the primary IP. When you want to fail over to the secondary IP, you just need to go to the record's page in the portal, open the primary IP's metadata, and change the up metadata to "down" -- then click Save. Your changes are immediately published to the NS1 platform and we will immediately start returning the secondary IP. To later fail back, just change the up metadata of the primary IP back to "up" and hit Save.

It is also possible to enact failover and failback through the NS1 API if you want to make your own tool (like a command line script) to quickly trigger failover or failback. One of the easiest way to do this is to configure an NS1 API Data Feed for your primary IP, and publish "Up/down" state to the feed with your tools. Configuring this type of automatic failover setup is reviewed in this Knowledge Base article.

Request a Demo

Contact Us

Get Pricing