Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


How can i use DNS server to create simple HA (High availability) of website ?

For example if my web-server ( for better understanding i use internal IP in real it will be other hosting companies) :80 (is offline) traffic go to :80

You have right, i use bad word "hight avability" of course i was thinking about failover.

Using few IP in A records is good for simple load-balancing. But not in case, if i want notice user about failure (for example display page, Oops something is wrong without our server, we working on it) against "can't establish connection".

I was thinking about setting up something like this

2 DNS servers, one installed on www server

Both have low TTL

on my domain, set up 2 ns records first for DNS with my apache server second to other dns

If user try connect he will get ip of www server using first dns, if that dns is offline (probably www server is also down) so it will try second NS record, what will point to another dns, that dns will point to "backup" page.

That's what i would like to do.

If You have other idea please share.

Reverse proxy is not option, because IP of server can change, or i can use other country for backup.

share|improve this question

migrated from Oct 9 '10 at 8:31

This question came from our site for computer enthusiasts and power users.

DNS is not the solution for high-availability failover.

Regardless of the TTL on your DNS records many clients will cache your site's IP address, and will not correctly failover when you change it.

For more comprehensive answers, see this question.

share|improve this answer
You do not have to rely on changing a record. You may add several IPs to an A record, and if one fails, the browser will attempt the next one, adding some time to the request, but still being available. – gekkz Oct 9 '10 at 9:27
that's not failover, it's redundant load-balancing. – Alnitak Oct 9 '10 at 9:37
and poor quality load-balancing, at that. – Alnitak Oct 9 '10 at 12:35
Actually, some people do seem to use DNS for failover, albeit at the price of high DNS server load. – cmc Feb 4 '13 at 13:49
@cmc nevertheless, DNS is not designed for this use. – Alnitak Feb 4 '13 at 13:52

You could use a reverse proxy

share|improve this answer
You will need to use a reverse proxy or load balancer setup to do this appropriately. You will setup one ip address on your reverse proxy or load balancer and put this in DNS as your www A record. Your actual web servers will live at different addresses. The load balancer should then be able to be configured fail over to a secondary server (displaying your maintenance page) if the first is down. – J.Zimmerman Oct 10 '10 at 6:31

You can't do that in just DNS. You also need something to monitor the sites and switch the records between them when one fails (and the other is still alive). There are a number of commercial services that do that for you (I know DynDNS does under their Dynect brand) or if you manage your own DNS you could pull together some scripts or tools to do that, but it's not as trivial as it sounds.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.