Using NAT with Hyper-V on your workstation

UPDATE 17/12/2015 - This workaround might be obsolete if running the latest Windows 10 builds! It’s still not as transparent as my hack (no DHCP capabilities), but we’re getting there. Have a look here.

I’ve been a supporter of VMware Workstation for years and still think it’s the best virtualization solution for the desktop. It’s the little things like not having to use Remote Desktop all the time to copy files to my virtual machines or the ability to use folders to organize my stuff (sounds trivial, but this is how that looks like).

Once in a while I feel the urge to play around with Hyper-V on my laptop but I never used it for more than a few days. One of the reasons being the lack of support for NAT. With Hyper-V you typically create two virtual switches: one for the wired connection and one for the wireless one. You then use these switches to connect your virtual machines to the internet. The problem with that is that I always have to change my VM to use the right switch, depending on the medium I’m working with at the moment.

Another problem is that those external virtual switches get their IP from the external DHCP server. If that happens to be a wireless connection that needs a password you see where that breaks down.

In VMware Workstation you’ve got a NAT service that works great. You connect your virtual machine to it and it then automatically finds out which network to use (wired or wireless) and shares your external IP to communicate with the outside world. Source-NAT for those who know what that means.

I’ve been searching for a way to mimic this behavior in Hyper-V but was unable to find a good solution. Until now that is. Granted, it’s still a bit messing around but it works. I’m pretty sure it’s not supported by Microsoft however 🙂

Step 1 - Install VMware Player

Go to the VMware website and download VMware Player. Install Player on your machine. If that doesn’t work because you already have Hyper-V installed, you have to boot your pc with Hyper-V disabled. Scott Hanselman recently published a nice blog on how to do that. If VMware Player is installed, you have these Windows services:

Windows Services

Additionally, it installs the following virtual network connections on your host:

Network Connections

VMnet8 is the network adapter connected to the NAT service. Reboot your pc to enable Hyper-V again.

Step 2 - Configure Hyper-V

In your virtual switch manager, create an external network switch and connect that to the VMnet8 network connection:

Virtual Switches

That’s it. Connect a virtual machine to that network and you’ve got internet – whether you’re on a wired or a wireless connection. No more switching virtual networks anymore.

Virtual Switches

Step 3 – Configure NAT & DHCP (Optional)

If you want to change the network range or any options, you can find the necessary configuration files in the following directory:


VMware DHCP Configuration

Just edit vmnetdhcp.conf & vmnetnat.conf to suit your needs.

** Thanks to Steven Van de Craen & Oliver Wirkus for urging me to write this post