This article describes an automatic failover configuration for an A record, in which NS1 is configured to automatically shift traffic to a secondary IP (which normally receives no traffic) upon detecting a failure of your primary IP. For a guide to configuring simple manual failover, read this Knowledge Base article.
Please note that the same guide can be used for CNAME and other record types compatible with a failover configuration.
Configure an Monitor
If you’re using NS1's built-in monitoring, simply follow one of the guides for creating Ping or TCP monitors
Alternatively, NS1 has pre-configured integrations with the following 3rd-party monitoring services:
- Amazon CloudWatch
- Rackspace Cloud Monitoring
- New Relic
For this example we'll use NS1's Monitors.
Create an A record
- Click on the Zones tab and select the Zone you will be working under.
- Click on the Add Record button.
- Enter the domain (e.g. abc.example.web)
- Select the record type as A
- Enter your desired TTL.
- Set the Answers for this record
- Click on the Save Changes button
Preparing the record for failover
- Once you've created the A record in the portal, select the record to enter it's configuration page and hit create filter chain.
- Click the Plus button next to the Up filter followed by priority then Select First N. Filters can also be dragged and dropped into place. Save Filter Chain.
The applied filter chain will sort the answers by priority (after executing "UP" to remove any answers that are down). The Select First N filter, which will be set to N=1 by default tells the system that after sorting by priority, return ONLY the answer with the highest priority associated.
Configure Metadata for Failover
Now that we have added both servers’ IP’s into the A record config and configured the Filter Chain, we need to set up/down state and a priority value for both servers:
- Click each Filter button at the left to reveal the metadata associated with your Filter Chain.
- Click the "up" meta data for your answer and the metadata modal will appear. Select the black icon under feed to reveal your feeds/monitors available. Select your monitor and hit save.
- Click the "priority" filter and set the priority of the primary IP (188.8.131.52) to 1 (note: lower numerical value indicates higher prioritization).
- Under the secondary IP's metadata section, connect your secondary monitor or data feed.
- Select the "priority" for the secondary IP (184.108.40.206) and set it equal to 2.
- Click the Save button.
- Your record configuration should now look like this:
You're done! At this point, if the monitor on your primary server trips, the corresponding answer will be updated to up status of "false" in the NS1 platform immediately.
If you have other DNS records serviced by the same servers, you can reuse the same Data Feeds in those records too. Updates to a Data Feed will automatically be pushed to every connected answer throughout our system.