[NTLUG:Discuss] Load/Network Balancing NICs?

A.L.Lambert max at xjack.org
Wed Mar 14 11:36:10 CST 2001


> Hiya Peoples!
> 
> I'm building up what will become a mission-critical web site at my
> company. I'm setting up a fault tolerant infrastructure, dual ISPs,
> dual routers, dual firewalls, dual switches and clustered web servers.  
> I know I can use simple round-robin DNS to mathmatically balance the
> load across ISP networks and web servers, but what I'd like to be able
> to do is take advantage of the available fault tolerance of the ISP
> networks, meaning... if one ISP goes down, or even a router or
> firewall, etc... etc... and be able to automatically redistribute the
> load to the available connection.
> 
> I know there's hardware out there to accomplish this, but I'd prefer
> to provide a linux solution.
> 
> Any ideas?  Known solutions?


	One way to set this up would be like this:

ISP1 
	Webserver 
	DNS server
	Etc.

ISP2
	Webserver 
	DNS server
	Etc.

	Use http://cr.yp.to/djbdns.html for your DNS server; has built in
DNS load balancing/failover stuff, sophisticated enough that all you
should need to write a simple script like the following:

#!/bin/sh

cd /service/tinydns

while true ; do
ping -c1 theotherwebserver 2>&1 > /dev/null
	if [ "$?" != "0" ] ; then
	cp -f data.down data
	make > /dev/null
	else
	cp -f data.up data
	make > /dev/null
	fi
sleep 15s
done


	You'll have the files data.up and data.down created before hand,
with the .down file having the second server removed, and the .up file
having both webservers listed.

	You can run the script at any interval you want (every 15 seconds
as written above), and when one box can't reach the other for any reason,
it removes it from it's DNS tables.  As soon as it comes back up, it
re-adds it.

	Now, PLEASE note, that my script above is most likely NOT what you
want to write (although it should work), it's just an example showing the
logic.  More likely you'll want to use something like "wget -q
http://theotherwebserver/index.html" to verify that the other end is
actually serving webpages, and not just responding to ping's, or maybe get
even more elegant and use a small C or Perl program to do this.

	Anyhoo, just my $0.02 cents.  This is certainly not the only way
to tackle this problem, but it's the way I would probably do it.  Cheers!
	

-- 
A.L.Lambert
------------------------------------------------------------------------
The problems that exist in the world today cannot be solved by the level
of thinking that created them...
	-Einstein
------------------------------------------------------------------------




More information about the Discuss mailing list