DNS failover refers to a traffic steering configuration in which the platform automatically diverts DNS traffic away from "down" or unavailable endpoints, opting for alternatives to ensure the high availability of your applications and services during an outage. This configuration is recommended if multiple endpoints are hosting the same application or providing the same service. Automating this process makes it easy to adapt quickly to changing network conditions—minimizing downtime and the effort required to maintain this configuration manually.
On the NS1 platform, key components of an automatic failover configuration include:
-
NS1 monitors or third-party data sources to track the availability of each endpoint represented in a DNS record.
-
Data feeds to update the up/down status of an answer automatically if the monitor detects a change in the status of the corresponding endpoint.
-
"Up" filter within the record's Filter Chain™ to eliminate "down" or unavailable answers when making traffic steering decisions.
Suppose you have an A record with multiple answers—each specifying the IPv4 address of a host on which an application or service is accessible. To configure automatic failover, you create a monitor for each endpoint, connect each monitor to its corresponding DNS answer, and create a Filter Chain within the record that includes the Up filter.
Each monitor frequently probes its designated endpoint from one or more monitoring regions to determine whether it should be considered up or available based on the up conditions defined in the monitor settings. If the results of a probe fail to meet these conditions, the endpoint is considered down. In response, the data feed connecting the monitor to its corresponding answer pushes an update, automatically changing the answer's "up" metadata value to false.
As the platform receives incoming queries for record domain and type, it references each filter in the record's Filter Chain configuration to determine the best answer(s) to return to the requesting client. To support automatic failover, the Filter Chain must include the Up filter, but it usually includes one or more additional filters for additional processing.
For example, if the Filter Chain contains the Up, Shuffle, and Select First N filters (in that order), then incoming queries would be processed as follows:
-
The Up filter eliminates any answer marked as "down" from the answer pool before passing the list to the next filter. Note that, because you have automatic updates configured, the up/down status for each answer reflects that of the monitored endpoint.
-
(Optional) The Shuffle filter randomizes the order of answers in the list. Note that there are many filters that can be used after the Up filter to achieve more even traffic distribution among the available endpoints or to favor certain endpoints over others based on some conditions.
-
The Select First N filter eliminates all but the first N (number) of answers in the list. In most cases, and by default, N is set to 1, meaning only the first answer in the list remains. This filter is placed at the end of most Filter Chain configurations to ensure only one answer is returned to requesting clients.
At a minimum, the Filter Chain must include the Up filter to support automatic failover, but most Filter Chains include one or more additional filters based on the desired outcome. For example, the Select First N filter is typically placed at the end of the Filter Chain so that only one answer is returned to the requesting client. Further, additional filters, such as randomization or geographic-based filters, can be used to achieve more even traffic distribution among the available endpoints or to favor certain endpoints over others based on some conditions.
The steps below assume you already have a DNS record with multiple answers for which you want to configure automatic failover.
For each endpoint represented by an answer within the DNS record, create an NS1 monitor or a third-party data source from one of the supported monitoring integrations.
The type of NS1 monitor you create depends on the nature of the endpoint you are monitoring. Refer to the links below for relevant instructions to create each type of NS1 monitor.
Alternatively, you can configure a data source from a third-party monitoring service.
A data feed is a mechanism used to push updates from an NS1 monitor or third-party data source to the corresponding answer. When you create an NS1 monitor via the portal, a data feed is automatically created for you. If you are using a third-party data source, you must create the data feeds manually.
To connect each data feed to the corresponding answer:
-
Navigate to the DNS record on which you want to configure automatic failover.
-
Go to DNS > Zones.
-
Click the name of the zone containing the record.
-
Click the name of the record to view its details, including the list of answers.
-
-
Click the menu icon to the right of one of the answers in the list, and click Edit Answer Metadata.
-
Click the Up/down metadata setting in the left column.
-
Click the Feeds icon to the right of the Up/down setting to display a list of available data feeds from NS1 monitors or third-party data sources in the center column.
-
Select the data feed corresponding to the endpoint represented by this answer.
-
Click Ok on the bottom right of the window.
-
Repeat these steps for each answer in the record.
The Up filter eliminates unavailable answers by referencing the up/down metadata status for each answer at the time of the incoming query. It is usually placed at the beginning of the Filter Chain, followed by one or more additional filters, such as a geographic or shuffle filter, and ending with the Select First N filter to control the number of answers (usually, 1) to return to the requesting client.
Reminder: The order of filters in a Filter Chain is important. Answers are processed by each filter, beginning with the first filter in the chain and making its way down.
-
On the record details page, click Create Filter Chain.
-
Click the plus sign (+) next to the Up filter.
-
(Recommended) Add one or more filters to the middle of the Filter Chain to apply secondary processes. Doing so can help prevent one endpoint from being overloaded when multiple or all answers are available.
Note
Like the Up filter, many filters leverage specific answer metadata fields. If you apply a filter that references answer metadata, you must edit the answer metadata manually or connect a data source to automatically update that field.
-
(Recommended) Add the Select First N filter at the end of the Filter Chain to control the number of responses returned to the requesting client.
-
Click Save Filter Chain.
This completes the automatic configuration process. Now, when a client queries the DNS record, any endpoints marked as down are removed from the answer pool to ensure the requester can connect to your application or service.