How to route HyperV VMs traffic through host VPN

13,199

You must enable IPv4 forwarding on the host, which is OS-specific. Just Google it.

You also need to determine whether your hosts have a routing rule providing a default route through your host. It should exist, in which case you are all set. If it does not exist, you will have to do it by hand, and this too is OS-specific. But you can Google change default gateway in Windows/Mac OS/Linux/FreeBSD/whatever easily.

EDIT:

In order to enable IPv4 forwarding on your Windows host machine do the following:

1) Start Registry Editor (Regedit.exe).

2) In Registry Editor, locate the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

3) Set the following registry value:

 Value Name: IPEnableRouter
 Value type: REG_DWORD
 Value Data: 1

A value of 1 enables TCP/IP forwarding for all network connections that are installed and used by this computer.

4) Quit Registry Editor.

Now try pinging any IP address (8.8.8.8, for instance) from your guests, it should work.

Share:
13,199

Related videos on Youtube

Random
Author by

Random

Doing software stuff

Updated on September 18, 2022

Comments

  • Random
    Random over 1 year

    I'm using Windows 8.1 Pro with HyperV. I have several VMs for development, all of them connected with host via Internal adapter using network addresses:

    192.168.10.0/24
    

    Where:

    192.168.10.1 
    

    is my host's Hyper-V internal NIC address.

    When I'm not in my office I use 3G usb dongle an dialup VPN connection. I would like to route traffic from all existing and future VMs through the VPN. In best scenario traffic would be routed only partially to the local company network addresses

    10.1.1.0/24 
    

    I don't want to use sharing because I'm switching between WiFi, USB 3G dongle and VPN. Moving to other virtualization is also not an option for me.

  • Random
    Random over 10 years
    Can you be more specific please?
  • MariusMatutiae
    MariusMatutiae over 10 years
    @Random Edited my answer, it should work right away, if it doesn't write back.
  • Random
    Random over 10 years
    I've enabled IP routing some time ago but it still doesn't work.
  • Joshua
    Joshua over 10 years
    +1 for the reference to IP Forwarding. Another way to enable is start the "Routing and Remote Access" Windows Service.