Use bridge to LAN

lxd
networking

#1

Hello!

My host machine (Ubuntu Bionic) is connected to a LAN and receives its IPv4 configuration via DHCP. I want my LXD containers to be part of that same LAN using my companies DHCP server for configuration of the containers while keeping my host connected to the same network, too.

So far, I have failed to configure this not very uncommon scenario.

If I disable the IP configuration on the hosts interface (eno1), an create bridge using lxc network create I cannot tell it to issue a DHCP request to properly configure the bridge (and thus the host).

If I create a manual bridge in the OS (br0) and configure that using DHCP and then try to add a second bridge to eno1 via lxc network create, the OS bridge br0 immediately goes to a DOWN state, again kicking the host from the network.

The only thing I have managed so far is to use an external bridge and not configure a network in lxd.


#2

there is always the option of getting rid of netplan, install ifupdown (on your host of course), and setting macvlan for your container(s) and your host. Unless you love netplan, of course :slight_smile:


#3

I don’t even use netplan.
Is macvlan neccessary for my setting?


#4

to be candid, I don’t know, it’s just that usually people wanting to do what you want use macvlan. So it may be easier.
Netplan is only a problem if you want your host to be able to talk directly to the container with standard network operation (it’s a well known problem with macvlan, when you use it you have to declare your host network interface as a macvlan too else host and container can’t talk to each other, something many people dislike while some appreciate it)


#5

The easiest would be to use macvlan in LXD. Because you would not need to do any networking changes to the host, or the containers. The only downside is that the containers would not be able to connect by network to the host (for some it is good).

Alternatively you create a bridge on the host, which requires to set it up correctly. This is a networking issue for the host. Once you do that, then the containers do not need again any special configuration.

However, in both cases, you would need to create a LXD profile for either. For tutorials on this, search “LXD tutorials of simos” (sorry, am on mobile).


#6

Alternatively you create a bridge on the host, which requires to set it up correctly. This is a networking issue for the host. Once you do that, then the containers do not need again any special configuration.

You mean this link? That means a network not managed from LXD.

Thank you for your insight. But I still think its strange, that there is no solution within lxd for such a straightforward scenario.


#7

When you want to configure the containers to get their network settings from the LAN, you do not use a managed (by LXD) network. The premise of a managed network is that LXD is the one that will provide the networking configuration (DHCP lease, etc).
When the network is not managed, LXD gets out of the way and lets the container to get the configuration from the LAN.


#8

That makes sense, thank you.