I want to use keepalived on an interface that will get an IP at some point but will not have one initially, can I set this up somehow in the config? If I try to start it now keepalived errors out as keepalived doesn't know what source IP address to use when sending VRRP packets. Conf:
! Configuration File for keepalived
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 150
advert_int 1
authentication {
auth_type PASS
auth_pass pwd
}
virtual_ipaddress {
192.168.0.13
}
notify /etc/state_change.py
}
Log:
keepalived -f /etc/keepalived.conf --log-console --dont-fork
Thu Jun 28 11:25:53 2018: Starting Keepalived v1.4.4 (05/08,2018)
Thu Jun 28 11:25:53 2018: Running on Linux 4.7.8 #9 SMP Wed Jun 27 17:25:18 IST
2018 (built for Linux 4.7.8)
Thu Jun 28 11:25:53 2018: Opening file '/etc/keepalived.conf'.
Thu Jun 28 11:25:53 2018: Starting Healthcheck child process, pid=18886
Thu Jun 28 11:25:53 2018: Starting VRRP child process, pid=18887
Thu Jun 28 11:25:53 2018: Opening file '/etc/keepalived.conf'.
Thu Jun 28 11:25:53 2018: Registering Kernel netlink reflector
Thu Jun 28 11:25:53 2018: Registering Kernel netlink command channel
Thu Jun 28 11:25:53 2018: Registering gratuitous ARP shared channel
Thu Jun 28 11:25:53 2018: Opening file '/etc/keepalived.conf'.
Thu Jun 28 11:25:53 2018: WARNING - default user 'keepalived_script' for script
execution does not exist - please create.
Thu Jun 28 11:25:53 2018: (VI_1): Cannot find an IP address to use for interface
eth0
Thu Jun 28 11:25:54 2018: Stopped
Thu Jun 28 11:25:54 2018: Keepalived_vrrp exited with permanent error CONFIG. Te
rminating
Thu Jun 28 11:25:54 2018: Stopping
Thu Jun 28 11:25:54 2018: Stopped
Best Answer
The new version of keepalived
2.0.5
was released today and it supports interfaces that do not exist yet. By happenstance that also fixes my issue as keepalived will start in aFAULT
state if the interface does not have an IP, which is great. Simply adddynamic_interfaces
toglobal_defs
and it works.