0

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

Its possible to make UCARP work with Netplan:

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

  ----- up -----
  #!/bin/sh
  exec 2>/dev/null

  /sbin/ip address add "$2"/32 dev "$1"

  ------- down -------
  #!/bin/sh
  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=10.0.215.26 --vhid=1 --addr=10.0.215.46 --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]
#Unit description. You can see this message when use "service ucarp status"
Description=Start UCARP as service
# Start after this:
After=syslog.target
After=network.target

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


[Install]
WantedBy=multi-user.target

And added to autostart

sudo systemctl enable ucarp
| improve this answer | |
1

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.

| improve this answer | |

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.