16.7.2 Configuring Back-End Server Routing for Keepalived NAT-Mode Load Balancing

On each back-end real servers that you intend to use with the Keepalived load balancer, ensure that the routing table contains a default route for the virtual IP address of the load balancer's internal network interface.

For example, if the virtual IP address is 10.0.0.100, you can use the ip command to examine the routing table and to set the default route:

# ip route show
10.0.0.0/24 dev eth0  proto kernel  scope link  src 10.0.0.71 
# ip route add default via 10.0.0.100 dev eth0
# ip route show
default via 10.0.0.100 dev eth0 
10.0.0.0/24 dev eth0  proto kernel  scope link  src 10.0.0.71 

To make the default route for eth0 persist across reboots, create the file /etc/sysconfig/network-scripts/route-eth0:

# echo "default via 10.0.0.100 dev eth0" > /etc/sysconfig/network-scripts/route-eth0