Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to share host VPN connection with VM instances in Hyper-V? [closed]

I'm running my workstation on Server 2008 and a few servers in Hyper-V VM's on that server. I connect to my corporate LAN using VPN from the main OS (the host) but my VM's aren't seeing the servers in the corporate LAN. Internet and local access to my home network work fine. Each of the VMs has one virtual network adapter.

What should I try to make it work?

Maybe I need to provide more details, please ask if needed.

More details:

  • cannot start multiple VPN connections
  • not using NAT through the host
  • VM gets IP address from the home network router (DHCP)
like image 628
sergiopereira Avatar asked Sep 23 '08 22:09

sergiopereira


People also ask

Does VPN work through a VM?

VPN always works system-wide, that means that all running applications automatically use the VPN connection. This has the advantage that you don't need to configure any applications in order to let them use the VPN.

How do I connect to a Hyper-V VM remotely?

Manage Hyper-V hosts remotely. To manage remote Hyper-V hosts, enable remote management on both the local computer and remote host. On Windows Server, open Server Manager >Local Server >Remote management and then click Allow remote connections to this computer.


2 Answers

Like I said you need to setup some routes. Add a route to your Corp LAN via your Host as the gateway. Just the fact alone you telling me that it gets it from home DHCPP tells me that is the issue. Your VM's only see 1 default gateway, and that is to the internet. The VM's have no idea whatsoever that the Host has a VPN on it. Adding that route (on VM machines) causes any requests that your VM's make to the subnet of your corp network to route through your host rather than the home router.

Adding something like this:

route ADD 10.0.0.0 MASK 255.0.0.0 192.168.1.30

on your VM'S would do this: Any requests made to the 10...* network would route through the computer with the IP address of 192.168.1.30. So replace the 10.0.0.0 and subnet with your corp lan, and the 192 ip with your hosts IP. That should take care of the issue.

like image 78
mattlant Avatar answered Sep 30 '22 16:09

mattlant


What type of VPN are you using? Ar you using the built-in windows VPN client, or do you have to install the client ?

You could just set up the VPN client independently on every VM, providing you are allowed multiple simultaneous connections.

I don't think that setting up routes would work because then you will also need to set up routes on your company network.

like image 22
zvikara Avatar answered Sep 30 '22 17:09

zvikara