Connecting to VirtualBox Virtual Machines via Hamachi
Here is the setup: We have one workstation running Windows 7. This
workstation has the
Hamachi proprietary
VPN software installed. Let's call this machine win7-host
.
On this workstation we have VirtualBox and
one Windows 7 virtual machine guest. This guest machine is intended
for incoming RDP connections; it should behave exactly like any other
machine on the network, except that it does not exist physically.
Let's call this machine win7-guest
.
There are two situations where people might connect to win7-guest
:
- They might connect within our network.
- They might connect remotely.
For local connectioms win7-guest
should look just like any other
computer, so I configured VirtualBox to use bridged networking. This
works well. (It also works for people connecting into our network via
site-to-site OpenVPN.)
What does not work well are remote connections via Hamachi. I
installed Hamachi inside win7-guest
and tried to join it to our
(paid) network. The guest joins the network and can see a listing of
other computers, but cannot connect in or out.
The following question on Super User provides much of the answer:
http://superuser.com/questions/316275/accessing-a-virtual-machine-over-hamachi-vpn
. The underlying problem is that both VirtualBox and Hamachi create
TAP adapters for their networking, and they fight -- in particular,
the Hamachi TAP adapter in win7-guest
does not work with the
VirtualBox TAP adapter.
I fiddled with a lot of different configurations until I stumbled across the following variation of the supplied answer:
- Uninstall Hamachi from
win7-guest
, but keep it onwin7-host
. - In VirtualBox, create a second network adapter for
win7-guest
. Make it a NAT adaptor (not bridged, not NAT-network). Bind it to the Hamachi interface ofwin7-host
. - In VirtualBox, create a NAT port forward rule from port 3456 to 3389.
Hamachi creates an IP address for each member of its network. Let's
pretend that address for win7-host
is 5.6.7.8
. Then from another
computer on the Hamachi network you can RDP to 5.6.7.8:3456
and
access win7-guest
via RDP.
This works because Hamachi is a full VPN program, and does not
restrict you to RDP. Thus one person can be working on win7-host
at
the console or via RDP, and a second person can use RDP to connect to
win7-guest
without kicking the first person off.