You'll need to create a dummy interface, and then assign the virtual IP to that. Here's an example using a VM, which will generate a virtual ip of x.y.z.3. You can set your own last quad by changing the last part of the sed command '\1.3/g' to .4 or .215 or whatever:
There is a fix upstream for this issue in keepalived 2.0. I'm looking into what would be required to backport the fix. In the meantime, there is a workaround that I hope will be sufficient for your needs, as discovered by https:/ /chr4.org/ blog/2019/ 01/21/make- keepalived- play-nicely- with-netplan- slash-systemd- network/
You'll need to create a dummy interface, and then assign the virtual IP to that. Here's an example using a VM, which will generate a virtual ip of x.y.z.3. You can set your own last quad by changing the last part of the sed command '\1.3/g' to .4 or .215 or whatever:
multipass launch daily:bionic --name tester && multipass exec tester -- sudo su
Inside the VM:
apt update && apt dist-upgrade -y && apt install -y keepalived && router_ id 33
echo "vrrp_instance VI_1 {
virtual_
state MASTER
interface ens3
virtual_ ipaddress { *\.[0-9] *\.[0-9] *\)\..* /\1.3/g' ) dev keepalived0 d/keepalived. conf && network/ 90-keepalived. netdev &&
$(ip addr | grep 'inet ' | grep global | head -1 | sed 's/.*inet \([0-9]
}
}" >/etc/keepalive
echo "[NetDev]
Name=keepalived0
Kind=dummy" >/lib/systemd/
service systemd-networkd restart &&
service keepalived start
# There will be a new IP address x.y.z.3/32 added to keepalived0
ip addr
# Restart networkd. The IP address doesn't get destroyed like it did in the bug report
systemctl restart systemd-networkd
ip addr
# Restart keepalived. The IP address gets rebuild the same as before
systemctl restart keepalived
ip addr