specifying ip range in haresources

Horms horms at vergenet.net
Tue Apr 11 14:59:39 MDT 2000


On Tue, Apr 11, 2000 at 03:01:26PM -0400, Trevor Astrope wrote:
> Hello,
> 
> Thanks for the reply. I'm not sure I follow exactly what you're
> suggesting, but I'll try and explain my setup better and maybe you could
> suggest a better way I go about it...
> 
> I have 2 boxes running heartbeat: server1 and server2. server1 has the ip
> address 216.95.221.2 and server2 has the ip address 216.95.221.3.
> 
> On server1 is all of our virtual customers web sites which are ip based
> virtual hosts. There are currently about 50 or so of them.
> 
> On server2 are all of our company web sites which are also ip based 
> virtual hosts.
> 
> What I would like to do is have each machine fail over for the other. This
> works fine when we are only talking a few IPs on each machine, but
> heartbeat won't even start if there are a lot of IPs on the same line of
> haresources. And if I specify them like below, the load goes way up and
> heartbeat throws a fit and shuts down...
> 
> server1.e-corp.net 216.95.221.100 
> server1.e-corp.net 216.95.221.101
> server1.e-corp.net 216.95.221.102
> ...
> 
> I'm not sure how to manage many IPs via a single IP as you outline below.
> Our router is a Cisco 1604 and it has a gateway IP of 216.95.221.1. Both
> machines use that IP as their gateway.
> 
> The reason for each machine failing over for the other is I would like to
> get the clients away from the company sites and viceversa. Each machine
> can handle the traffic for the other, allbeit, the machine doing the
> failover could be heavily loaded. But I don't anticipate this situation
> lasting for very long, as I'm unable to failover our postgres database, so
> the idea is to get the down machine up asap.
> 
> Anyway, any help is appreciated. I really need to be able to failover many
> IPs or heartbeat is just of no use to me.


With the situation you have explained you should be able to do this with 2
IP addresses that are failed over using heartbeat, lets call these floating
addresses. You will need a floating address for customers (float_cust) and
a floating address for company sites (float_comp).

I will assume that the company and client sites are nicely grouped into
CIRC networks (net_cust and net_comp), if they aren't then you can still do
this but things will be a little messier.

You will need to configure each web (heartbeat) servers to to accept
traffic as local for both customer and company web sites. This can be done
using an IP alias on the loopback device. Basically this means the box will
accept traffic for the addresses and treat it as local but (if you are
running a 2.2.14 kernel) it won't answer arp reqests. For simplicity I will
assume that the customer and company sites can be aggregated to a single
/24 netowrk (net_both).

ifconfig lo:0 net_both netmask 255.255.255.0 mtu 1500

You will also need to set up heartbeat on each of these severs so they will
failover the float_cust and float_comp addresses as appropriate.

Now on the Cisco router you just need to redirect traffic to the customer
and company virtual addresses to the two floating addresses.  I forget the
exact syntax for a cisco configuration but on unix it would be.

route add -net net_cust netmask blah gw float_cust
route add -net net_comp netmask blah gw float_comp

So as traffic bound for one of the virtual srevers traffic enters the
network it will be forwarded to one of the floating addresses.  Depending
on the state of your heartbeat/web servers whichever are active will have
the floating addresses and accept traffic, see it as local and handle the
connection.

The heartbeat configuration is gretly simplified, the number of aliases
required is greatly simplified and the ammount of gratuitous ARPing and
interface management that is required when a failover occurs is greatly
simplified.

-- 
Horms



More information about the Linux-HA mailing list