Skip to main content Skip to search
Kris Beevers
Posted by
Kris Beevers on
March 2, 2014

Simple manual failover with NS1

One of the most common DNS configurations you might want to implement is active-passive failover. In an active-passive setup, you want to send traffic to one server or datacenter most of the time; but if it’s having problems or you need to perform maintenance, you want to instead send traffic to a secondary or disaster recovery (DR) server or datacenter.

This is easy to achieve with NS1. Here, we’ll discuss a manual failover configuration in which you need to tell NS1 when you want to shift traffic to your secondary server. You can also easily achieve an automatic failover with NS1 in which the platform shifts traffic automatically when a failure is detected.

The obvious, super-simple approach to pull off a manual failover is to just create a plain old DNS record, and edit it when you need to shift traffic elsewhere. But that’s no fun, and it can pay to do a little more work up front so failover is as painless as possible when the time comes.

The rough approach to achieve a failover config in NS1 is to create your record; configure a Filter Chain that sends traffic to your primary server most of the time, and your secondary server on a failover condition; and tell NS1 a little bit about each of your servers so we know which is primary, which is secondary, and whether you’re in a failover state.

The Filter Chain for a failover setup is simple, but it does quite a bit. Filters are executed in order, and each of them examines the list of DNS answers NS1 could return and adjusts the list.

First, the “UP” filter scans the list of answers and removes any that are marked down. Failing your primary server, then, is as easy as marking it down — after that we won’t send traffic to it.

Second, the “PRIORITY” filter sorts any remaining answers by their priority value — first priority, second priority, and so on. In a basic failover setup with two answers, you’d set your primary server to first priority, and your secondary server to second priority. If your primary server is down, the PRIORITY filter doesn’t do much — it only really has an effect when both servers are up.

Lastly, the “SELECT_FIRST_N” filter (with N set to 1) picks the first remaining answer. So if both servers are up, the highest priority server (your primary) is returned; if the primary is down, this again doesn’t do much: it just returns the remaining, secondary, server.

To make the Filter Chain work, you need to set priority and up/down state for your answers. We talk more about how to do that in this detailed Knowledge Base article about configuring manual failover with NS1.

When you need to fail your primary server and send traffic to your secondary, all you need to do is visit the record’s page in my.nsone.net and mark the primary as “down”. Voila.

You can extend this approach in all kinds of ways. Got a tertiary server? Set it to a lower priority and this same approach works if both your primary and secondary need to be failed. Want to automate failover? Easy peasy with Data Feeds and any of the monitoring services we support — including our powerful built in NS1 Monitoring.

Any problems getting things configured? Curious about what else you can pull off with NS1’s powerful Filter Chain? Send us an email or give us a call at 1-855-GET-NSONE any time, we’ll be happy to help!