Set OVH failover ip on a container with Netplan


I’m fairly new to networking and LXD in general and I was trying to set a OVH failover ip to a container.
I was following this thread : link

Basically, when I use this command (from this comment) ip -4 addr add dev eth0 PUBLIC-IP/32 preferred_lft 0, it works just fine. However, I did understand that this method isn’t persistent.

So here’s my question: how do I make it persistent using Netplan ? I tried this, but it didn’t work:

 version: 2
    dhcp4: no
    dhcp6: no
    addresses: [ip_failover/32]
    gateway4: host_gateway
     search: []
     addresses: []

Using the host ip with the last byte as .254 ( as the host_gateway

So yeah, how could I assign the failover ip ?
Thank you


Please use this guide from Simos:

Generate a virtual MAC Address (Control Panel SoYouStart/OVH/Kimsufi.) and assign it to the container:
lxc config set CTNAME volatile.eth0.hwaddr MACADRESSHERE

And done.

Thank you, it worked.

Here’s something I changed tho to make it work:

Basically, in the netplan configuration, I added, at the end:

    - to:
      via: gateway
      on-link: true

Again, thank you for your help !

1 Like

Or just ditch netplan, its awful, and install ifupdown2. Requires a “netcfg/do_not_use_netplan=true” flag in /etc/default/grub

Do the container and the host have to be in the same range?
I tried your config and I still can’t make it work.
My host’s public IP is something like 47.xx.xx.82 and it has a DNS server (which is setup to allow requests from the container’s public IP by the way) and the public IP I want to use for the container is like 216.xx.xx.12.
I do have an lxd bridge profile that runs the other containers just fine through the local class 10.3.xx.xx. They communicate with each other and with the host and also have access to internet but I can’t figure out how to configure the network for that particular container that must be visible to the outside world with a public IP through the macvlan profile.
I passed the step of attaching the virtual Mac to the container after obtaining it from ovh panel but still nothing. The container has no internet access in both ways. What am I missing!
Any idea?