A Linux Virtual Machine VPN Within Windows

In one set up, I am trying to run a virtual machine with Debian and have it's internet come through a VPN. All of this within a Windows 7 machine.

OpenVPN in the virtual machine does not want to connect. And I'm wondering what the best fix will be.

I want to be sure that all the traffic from the VM is through the VPN without windows having to traffic through the VPN as well.

Any help will be greatly appreciated.

That is one of my goals as well. To be able to boot up any VM, and have its traffic route through a VPN per the host. I'm thinking something with IP tables, but that is for Linux.

The only thing I can think of for you is reconfiguring your VM settings (passthrough the virtual NIC to your network or vice versa) and to keep on trying with openvpn in the guest. If you can pass through a physical nic you could use intermediary hardware to reroute like openwrt on a cheap mini router.

What hypervisor are you using? Hyper-V? VirtualBox?

Have you set up the network to use a bridged connection? The VPN may struggle if you have multiple-NAT on the VM.

If you use an NAT bridge, shouldn't this just work (tm)?

2 Likes

Should work. Just NAT the network to the VM

As long as the internet connection is set as "NAT" in the virtual machine settings, you shouldn't have any sort of issue as long as the host's traffic is being routed through a VPN.

I run a Ubuntu 16.10 with OpenVPN server. One nat rule and a firewall rule besides the OpenVPN server.

Works like charm, I can access my VPN subnet an the lan subnet.

The Ubuntu server is running in a hyper-v cluster.

I have been running a VM for this. Might not be able to help as my setup is Linux host. I've changed the host several times Ubuntu-Antergos-Fedora.

Virtualbox Linux guest that ubuntu 16.10, openvpn, bridged networking (under advanced, Promiscuous Mode setting to allow all) and its worked flawless for maybe a year or more. I have a SMB share on it so I can go into it from the host and pull / push files back and forth.

Ill try it on my duel boot Window 10. I dont have a Window 7 install outside a VM atm.