keepalived destination not reachable

  • I am setting up a three node cluster with failover IP, cloud vlan and keepalived on ubuntu 20.04. I tried various options for configuring keepalived. The virtual IP address gets assigned but is not reachable from another node within the cluster.


    /etc/netplan/keepalived.yaml

    Code
    network:
       version: 2
       bridges:
           ens01:
               dhcp4: no
               dhcp6: no
               accept-ra: no

    /etc/keepalived/keepalived.conf

    I tried creating the network interface using systemd-networkd:

    Code
    [NetDev]
    Name=ens01
    Kind=dummy

    I tried with use_vmac, strict_mode off and few other settings but I am unable to ping the virtual IP address from another machine. There are no firewalls and the nodes are able to talk to each other using the cloud vlan network configuration. Do I need to do any additional routing settings?

  • Hello,

    your config is looking like it came from this blogpost: https://chr4.org/posts/2019-01…an-slash-systemd-network/


    Can you tell me what you are trying to reach with your setup? Why are you trying to use a dummy interface if you have a real one available? For me it's not quite clear if you are trying to make use of an internal loadbalancer approach.


    I'm using keepalived by myself with the cloud vlan and the failover ip for external access. In my case i use the cloud vlan for the communication of keepalived nodes. This is a shortened version of my config. The Nodes are having 172.16.0.11 - 13 on the eth1 Interface.


  • Hello michaeleifel , Thanks very much for your reply.


    I am trying to do something very similar to your setup. I am trying to do a failover for the kubernetes control plane. I was initially trying with the cloud vlan interface and when it didn't work I tried with the dummy interface as per the link you mentioned.


    I fixed the issue after looking at your configuration. I switched the failover IP to use eth0 and added unicast_src_ip and unicast_peer for the secondary interfaces and it worked!


    I was testing the failover IP routing using web service and it works as expected when I shutdown the master node. However, when the master node comes back, the virtual IP switches to the master node but the failover IP doesn't get rerouted because I used the notify_fault script.

    Code
    notify_fault "/etc/keepalived/failover.sh"

    I am looking into your script from here: https://forum.netcup.de/admini…ions-erkennen/#post154940

  • Hello surya

    glad to hear that you found your issue.


    I found that calling the shell script via keepalived isn't 100% reliable in error cases. Keepalived still manages who is "master" and who is "backup", but the IP switch itself is done through a shell script. This works as following:

    - Check if file '/tmp/keepalived.status' exists


    Backup Nodes:

    - Check if the string "BACKUP" is inside '/tmp/keepalived.status' and Keepalived is running, print info that node is not master

    Master Nodes:

    - Check if the string "MASTER" is inside '/tmp/keepalived.status' and Keepalived is running

    - Check if DNS works, WSDL is reachable and if Node has already the floating IP

    - If so, print information that node has IP

    - If not, trigger failover


  • Hello michaeleifel


    Thanks a lot for the explanation and the script. That is brilliant.

    I did some testing with a simple notify script to invoke the routing web service and am able to simulate the loop condition. Will try to implement your script.

  • Hello michaeleifel


    I solved (I think!) the problem slightly differently and it seems to do the job. keepalived will always only ever nominate one of the servers as the MASTER. I check if the node is the MASTER and invoke the web service for rerouting the floating IP to the MASTER.