How add another interface to lxc container with static/public ip ovh

networking

(Ernesto Gamez) #1

Hi all,
I’m new to this forum and i recently installed lxc version 3.0.1 to move to linux containers virtualization.

I feel that is pretty easy to create and interact with the containers. But i feel a little bit frustrated when i try to add a static ip / public ip to the one linux container. I want to add it a part of the local ip assigned by the dhcp created on lxdbr0 bridge network.

My idea is to add public ips to my containers. is there a simple way like i’ve see on other posts:

lxc config device set om1 eth0 ipv4.address 10.99.10.42

This does not work for me.

And i do not know if is different the way to do it if the sistem is Ubunto 16.04 or 18.04

Thanks a lot


#2

Hi!

There is LXC and there is LXD. The commands that you show are for LXD, which is easier and better to use. The command to manage LXD is lxc which probably leads to some confusion.

To get your container to use a public IP address, you need to either set up a bridge on your host’s network interface, or use macvlan.
In both cases you can get the DHCP server of the LAN to give automatically an IP address. Or, if you wish, you can set up static IP addresses.

The issue with a VPS provider like OVH is that you should arrange earlier to get more than one public IP addresses. By default, you get a single public IP address. Therefore, do you have additional IP addresses from OVH?

(I am changing the category for this post from LXC to LXD).