Headline: VirtualBox host interface networking with wifi

I normally use vmware server to do alot of system testing, but this week, I'm setting up to visit my parents, and vmware decided it didn't want to work on my notebook. I'm guessing its due to vmware's rather woeful debian support, and that this is a somewhat ruft debian testing system.

VirtualBox? uses NAT out of the box, meaning that I can't connect to the virtual machine from my notebook (just the reverse) so I went out looking for HOWTO's...

And the best I found for my situation was the Ubuntu docoo.

A small tweak later - for debian's sake, and I get the following instructions resulting in two network interfaces on the VM - eth0 NAT'ed to get out to the world, and a host-host eth1 to enable me to get from my notebook to the VM.

Install parprouted

  • sudo apt-get install parprouted
create a vbox network startup script
  • sudo vi /etc/network/if-up.d/vbox_network
giving it the following (replacing $USER with the username that you run your virtualbox as, and $WIFI0 with the network interface you have (ath0 in my case, wlan0 for others etc))
sysctl net.ipv4.ip_forward=1
VBoxTunctl -b -u $USER
ifconfig tap0 up
ifconfig tap0 192.168.1.1
route add -net 192.168.1.0 dev tap0
parprouted $WIFI0 tap0
then make the script runnable by root
  • sudo chmod 700 /etc/network/if-up.d/vbox_network
run it to start the new network
  • sudo /etc/network/if-up.d/vbox_network
then change the virtual machine's configug to use your newly created tap0 interface
  • in the VirtualBox? Network cfg, add a second network adaptor (eth1, of type 'Host Interface' and set it to tap0)
Start the virtual machine,log in and then we can configure the vm's network
  • sudo vi /etc/network/interfaces
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
        address 192.168.1.2
        netmask 255.255.255.0
and restart networking on the vm
  • sudo /etc/init.d/networking restart

and tada, you have a secure VM that you can talk to only from your host system.