My custom templates are not working as expected behind a load balancer.
All OnApp versions
Each real server needs a loopback IP address to be configured as the VIP. This address should be stopped to respond to ARP requests and the webserver should be configured to respond to this IP address.
With the most modern Linux kernels (> 2.6), you can alter the ARP behavior which allows you to configure a loopback adapter without concern for ARP issues.
To do it, add the following lines to /etc/sysctl.conf
and reboot, or run the following to reload the /sbin/sysctl.conf -p
file:
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
CODE
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
CODE
Once you have configured your Linux real server to prevent it from responding to ARP requests, for the loopback adapter you can configure your VIPs as follows:
ifconfig lo:0 VIP netmask 255.255.255.255 up
CODE
To make it permanent and reboot, you may include this command in rc.local
or in a similar customizable startup script. Failure to correctly configure the real servers to handle the ARP problem is the most common problem in this type of load-balanced configuration.