← All Posts

Networking

DNS Failover for High Availability Hosting

Using DNS to provide automatic failover between geographically distributed servers.

DNSHigh AvailabilityInfrastructure

If you're hosting across multiple geographic locations, DNS failover is one of the simplest paths to high availability. The concept: publish multiple A records or use a DNS provider that health-checks your endpoints and removes unhealthy ones from rotation.

How it works:

  1. Configure two (or more) servers in different locations, each capable of serving the application
  2. Set up DNS with a health check monitor pointing at each server
  3. When a health check fails, the DNS provider stops returning that server's IP in responses
  4. Traffic automatically routes to the surviving server(s)

Caveats:

  • TTL matters. If your DNS TTL is 3600 seconds (1 hour), some clients will keep hitting the dead server for up to an hour. Use low TTLs (60-300 seconds) for failover records
  • DNS caching is unpredictable. Some ISPs and resolvers ignore TTLs entirely
  • Session state: If users have sessions on Server A and fail over to Server B, those sessions are lost unless you use shared session storage

Modern approach: Load balancers (like Cloudflare, AWS ALB, or Azure Front Door) handle this more gracefully than raw DNS failover. But understanding the DNS-level mechanics is still fundamental.