VM share host's VPN connection

10

4

I am trying to get a (guest) VM running on my (host) machine to talk to a (remote) VM running God knows where on some server that is accessible via corporate VPN. I am able to SSH from the host to the remote machine and ping back and forth between host and remote machines while host is connected to the VPN. I am also able to ping remote machine from guest machine, and even SSH to it. But not vise versa - remote machine is unable to talk to the server running on guest. I have tried using both NAT and bridged network adapter settings on my VM, as well as messing with firewall settings on all 3 machines, up to turning it entirely off. What are your thoughts? Help would be greatly appreciated.

user3746504

Posted 2014-11-20T00:19:54.570

Reputation: 101

What kind of VPN are you using? And since I'm not great at VM, does the networking config bridge (or NAT to) the physical ethernet interface and not the internal logical VPN interface? – cpt_fink – 2014-11-20T00:45:24.927

Im using Cisco AnyConnect client. As for your other question - I honestly have no idea. I have a very limited understanding of virtualization. – user3746504 – 2014-11-20T00:51:08.780

Can you install the VPN client on the VM guest? – cpt_fink – 2014-11-20T04:16:33.907

Hypothetically - yes. But in order to do that Id need an installation package(?) or at least what ever information I need to set it up, which I naturally do not have. It seems like there should be an easier, more convenient way to share a VPN connection, especially since VMWare offers network adapter NAT setting. – user3746504 – 2014-11-20T06:12:58.023

Answers

7

If you don't have a VPN adapter (e.g. on a Windows PPTP client), it will not show up in the list as described by cpt_fink. This works for me, though:

  • establish VPN connection in the host
  • in virtual network editor, set VMnet8 (NAT) subnet to remote (VPN) subnet
  • in NAT settings, set gateway IP to host's VPN IP
  • in VM Settings, change network adapter to custom and select VMnet8

cdonner

Posted 2014-11-20T00:19:54.570

Reputation: 459

Looks like working (VMWare 9, OpenVPN), but traffic still flows around VPN, not through it. I think if you use VMWare NAT option, your NAT subnet is emulated for the guest OS and has no intersection with your real subnet. – ogurets – 2017-03-16T17:19:45.630

3

You can actually NAT guests to a VPN adapter. If the VPN adapter is configured for split-tunneling only traffic inside the secured network will work correctly.

The steps I used to do this in VMWare Workstation 10:

Shutdown VMW.

Enable your VPN connection.

Restart VMW. Apparently it only creates its list of network adapters on startup.

Change VMNet0 to bridge to the VPN connection via Edit|Virtual Network Editor and the 'Bridged to:' dropdown list.

Make sure your guest is NAT-ed.

Profit?

Be aware that if you disconnect the VPN while VMNet0 is bridged to it, VMNet0 will disappear as its external interface no longer exists and you will have to rebuild it manually via the Virtual Network Editor.

I extrapolated from here which is several versions old.

cpt_fink

Posted 2014-11-20T00:19:54.570

Reputation: 377