we know that new version of the Ubuntu fully support the Netplan. So I want to ask how can I use this feature with ucarp protocol (application). How can i integrate the Netplan with ucarp.If there isn't any solution, what are the alternative ways to use this feature. Thanks for your attention.i'm looking forward to your reply.

2 Answers 2


Its possible to make UCARP work with Netplan:

At first you should edit /usr/share/ucarp/vip-up and vip-down:

  ----- up -----
  exec 2>/dev/null
  /sbin/ip address add "$2"/32 dev "$1"

  ------- down -------
  exec 2>/dev/null
  /sbin/ip address del "$2"/32 dev "$1"

Next step is to configure ucarp:

/usr/sbin/ucarp --interface=ens160 --pass=YourPassw00rd --srcip= --vhid=1 --addr= --shutdown --preempt --advskew=0 --upscript=/usr/share/ucarp/vip-up --downscript=/usr/share/ucarp/vip-down

You can change --pass to use file with --passfile. Srcip - ip of your machine, addr - virtual ip of your cluster.

I just tried this and everything was ok. I disabled ethernet on master node and and switchover occurred after 2ms.

But there is one problem - UCARP is not a service, so you should create a unit for it.

nano /etc/systemd/system/ucarp.service

And fill it

#Unit description. You can see this message when use "service ucarp status"
Description=Start UCARP as service
# Start after this:

# Set type of service. Only oneshot works with exec lines with so much values. Look for Man page for instructions.
# Execute on start.
ExecStart=/usr/sbin/ucarp --interface=ens160 --pass=SuperPa$$w0rd --srcip= --vhid=1 --addr= --shutdown --preempt --advskew=0 --upscript=/usr/share/ucarp/vip-up --downscript=/usr/share/ucarp/vip-down -B
# Execute on stop.
# Execute on reboot.


And added to autostart

sudo systemctl enable ucarp

The ucarp package includes integration for ifupdown but not for netplan. It is on the list of packages that require updating, described at https://bugs.launchpad.net/ubuntu/+source/ucarp/+bug/1718227.

If you are using the networkd backend, you can implement the hooks yourself locally as described in networkd-dispatcher(8). Otherwise, you always have the option of falling back to using ifupdown instead of netplan to configure the network interface that you need to run ucarp on.

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.