Go to ...

RSS Feed

Hyper-V Virtual Machine – Use Host VPN Connection

When your Hyper-V host computer is connected to a VPN, virtual machines still use the host’s default connection. They are not connected to the VPN. This is often practical, in fact. Thus, for example, while VPN allows my host to use another geolocation, I can use a virtual machine on that same host for services that require my real location.

In the following screenshot, my host computer is connected to F-Secure Freedome VPN. It’s using a location in my native Finland, as the IP Lookup shows (blue highlight). At the same time, a Windows 10 virtual machine running on that host is still using the host’s default geolocation, my adopted home country of Germany (yellow highlight):

Click screenshots to view enlarged in a new tab.

This is the default setup, whatever VPN client you might use.

But, what if you need a VPN connection on your virtual machines? One solution is to buy an extra license, to install on a VM. Otherwise, If you are like me and make a wrong choice when buying a VPN, ending up with something like Freedome, you are in big trouble. The license allows Freedome to be installed on three devices. Unlike most of their rivals, Freedome does not offer an admin panel where you can manage your licenses, remove one from machine you want to reset or reinstall Windows, then add the freed license for that machine when done. When you contact their support, they simply tell you that moving license to another machine is not possible. This, licenses being not transferable, makes Freedome about as bad a choice as possible, especially for Windows Insiders like me who might clean and re-install several times a month. Think if other software licenses were like that: “If you reinstall Windows, you lose your license to our software“.

OK, enough ranting. So, what to do when you don’t want to spend money for a VPN client for VM, and cannot transfer your existing licenses? Simple: just set up your Hyper-V virtual machines to use the host’s VPN client and connection.

To start with, create an Internal Switch in the Hyper-V Virtual Switch Manager:

See Part Three of my Hyper-V tutorial on Ten Forums for detailed instructions on creating virtual switches.

Now, on the host, connect to a VPN. When a connection is established, open Network and Sharing Centre, and select Change adapter settings:

Right-click your VPN connection, select Properties, select the Sharing tab, enable sharing and select your Internal switch:

The only thing still missing is to set your VM to use the Internal switch in its VM settings:

That’s it. Checking the geolocation with IP Lookup on that VM now, you will see it uses the same geolocation as the host:

This technique is easy, fast and practical. It’s also cheap: you do not need a VPN client especially for your VM, when the host already has one!


Author: Kari Finn

A former Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.

Leave a Reply