Configuring your servers to run with the LoadBalancer

Your Load Balancer has two IP addresses -  the first is the IP address assigned to the virtual machine, and the second is your floating/virtual IP address which forwards traffic to your backend servers.

Each real server needs a loopback IP address to be configured as the VIP. This address needs to be stopped from responding to ARP requests and the web server needs to be configured to respond to this IP address. With most modern Linux kernels (>2.6) you can alter the ARP behavior allowing you to configure a loopback adapter without worrying about ARP issues.

To do this just add the following lines to /etc/sysctl.conf and reboot, or run the following to reload the file: /sbin/sysctl.conf -p

net.ipv4.conf.all.arp_ignore=1
net.ipv4.conf.eth0.arp_ignore=1
net.ipv4.conf.eth1.arp_ignore=1
net.ipv4.conf.all.arp_announce=2
net.ipv4.conf.eth0.arp_announce=2
net.ipv4.conf.eth1.arp_announce=2

Alternatively, the following commands may be used to change the settings interactively during runtime:

echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore
echo 1 > /proc/sys/net/ipv4/conf/eth1/arp_ignore
echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce
echo 2 > /proc/sys/net/ipv4/conf/eth1/arp_announce

Once you have configured your Linux real server so that it won't respond to ARP requests for the loopback adapter you can configure your VIPs as follows:

ifconfig lo:0 VIP netmask 255.255.255.255 up

To make this permanent and reboot safe you may include this command in rc.local or in a similar customizable start-up script. Failure to
correctly configure the real servers to handle the ARP problem is the most common problem in these type of load balanced configurations


Was this article helpful?

mood_bad Dislike 3
mood Like 1
visibility Views: 10500