17.8.2 Configuring the Back-End Servers for Keepalived DR-Mode Load Balancing

The example configuration requires that the virtual IP address is configured on the master Keepalived server and on each back-end server. The Keepalived configuration maintains the virtual IP address on the master Keepalived server.

Only the master Keepalived server should respond to ARP requests for the virtual IP address. You can set the arp_ignore and arp_announce ARP parameters for the network interface of each back-end server so that they do not respond to ARP requests for the virtual IP address.

To configure the ARP parameters and virtual IP address on each back-end server:

  1. Configure the ARP parameters for the primary network interface, for example enp0s8:

    # echo "net.ipv4.conf.enp0s8.arp_ignore = 1" >> /etc/sysctl.conf
    # echo "net.ipv4.conf.enp0s8.arp_announce = 2" >> /etc/sysctl.conf
    # sysctl -p
    net.ipv4.conf.enp0s8.arp_ignore = 1
    net.ipv4.conf.enp0s8.arp_announce = 2
  2. To define a virtual IP address that persists across reboots, edit /etc/sysconfig/network-scripts/ifcfg-iface and add IPADDR1 and PREFIX1 entries for the virtual IP address, for example:

    ...
    NAME=enp0s8
    ...
    IPADDR0=10.0.0.72
    GATEWAY0=10.0.0.100
    PREFIX0=24
    IPADDR1=10.0.0.1
    PREFIX1=24
    ...

    This example defines the virtual IP address 10.0.0.1 for enp0s8 in addition to the existing real IP address of the back-end server.

  3. Reboot the system and verify that the virtual IP address has been set up:

    # ip addr show enp0s8
    2: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 08:00:27:cb:a6:8d brd ff:ff:ff:ff:ff:ff
        inet 10.0.0.72/24 brd 10.0.0.255 scope global enp0s8
        inet 10.0.0.1/24 brd 10.0.0.255 scope global secondary enp0s8
        inet6 fe80::a00:27ff:fecb:a68d/64 scope link 
           valid_lft forever preferred_lft forever