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

sergiopereira picture sergiopereira · Sep 24, 2008 · Viewed 34k times · Source

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)

Answer

mattlant picture mattlant · Sep 24, 2008

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.