DNS Failover Setup: How to Keep Your Site Online When Servers Go Down
Understand health checks, DNS answer changes and cache delays when designing failover between hosting endpoints.
The named scenario below is a worked example for learning, not a verified incident report. Provider settings and outcomes vary.
DNS Failover Detection Flow
Serving all traffic
Monitor polls server
Primary unresponsive
Switch to backup IP
Traffic rerouted
Users unaffected
๐ฏ Illustrative example: Akash's E-Commerce Site Survives a Server Crash
Akash's primary server crashes during a sale. DNS failover automatically redirects customers to the backup:
Setup: primary + backup servers
Primary: 10.0.1.1 (main server). Backup: 10.0.2.1 (standby with synced data). Both run the same app.
Health check monitors primary
DNS failover provider pings 10.0.1.1 every 30 seconds. HTTP 200 = healthy.
Primary crashes at 2:00 PM
Server returns HTTP 503. Health check fails 3 consecutive times (90 seconds total).
DNS automatically switches
Failover provider updates A record from 10.0.1.1 to 10.0.2.1. TTL is 60 seconds.
Customers redirected within 2 minutes
New DNS queries return backup IP. Existing connections may need refresh. Sale continues!
Primary fixed, DNS switches back
Once primary recovers and passes health checks, DNS automatically routes back to 10.0.1.1.
Total downtime during server crash: ~2 minutes. Sale lost $0 in revenue.
Without failover, the 4-hour crash would have cost โน3 lakh in lost sales.
What is DNS Failover?
DNS failover is an automated high-availability technique that monitors your server's health and switches DNS records to a backup server when the primary becomes unreachable. Unlike basic DNS round-robin, failover includes active health monitoring โ if your server stops responding, traffic is redirected automatically.
This is critical for businesses where downtime means lost revenue. A properly configured DNS failover can reduce effective downtime from hours to under 2 minutes.
How DNS Failover Works
1. Health Checks
The DNS failover provider continuously monitors your primary server by sending HTTP/HTTPS/TCP/ICMP probes at regular intervals (every 10-60 seconds) from multiple global locations.
2. Failure Detection
When health checks fail from multiple locations consecutively (e.g., 3 failures in a row from 2+ regions), the system confirms the primary server is down โ not just a network blip.
3. DNS Record Update
The DNS provider automatically changes the A record from the primary IP to the backup server's IP. With a low TTL, clients pick up the new IP within seconds.
4. Recovery (Failback)
Once the primary server recovers and passes health checks again, the DNS record switches back automatically. Some providers offer manual failback for extra control.
TTL Strategy for Failover
TTL is the most critical setting for failover speed. Lower TTL = faster failover but more DNS queries.
| TTL | Failover Time | DNS Query Load | Best For |
|---|---|---|---|
| 30s | ~1 min | Very high | Critical production systems |
| 60s | ~2 min | High | E-commerce, SaaS apps |
| 300s | ~6 min | Moderate | Business websites |
| 3600s | ~1 hour | Low | Not recommended for failover |
DNS Failover Providers
| Provider | Health Checks | Min TTL | Pricing |
|---|---|---|---|
| AWS Route 53 | 10s interval | 1s | $0.50/health check/month |
| Cloudflare | 60s interval | 30s (proxy) | Free (with proxy) |
| DNS Made Easy | 30s interval | 30s | From $30/year |
| NS1 | 10s interval | 1s | Custom pricing |
Common Failover Mistakes
High TTL โ Using 3600s TTL means clients won't see the failover for up to an hour. Lower it to 60-300s before enabling failover.
No backup server testing โ If your backup isn't configured identically to production, failover may redirect users to a broken site.
Single health check location โ A network issue in one region could trigger false failover. Use multi-region health checks.
Forgetting SSL โ Your backup server needs a valid SSL certificate for the same domain, or users will see security warnings.
Testing Your Failover
Monitor DNS changes
watch -n 5 'dig yourdomain.com A +short'
Polls every 5 seconds. Simulate failure by stopping your primary server and watch the IP change.
Check current TTL
dig yourdomain.com A | grep -A1 'ANSWER'
mydnsreport.com
Use our DNS Lookup tool to verify your A records and TTL values before and after failover triggers.
Frequently Asked Questions
What is DNS failover?
An automated system that monitors server health and redirects DNS to a backup when the primary fails, minimizing downtime.
How fast does failover happen?
Typically 1-5 minutes depending on health check frequency and TTL. With 30s health checks and 60s TTL, failover completes in ~2 minutes.
Is DNS failover the same as load balancing?
No. Load balancing distributes traffic across active servers. Failover keeps a standby server that only receives traffic when the primary fails.
Related Articles & Tools
DNS Round-Robin Load Balancing
Simple load distribution with DNS
DNS TTL Explained
Choose the right TTL for failover
DNS Lookup Tool
Check your A records and TTL
How DNS Works
DNS resolution step by step