I have a lot of different Virtualbox VMs created that I use for testing different things. A while back I created a VM image to act as a PPPoE server (Debian squeeze guest running on a lenny host). For reasons that made sense to me at the time, I created VLANs on the guest operating system rather than on the host system (and attaching virtual network adaptors to the guest VM). I hadn't used this VM in several months until today; when I fired up the VM for some PPPoE testing. Unsurprisingly, the VM didn't have any network connectivity on boot. I figured it would probably take some finagling to get things working exactly the way they were working before. However the topology was correct, the switch set up properly, and still no PPPoE.
After several hours of screwing around with different VirtualBox versions, different combinations of host/guest VLAN configurations, etc. I identified the following behaviors:
- On a clean reboot of the host, the VLANs on the virtual machine work fine.
- As soon as I add a VLAN to the ethernet interface on the host, connectivity to the guest fails.
- If I remove the VLAN from the host, guest connectivity is restored.
- Add a bridge interface br0 to the host.
- Add ethernet adaptor eth0 to bridge br0.
- Add the host VLAN interfaces to bridge br0.
- Configure appropriate IP addressing for the host to br0.
- Attach the VirtualBox VM network interface to eth0.