Right, it’s been a while since I’ve blogged about something useful (what with the move to Australia and all), so to start things off, here’s my experience with getting bridged networking for virtual machines to work over a wireless network.
First thing first, an overview diagram:
The aim here is to bridge the 2 vbox interfaces ("vbox0 and" "vbox1") with wlan0 (which hooks up to the router). In a wired ethernet scenario, you’d simply create a bridge between eth0, vbox0 and vbox1 and you’re done – but since that doesn’t work with wireless networks, you’d need a tool called "parprouted" to bridge between wlan0 and the vbox interfaces. Note because I have more than 1 vbox interface, I’m using a bridge ("br0") as the target interface for parprouted to "bridge" to.
Anyway, enough talk, here are the code to get it working (I assume your wlan0 interface is working at the moment):
# Creating the 2 vbox interfaces - replace "USER" with your own user name
VBoxAddIF vbox0 USER br0
VBoxAddIF vbox1 USER br0
# Create the bridge with the 2 vbox interfaces
brctl addbr br0
brctl addif br0 vbox0 vbox1
ifconfig vbox0 up # Just in case
ifconfig vbox1 up # Just in case
ifconfig br0 up
# Enable IP forwarding
# Proxy ARP to the VMs
# Create the "bridge" between wlan0 and br0
parprouted wlan0 br0
# Add the routes to the VMs - note you'll have to change the IP addresses if you use different IP address for the VMs
route add -net 192.168.1.200 netmask 255.255.255.255 metric 50 br0
route add -net 192.168.1.201 netmask 255.255.255.255 metric 50 br0
# Now run your virtual machine, attach it to vbox0 / vbox1, and assign either 192.168.1.200 or 192.168.1.201 to it.
Once you get this working, you can then package the above code into a script which you can call when doing ifup and ifdown – let me know if you are interested in that script :-) .
If you are interested in a more detailed explanation, this article should explain the process above in more details.