Technology and Software, Tips

Starting the VirtualBox interface at 192.168.56.1

I like to have some virtual machines arranged as I described in my post VirtualBox 4: NAT + Bridged Networking. To let them access the development servers I run on the host system I bind them to the VirtualBox network adapter vboxnet0 at 192.168.56.1. The problem is, this interface doesn’t exist until a VirtualBox’s VM starts and if I run one of those servers with Apache (as a proxy or a mod_php application) Apache won’t start. There is a little trick to start the interface even without running VirtualBox. This is for Linux:

VBoxManage list vms
sudo ifconfig vboxnet0 192.168.56.1

That VBoxManage command comes from here. You can hide it’s output with > /dev/null 2>&1

What it does is listing the virtual machines configured in VirtualBox but as a side effect it creates the network interface. No more tedious operations of running VirtualBox, starting a VM and closing it just to get the interface up!

Standard