16.5 Installing and Configuring Keepalived

To install Keepalived:

  1. Install the keepalived package on each server:

    # yum install keepalived
  2. Edit /etc/keepalived/keepalived.conf to configure Keepalived on each server. See Section 16.5.1, “About the Keepalived Configuration File”.

  3. Enable IP forwarding:

    # echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
    # sysctl -p
    net.ipv4.ip_forward = 1
  4. Add firewall rules to allow VRRP communication using the multicast IP address and the VRRP protocol (112) on each network interface that Keepalived will control, for example:

    # iptables -I INPUT -i eth0 -d -p vrrp -j ACCEPT
    # iptables -I OUTPUT -o eth0 -d -p vrrp -j ACCEPT
    # service iptables save
  5. Enable and start the keepalived service on each server:

    # chkconfig keepalived on
    # service keepalived start

    If you change the Keepalived configuration, reload the keepalived service:

    # service keepalived reload