Bridging and LXD became considerably easier a few years ago.
1. Set up the bridge in Netplan
In this example, the IP addresses are all set by the router (dhcp=true) merely to keep the example simple.
Code:
network:
version: 2
renderer: networkd
ethernets:
enp0s7: <---- Real-world name of the hardware interface
dhcp4: false <---- DON'T create a host IP address here. The host uses the Bridge IP address.
dhcp6: false
bridges:
br0: <---- LXD needs to know this name
interfaces: [enp0s7] <---- Matches the name of the real hardware interface above
dhcp4: true <---- This bridge IP address will be used by the host
dhcp6: true
2. Tell LXD to use the bridge by adding this to your LXD profile(s)
Code:
config: {}
devices:
eth0:
name: eth0 <----- Name inside the container. DON'T use the real-world interface name.
nictype: bridged
parent: br0 <----- Matches the actual real-world bridge name
type: nic
Bookmarks