0

I am trying to setup a comiled keepalived 1.2.19 on ubuntu 14.04 with failover. Somehow the virtual ip never shows up:

ip addr show eth0 


2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 08:00:27:60:7f:89 brd ff:ff:ff:ff:ff:ff
        inet 192.168.56.120/24 brd 192.168.56.255 scope global eth0
           valid_lft forever preferred_lft forever
        inet 192.168.56.121/24 brd 192.168.56.255 scope global secondary eth0:0
           valid_lft forever preferred_lft forever
        inet6 fe80::a00:27ff:fe60:7f89/64 scope link 
           valid_lft forever preferred_lft forever

The configuration file looks like this:

! Configuration File for keepalived
vrrp_script chk_haproxy {               # Requires keepalived-1.1.13
        script "killall -0 haproxy"     # cheaper than pidof
        interval 2                      # check every 2 seconds
        weight 2                        # add 2 points of prio if OK
}
vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 101
    priority 101        # 101 on master; 100 on backup
    virtual_ipaddress {
        192.168.56.150
    }
    track_script {
        chk_haproxy
    }
}

This looks pretty basic to setup. What am I doing wrong?

Syslog after restart of keepalived:

Keepalived[4821]: Stopping Keepalived v1.2.19 (08/15,2015)
Keepalived[4988]: Starting Keepalived v1.2.19 (08/15,2015)
Keepalived[4989]: Starting Healthcheck child process, pid=4990
Keepalived_healthcheckers[4990]: Initializing ipvs 2.6
Keepalived[4989]: Starting VRRP child process, pid=4991
Keepalived_healthcheckers[4990]: Registering Kernel netlink reflector
Keepalived_healthcheckers[4990]: Registering Kernel netlink command channel
Keepalived_healthcheckers[4990]: Configuration is using : 6006 Bytes
Keepalived_vrrp[4991]: Registering Kernel netlink reflector
Keepalived_vrrp[4991]: Registering Kernel netlink command channel
Keepalived_vrrp[4991]: Registering gratuitous ARP shared channel
Keepalived_vrrp[4991]: Configuration is using : 57026 Bytes
Keepalived_vrrp[4991]: Using LinkWatch kernel netlink reflector...
Keepalived_healthcheckers[4990]: Using LinkWatch kernel netlink reflector...
5
  • What do you have in your logs? Keepalived by default write to /var/log/syslog. One possible cause: your track script is failing.
    – Khaled
    Aug 16, 2015 at 11:15
  • just posted the logs. How could the trackscript fail? I have included all config into the question, there is no aditional script.
    – merlin
    Aug 16, 2015 at 11:43
  • Are you sure you are using the right configuration file? I tried your configuration and it worked! Have a look at the script you are using to run keepalived. I got the same messages (without IP assignment) when using empty config file.
    – Khaled
    Aug 16, 2015 at 12:23
  • @Khaled Thank yøu! I had a mess, somehow the start script I found on the net did not do the job right and even changed me to root after executing. I now started from scratch and it works :-) Please add your comment as answer, so I can accept it as solution.
    – merlin
    Aug 16, 2015 at 13:59
  • posted my answer.
    – Khaled
    Aug 16, 2015 at 14:50

1 Answer 1

1

I have tested your configuration on my machine and it worked. Keepalived assigned the VIP to the specified interface and the logs showed the line

Keepalived_vrrp: VRRP_Instance(VI_1) Entering MASTER STATE

The only way I was able to reproduce your case is by supplying an empty configuration file (the test on non-existent file failed because the startup script checks for it).

You need to verify your configuration file named specified in the startup script /etc/init.d/keepalived.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .