0

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.

Nixphoe
  • 4,584
  • 7
  • 34
  • 52
Mad_Dud
  • 278
  • 4
  • 10

1 Answers1

3

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.

EEAA
  • 109,363
  • 18
  • 175
  • 245
  • 1
    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 03: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 03: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 04: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 04: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 04:32
  • Load balancers are hosts too, and CARP doesn't work across separated networks (which is the case by definition if you have two separate ISPs). – womble Jul 10 '11 at 04:47
  • @Chris S - these hosts are in different countries. DNS Failover solution may work. I will try it out. Thank you all, for good suggestions. – Mad_Dud Jul 10 '11 at 10:54