A to CNAME Failover
Press Releases May 22, 2018

A to CNAME Failover

We’re going to show you how to hack DNS Failover so you can do the impossible… failover between an IP address and a hostname.

Failover is a service that can be applied to a record. So let’s say you wanted to do the impossible, failover between an IP and a hostname. What record type would you choose? You can’t… instead, you need to convert your IP address into a hostname and then create a CNAME record with failover.¬†Read on and we’ll show you how. Or watch this video and we’ll walk you through it:

The Basics:

(skip if you have a basic understanding of DNS)

DNS Failover is a service that allows you to move traffic from a primary endpoint to a backup one. Failover constantly monitors your endpoints and if the primary is unavailable, it will move traffic over to the backup. You can configure failover to have multiple backup endpoints.

Endpoints can be IP addresses or hostnames. If you want to failover between two IP addresses, you would use A record failover. Whereas, for hostnames you would use CNAME failover.

The Hack:

1. First, we are going to turn our IP address into a hostname. Create an A record and name it something you’ll remember. For this example, we’ll call our record “webserver”. If you are using Constellix, you can actually see a preview of what your record will look like at the top of the screen. Point your record to the desired IP address. In this case, we want to point it to the IP address of our webserver at 127.0.0.1.

a record constellix

2. Create a CNAME record and give it a name.

3. Enable failover and choose your failover policy.

4. In the first input field for host add the hostname of your primary system. In this case, we’ll use the hostname we created in the first step. Only enter the name of the record. Constellix will automatically append your domain name to the end of the name.

5. Under the Sonar Check column, choose the monitoring check you previously created for that endpoint. You’ll need to do this for every endpoint you add to a failover record. You can learn how to create Sonar checks here.

CNAME failover Constellix

5. Enter the hostname of your backup system in the second field. Since this endpoint is already a hostname, you will need to add a . to the end of the hostname so we don’t append your domain name to it, eg: backup.com.

6. Save your record and commit your changes.