- Container is named "guest"
- Bridge is named
lbr0
- Bridged interfaces are
enp1s2
on the host andeth1
in the container - According to the docs, the host interface
enp1s2
is expected to be unconfigured before starting, but I'm not sure if that's a strict requirement.
Commands:
sudo ip link set up enp1s2
# Stopping the guest first probably isn't necessary, but I didn't test without it.
lxc stop guest
lxc network create lbr0 bridge.external_interfaces=enp1s2 ipv4.address=none ipv4.dhcp=false ipv4.nat=false ipv6.address=none ipv6.dhcp=false ipv6.nat=false
lxc network attach lbr0 guest eth1
lxc start guest
lxc exec guest -- /bin/bash
Then configure eth1 for DHCP in the container using whatever network configuration tools are present.
Alternatively:
I believe it's possible to modify the existing default bridge, lxdbr0
:
lxc network set lxdbr0 bridge.external_interfaces=enp1s2
lxc network set lxdbr0 ipv4.address=none
lxc network set lxdbr0 ipv4.dhcp=false
lxc network set lxdbr0 ipv4.nat=false
lxc network set lxdbr0 ipv6.address=none
lxc network set lxdbr0 ipv6.dhcp=false
lxc network set lxdbr0 ipv6.nat=false
according to my quick attempt, you cannot bridge configured network interfaces.. so be sure to drop those first