3

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 
  • What exactly do you expect keepalived to do if it can't send VRRP packets? – womble Jun 28 '18 at 23:54
  • @womble Be waiting and react when the interface gets an IP, then send the packets. Which it presumably already does when an interface loses an IP after initialization. – Paul Jun 29 '18 at 9:49
4

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 a FAULT state if the interface does not have an IP, which is great. Simply add dynamic_interfaces to global_defs and it works.

| improve this answer | |
0

Why not just give it a temporary address using ifconfig?

| improve this answer | |
  • 1
    Hi Jonas, I can think of multiple always around this (and problems with each of them for the system we are using), I am wondering was my above question possible and I just don't know how to do it, before I explore them. – Paul Jun 28 '18 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.