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

I have two hosts in different networks (different ISPs). I would like to redirect all traffic to second host only in case if first one is off-line (unexpectedly).

What are technical solutions to manage this problem? Is there a way to set queue of IP addresses to be sent to client, who uses DNS to communicate with hosts?

These are FreeBSD machines.

share|improve this question
up vote 3 down vote accepted

What you need is some sort of load balancing system. Load balancing systems can be implemented in several different ways. A few of these are:

  1. Dedicated load balancing server - this device sits in "front" of your back-end nodes and directs requests to one or more of them depending on whatever conditions you set.
  2. DNS Failover - automation built into your DNS servers that automatically change the IP associated with a certain hostname again, depending on pre-determined conditions.
  3. CARP/Virtual IP/etc. - Two or more servers running heartbeat, one of which is able to take over an IP address from the other in case one goes down. This probably wouldn't work in your case due to the fact that your servers are in two different ASes.

Of the two that you have to choose from option #1 would be preferred, due to the fact that clients cache DNS lookups, so in the event of a failover, it's likely some number of clients will see failures until their DNS caches expire and they issue another DNS lookup.

HAProxy is a very capable and widely-used F/OSS load balancer - in fact it is used on all of the SE sites. HAProxy does support FreeBSD.

share|improve this answer
The only suggestion that will work in the OP's case is DNS Failover, due to the fact that the two servers are with different ISPs. – womble Jul 10 '11 at 3:46
@womble - I thought about that, though I believe #1 could work, though it would be sub-optimal as well due to the additional latency induced by the hop to and from the other ISP. – EEAA Jul 10 '11 at 3:50
#1 can't work, because everything needs to be up for the load balancer to be accessable. Also, you need more than just to be in the same AS for CARP to work. – womble Jul 10 '11 at 4:17
@womble, the questioner didn't specify if his hosts are physically separated, only that they're on different ISPs. If they're physically in the same location setting up a load balancer or CARP is somewhat trivial. If they're separate you are correct. – Chris S Jul 10 '11 at 4:26
We also don't know if he's trying to protect from ISP failure, host failure, or both. If he's only wanting to protect from host failure, #1 could work as long as the load balancer stays up. :) – EEAA Jul 10 '11 at 4:32

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.