Ubuntu: Network Bridge inside VM for LXD



Question:

I use ubuntu 16.04 in a kvm virtual machine. For lxd containers I try to make a network bridge, so the containers are available in our local network.

The interface file looks like this:

auto eth0  iface eth0 inet manual    auto br0  iface br0 inet dhcp     bridge-ifaces eth0     bridge-ports eth0     up ifconfig eth0 up     netmask 255.255.255.0     gateway 192.168.0.1     bridge_stp off     bridge_waitport 0     bridge_fd 0  

In the lxd init config I select the br0 interface. My lxd default profile has also the bridge selected.

When I setup now a new container, I don't get an IP for it.

brctl show gives this:

bridge name    bridge id            STP enabled      interfaces  br0            8000.5254008fde71    no               eth0                                                       vethCH64WJ  

How can I get this to work?


Solution:1

One way is to route the traffic, without using the network bridge:

ip route add 10.0.6.0/24 via 192.168.0.16 dev eth1  

A solution with network bridge is still welcome!

Another way is, to use a bridge interface on host (br0), not the kvm bridge. The containers get there IPs from the host.


Solution:2

This could be an emulation issue. You could try running:

dhclient eth0 -v

in the container and then checking out a related question for arm/qemu if you get an error message à la Error getting interfaces.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »