Keepalived master cannot reclaim virtual IP after recovered

keepalived

Steps

  1. Start both master and slave
  2. Keep pinging virtual ip (i.e 192.168.10.100)
  3. Shutdown master
  4. Slave enters MASTER state
  5. Restart master
  6. Slave enters BACKUP state and Master enters MASTER state

Ping doesn't work after step 6. No server gets the virtual ip. (I checked with ip addr show eth1)

Master can get back the virtual ip until I restart the keepalived service.

How to make the master getting virtual ip without restart the service?

Keepalived configuration:

host1 (master)

vrrp_instance VI_1 {
    state MASTER
    interface eth1
    virtual_router_id 51
    priority 101
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass secret
    }
    virtual_ipaddress {
        192.168.10.100
    }
}

host2 (slave)

vrrp_instance VI_1 {
    state BACKUP
    interface eth1
    virtual_router_id 51
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass secret
    }
    virtual_ipaddress {
        192.168.10.100
    }
}

Best Answer

Only thing that jumps out different between your config and ones I'm using are that I have

virtual_ipaddress { <ip> dev <devname> }

That may not strictly be necessary, but that's the only difference I can see vs. a known working setup.