Hi,
I’m new to LXC and trying to learn more about it, hoping someone can help guide me here. My questions are in bold, the rest is hopefully context if the questions aren’t clear enough.
How do I tell LXC to use a custom bridge ‘lxcontbr’ for all containers by default, is it achieved by simply changing the following line under /etc/lxc/default.conf ?
- FROM >>> lxc.net.0.link = lxcbr0
- TO >>> lxc.net.0.link = lxcontbr
If so, where/how do the following arguments fit into the picture under /etc/default/lxc-net ?
- USE_LXC_BRIDGE=”true”|”false”
- Does this simply disable default NAT, or does it disable the bridge device/networking entirely under LXC?
- LXC_BRIDGE_ARGS=“-b eno1”
- Does this bind the bridge to host NIC eno1?
- Does this need to be set if the NetPlan config is already binding my custom bridge to the NIC outside of LXC?
- LXC_BRIDGE=“lxcbr0”
- Why can this value also be set here?
Background:
My first learning project is to run a Kea DHCP server in an LXC container. This can’t sit behind a NAT bridge for obvious reasons, so I guess there are two options:
- Edit the behaviour of the default ‘lxcbr0’ bridge
- Remove the default lxcbr0 and make a bridge externally from LXC, then just point LXC at the new bridge.
Without being clear on if/how the first option can be done, I think I need to:
- Create a new Linux bridge (lxcontbr) and bind it to the host NIC
- Configure LXC such that any newly created container is added to that bridge, rather than lxcbr0 (which seems to be configured as a NAT/DHCP bridge via dnsmasq by default).
I’m using Ubuntu 24.04, and I’ve created the bridge ‘lxcontbr’ via NetPlan and bound it to a host NIC (which all works happily). I’m just a little stuck on my understanding with respect to some of the questions above.