The main creators of Virtualbox (Innotek, now Sun) have produced a very nice and useful tool indeed, be it a very stubborn minded one. Although Virtualbox is very usable, it does have some things left to be desired. For starters, the snapshot management is dreadful, as most users will agree. But hey, the tool is 'free', so no use complaining if we don't actively do something about improving the situation (like donating cash, code or bug reports). And a second quirk this tool has is that the networking configuration is a bit lacking here and there. The main thing missing is the option to use a host-local network. By that I mean a network internal to the host machine and in which the host machine also has an active virtual interface, with which it can communicate with client VMs. Such an interface is very useful because...
- You can use it to have the host do networking with the VMs without relying on any physical interfaces being present;
- It has no direct connections to any physical interfaces, so the traffic on it stays strictly local;
- The interface is also always up, so you do not rely on any wired or wireless interfaces to be up;
Luckily inspector Google and I found a solution within one minute flat, which is: Install a so-called 'TAP' interface. The procedure goes as follows:
- Download and install OpenVPN for Windows.
- After installation of OpenVPN, a so-called TAP interface should already be installed.
- Now rename the existing TAP interface to 'OpenVPN'. We won't otherwise touch this adapter, because we might want to use it with OpenVPN. If you won't be using OpenVPN, then you can skip the part below were you install a second TAP adapter. You do however need to do the configuration bit.
You can add a TAP interface in two ways: Either use the installed script at "start/program files/openvpn/Add a new TAP-Win32 virtual ethernet adapter" or do it manually. If you prefer the latter, then you do not even have to install OpenVPN. You can extract the driver from the installation package and use only that. If you prefer a manual install, this is how you would go about it:
- Open Control Panel and select Add Hardware
- Select 'Yes, I have already connected the hardware'
- Select 'Add a new hardware device'
- Select 'Manually select'
- Select 'Network adapters'
- Select 'Have disk'
- Browse to 'C:\Program Files\OpenVPN\driver' and select 'OemWin2k.inf'
- Select 'TAP-Win32 Adapter'
- Some messages may appear about driver signing. Ignore them.
You do not need to reboot in order to use the new interfaces. Removing a device can be done in Computer Management/Device Manager/Right-click-on-device/uninstall. Now configure the new TAP interface.
- Open the Network Connections window and look for the new adapter. It will be called something like 'Local Area Connection'.
- Rename the adapter to 'TAP'
- Open TAP's properties and browse to General/Adapter/Advanced
- Set the adapter's Media Status to 'Always Connected'. If we skip this, then the host machine won't be active on the TAP's network.
- Now configure the IP address and mask of the TAP adapter. NOTE: Use a range not in use by any of your other adapters. I spent bloody two hours trying to discover why my networks were not networking only to discover I forgot to disable two VMware network interfaces which were using the same range as I was using with the TAP interfaces.
Using the adapter in VirtualBox: When configuring an interface on a virtual machine, select 'Attached to: Host Interface' and the select the adapter called 'TAP-Win32 adapter V8 #2' from the list of adapters. And from here on it's business as usual.
That's it. Easy-peasy japaneezee.