If I use Virtualbox to spin up a VM, I can select "bridged" as the network adapter type and this results in the guest/virtual NIC being connected to my physical LAN and hence getting a LAN IP from my router (via DHCP).
I want to achieve this same functionality, but instead of using Virtualbox, I want to use lxc/lxd containers.
How can I achieve this?
I'm running Ubuntu and I tried following this guide:
...but it doesn't help. Should the original host interface have an IP afterwards? Because it doesn't when I try the manual bridging.
If it helps, my lxd/lxc host is a Virtualbox virtual machine running Ubuntu, set up with bridged networking to my physical Ethernet NIC.
If I use tcpdump to monitor icmp traffic on the bridge interface, the physical/host interface and the container/virtual interface, only the container/virtual does not get any traffic. The other two do.
According to this guide:
I have no issues with my bridge setup.
Yet as mentioned in "Edit 3", the container interface is not getting any traffic. Need to work out why, but I'm not sure how to...
I have a feeling it has something to do with routes.
The container has no routes, whereas the host does.
Using tcpdump to monitor arp traffic, shows that arp traffic is actually getting to the container/virtual interface.
So it's just icmp traffic that isn't.
If I set a static IP in the container (via /etc/network/intefaces*), that allows me to ping the container from the host (which is a Virtualbox machine).
If I then change the network configuration in Virtualbox to allow promiscuous traffic, I can then ping the container from my physical machine (the host of the Virtualbox machine). Yet from here, I am still unable to ping beyond my physical LAN, from within the container.
The last step, if I manually add a "default" route in the container like so:
route add default gw 192.168.0.1 eth0
that allows me to ping outside of the physical LAN from inside the container.
So unless someone else can offer an explanation (I'll wait before posting an answer), I'm guessing the lack of container DHCP support (via bridging) has something to do with the fact that lxc/lxd is using netmasq to handle DHCP (and DNS).