Use VPN from host in hyper-v VM

To access Team Foundation Server (TFS) we use a VPN. For a testing scenario I wanted a hyper-v VM to connect to TFS, here’s how I set this up without configuring a VPN inside the VM.

  • First make sure the VPN connection is started on the host before you start the hyper-v VM. I’ve read somewhere this was needed and it does work this way.
  • Use the virtual switch that is on the same adapter as the VPN. I’m only using the Wifi adapter. Below is a screenshot of the Virtual Switch Manager for the virtual switch I use in the VM’s settings.
  • For the proxy I’m using Fiddler. Awesome tool for web debugging, but also a proxy. Install this on the host. (not the VM) Check the option to allow remote computers to connect.
  • Now in the VM set the IE proxy. Start Internet Explorer, go to Internet Options > tab Connections and click on LAN settings, there set the proxy to the host machine name and port 8888 (default for fiddler)

Now the traffic from the hyper-v vm will go through the VPN of the host.

About erictummers

Working in a DevOps team is the best thing that happened to me. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Tooling and tagged , , . Bookmark the permalink.

3 Responses to Use VPN from host in hyper-v VM

  1. ExodusVI says:

    Pretty cool, I’ve been having to manually do this for a long time due to some issues with FreeBSD and legacy Linux. Its a pain in Windows as well but this is definitely somewhat different than what my series of steps were thank you

  2. ram says:

    Wow.. Simple and efficient! Saved me a few days of struggle.

  3. Johan says:

    I only managed to correct it by installing VPN within the VM, and not run VPN in host – sorted

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.