DNS failover helps to ensure high availability of your domains and network services in the event of an outage. While you can technically configure DNS failover by manually updating the status of an endpoint, this can be a daunting task for network operators with large, complex networks. Also, the manual method introduces a higher risk of clients being directed to "down" endpoints during the time it takes an operator to learn of a down endpoint and update the record configuration. Automating DNS failover streamlines this process and decreases the chances of someone being directed to an unavailable server. In an endpoint goes down, the NS1 platform will automatically redirect traffic to the next available endpoint.
Note
Refer to Configuring manual DNS failover to learn how to set up manual failover (as opposed to automatic), which can be used for CNAME records or other record types that are compatible with a failover configuration.
To configure automatic failover on the NS1 platform, you will create one or more native NS1 monitors or connect a third-party data sources that will continually probe the DNS endpoints to determine whether they is up or down. After creating a DNS record and its associated answers (as in, endpoints), you will connect the monitor or data source to the relevant answer by attaching it to the answer's "Up" metadata fields. This connection allows the monitor to automatically update the answer metadata to reflect the current status of the endpoint. Next, you will create a Filter Chain using the "Up, "Priority", and "Select First N" filters to define how the NS1 platform should direct queries against that record — in other words, it determines which answer(s) will be returned to the requesting client.
Once configured, the monitor or data source you assigned to each answer will keep it up to date. Upon each DNS query, the answers are filtered through the Filter Chain using the following logic:
-
First, all "down" answers (endpoints) are removed from the answer pool.
-
Then, the answers are arranged based on their assigned priority value.
-
Finally, all but the first "N" number of answers are removed from the list, and the remaining answer(s) are returned to the requester. By default, N is set to 1, meaning only the first answer (that is, available and highest priority) is returned to the requester.
Note
Depending on your resources and general configuration, you might consider going a step further and configuring automatic load shedding. In addition to basic failover, this configuration allows you to direct traffic away from overloaded or underperforming endpoints. The NS1 platform automatically slows or stops traffic to DNS endpoints as their load metric exceeds the specified low or high watermarks.
Refer to any of the following articles to learn how to create an NS1 monitor (i.e., probe):
Alternatively, you can configure a data source from NS1's API webhook or a third party monitoring service integration. Integration-specific guides can be found here.
Note
The example used in this article uses NS1's built-in monitors to configure automatic failover.
In this step, you will create a DNS record for the zone you just selected. You will add answers to this zone to represent endpoints to which traffic should be distributed. As you complete the remaining steps in this article, your goal will be to set up a Filter Chain to determine the optimal endpoint for each DNS query.
Note
Refer to Create a DNS record for detailed instructions and more information about every DNS record type supported by NS1.
To create a DNS record:
-
In the NS1 portal, click the DNS link in the navigation. By default, the Zones page opens, where you can view a list of zones associated with your account.
-
Click the zone's name from the list to drill down into zone details, including a list of records if any exist.
-
Click Add record or the + icon to open the Add Record modal.
-
Select a record type from the drop-down menu. Optionally, you can specify a name (or a subdomain for the zone), or leave it blank to create an apex-level record. You can also specify a TTL (time-to-live value) in seconds; the default TTL is 3600 seconds.
-
Add one or more answers to the record. The information required for an answer depends on the record type you chose in the previous step.
Note
For more information on the different types of records and their supported answers, refer to Create a DNS record.
-
Once complete, click Save record. The new record appears in the list.
The Filter Chain you are about to create processes answers by:
-
Removing any answers that are down (that is, up=false),
-
Rearranging answers based on their assigned priority value, then
-
Reducing the list to the first N number of answers in the answer pool.
To create a Filter Chain:
-
Click the name of the record you just created to drill down into record details, then click Create Filter Chain.
-
Add the Up filter, Priority filter, and the Select First N filter in that order. To add a filter, click the + icon to the left of the filter name. Then, click Save Filter Chain.
Next, you must adjust the answer metadata — connecting the monitor(s) or data source(s) you created in step 1 to their corresponding answers.
To route traffic appropriately for an automatic failover scenario, you must edit the metadata for each answer to connect a monitor or data source to determine whether it is up or down, as well as to assign a priority value for each answer that you want the Filter Chain to manage.
To add metadata to allow filters to direct traffic accordingly:
-
Back on the record details page, click the Up filter to see the corresponding metadata label appear beneath each answer. Then, click the label beneath the first answer to display the answer metadata modal.
-
Click the Feed icon and select the monitor or data feed to associate with this answer. Then, click OK. Repeat this step for all remaining answers.
Note
If you have other DNS records serviced by the same servers, you can reuse the same data feeds in those records. Updates to a data feed are pushed automatically to all associated answers.
-
On the record details page, click the Priority filter to reveal the priority metadata field beneath the first answer and assign a priority value. A lower number indicates a higher preference when making traffic routing decisions. Repeat this step for all remaining answers.
-
Click Save record.
This completes the configuration process. If you have any questions or need help troubleshooting this configuration, please contact NS1 customer support.