Set OVH failover ip on a container with Netplan


(Alexandre Tremblay) #1

Hi,

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:

network:
 version: 2
 ethernets:
  eth0:
    dhcp4: no
    dhcp6: no
    addresses: [ip_failover/32]
    gateway4: host_gateway
    nameservers:
     search: []
     addresses: [1.1.1.1]

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

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


Configuring host and container network in 18.04
(Tom) #2

Hello,

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.


(Alexandre Tremblay) #3

Thank you, it worked.

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

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

   routes:
    - to: 0.0.0.0/0
      via: gateway
      on-link: true

Again, thank you for your help !


(Jon Clayton) #4

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