LXD. Configured networking as routed. But getting issue

Hey! So i’ve dedi and failover ip with mac address.

I’ve created LXC container and attached eth1 network to it in routed mode via

lxc config device add active-walleye eth2 nic nictype=routed parent=eno1 ipv4.address=91.xx.x.xx

While executing it im getting error like:

Error: Invalid expanded devices: Device validation failed for "eth2": Existing NIC "eth3" already uses "ipv4.gateway" in auto mode

On the host, the ip address is connected to the main network interface like:

auto eno1:2
iface eno1:2 inet static
address 91.xx.xx.xx

I wish to attach failover ip to a lxc container to be able not only connect it in via host, but via any other device outside host network.

What i’m missing or doing wrong?
Provider: OVH

You cannot add two routed NICs with the default ipv4.gateway=auto mode enabled as otherwise both NICs would add a default gateway which would cause connectivity issues.

You have to decided which one is to be used for the default gateway and disable it on the other one using ipv4.gateway=none see Instance configuration - LXD documentation

See also Trying to create multiple routed nic fails

Yeah, fixed that part.

But still, i can access it only from the host system.

I think you should instead just add multiple ips to a single routed nic by comma delimiting them .

So this is how i was trying

I have an additional IP address with a MAC address

91.xx.xx.xx - 02:xx:xx:xx:xx:xx

Next, I created a bridge with the primary IP

# Include files from /etc/network/interfaces.d:
# source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eno1
iface eno1 inet manual

auto br0
iface br0 inet static
bridge_ports eno1
address 162.xx.xx.xx
gateway 162.xx.xx.xx
netmask 255.xx.xx.xx
hwaddress ether d0:xx:xx:xx:xx:xx
bridge_stp off
bridge_waitport 0
bridge_fd 0

Afterwards, I tried to create a container and assign additional ones there. IP so that it can be accessed externally.

I had many attempts, I tried both routed, bridged, macvlan. These are the commands I tried

lxc config device add test eth1 nic nictype=routed parent=br0 ipv4.address=91.xx.xx.xx

lxc config device add test eth1 nic nictype=macvlan parent=br0 hwaddr=02:xx:xx:xx:xx:xx

lxc config device add test eth1 nic nictype=bridged parent=br0 ipv4.address=91.xx.xx.xx

But nothing worked, the maximum result was the IP responding to the ping from the hos.

So where is my config error? How to correctly assign an IP for the container so that I can join the container not only from under the host?

I have tried also without bridge network, but still got the same issue.

You can use a single routed NIC with multiple external IPs like this:

lxc config device add active-walleye eth0 nic nictype=routed parent=eno1 ipv4.address=91.xx.x.xx,91.xx.x.xn

But you’ve not really explained what a “failover IP” is or what you are trying to achieve, so I don’t know if that is correct. I’m not clear that the other existing routed NIC is for either.