Ok..
First little concept..
Here we make a virtual server which sits in front all real servers and so that we can add , remove real servers. And this virtual server also do load balancing for the real servers.
Ok
That is long procedure.. Let me try to summerize it..
1. Make sure your ipchains etc. are off. And Iptables are on.
2. Second you have to enable ip forwarding.. that is you can add a line in the /etc/rc.d/rc.local
Also we will add few other lines which will do masquerading for external interface ( Here I am assuming that eth1 is connected to internet.
echo > 1 /proc/sys/net/ipv4/ip_forward
iptables -t nat -P POSTROUTING DROP
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
Now we have to configure ipvsadm, utility to do virtual server things. See linuxvirtualserver.org to get this, also it may need to patch your kernel , get more details from there.
So wht is next is to assign private IP to all your real server and set the gateway on them as the internal IP of the virtual server. Also assign public ip to external interface to the virtual server ie. which is connected to the internet.
Next is to assign alogorithm to ports. like wht what algorithm of virtual server will use for which protocol. Here see ipvsadm man page for more details. Lets assume that we are assigning wrr and wlc algorithm to port 21 and port 80 resp. means ftp and http traffic. so command wil be
ipvsadm -A -t xxx.xxx.xxx.xxx:21 -s wrr
ipvsadm -A -t xxx.xxx.xxx.xxx:80 -s wlc
Here xxx.xxx.xxx.xxx is your external IP address of your virtual server.
Now lets assume that our real servers have IP 192.168.5.2 which will handle ftp request and 192.168.5.3 which will handle http reqests, we will also distribute the http request to both servers.. and 192.168.5.1 one is the internal address of your virtual server which is set as gateway in both real servers.
Now adding the real servers to vitual server ..
ipvsadm -a -t xxx.xxx.xxx.xxx:80 -r 192.168.5.3:80 -m
ipvasdm -a -t xxx.xxx.xxx.xxx:80 -r 192.168.5.2:80 -m -w 2
ipvsadm -a -t xxx.xxx.xxx.xxx:21 -r 192.168.5.2:21 -m
Here http will get distributed along both real server and ftp will go to only 192.168.5.2
I don't this it is comprehensive but it can give a good idea that how to do it in linux. So after every thing is fine on accessing xxx.xxx.xxx.xxx all request will be forwarded to real servers as per the algorithm.