How to route all internet traffic from a Mac OS into a WIndows VM

3

1

I am currently using a Mac (OS Sierra) with Windows OS (Win7) running under Parallels.

When I work remotely, I have to connect to my company's VPN. Unfortunately the VPN software is only compatible with Windows. I still have my Windows VM running just to run the VPN and a couple of work software that only works in Windows.

My question is how can I route internet traffic in Mac OS into the Windows VM. I hope once I do that my Mac OS will also be under the work VPN as well.

I have tried tunnelling into the Windows VM (with the Windows VM running an SSH server) but certain ports will still not route correctly (like port 22).

Any ideas would be most helpful.

MechaStorm

Posted 2017-07-13T06:48:01.333

Reputation: 31

Answers

1

Download : https://www.virtualbox.org/wiki/Downloads for MAC

It is pretty simple to put the vms in an internal network and run a second NAT router in a vm connected to both networks. eg

Internet
|
gateway
192.168.1.1
|
LAN
192.168.1.x dg 192.168.1.1
|
192.168.1.254 dg 192.168.1.1
NAT
192.168.31.254 dg blank
|
192.168.31.x dg 192.168.31.254

where 192.168.1.0/24 is the physical network and 192.168.31.0/24 is the internal virtual network.

Please look at this https://unix.stackexchange.com/questions/212300/send-network-traffic-via-a-windows-vm-on-the-same-host-to-use-corporate-vpn

dExIT

Posted 2017-07-13T06:48:01.333

Reputation: 344

This doesn't explain how packets get from the MAC to a VPN tunnel coming out of a Windows VM. Is the Windows PC the VMNAT router in your scenario or is the VMNAT router pointing to the Windows PC for routing? If you make the default gateway for the MAC point to the VMNAT router how do packets get to the internet? – HackSlash – 2017-07-21T17:31:18.580

https://en.wikipedia.org/wiki/Routing_loop_problem – HackSlash – 2017-07-21T19:43:11.487

1

The answer you are looking for is to first enable Internet Connection Sharing on the Windows guest and then selectively route certain packets to the Windows host for routing.

FROM WINDOWS:

  1. Control Panel\Network and Internet\Network Connections
  2. Right Click the adapter (might be a NIC or a VPN)
  3. Sharing Tab
  4. Select the Allow Other Network Users to Connect through This Computer’s Internet Connection check box
  5. In the “Home networking connection” drop-down list, select the network adapter which connects to the host

FROM MAC

Now you have to choose the subnets that you want to send to the Windows PC for routing.

Here is the command to add a route:

/sbin/route add <SUBNET> -interface <INTERFACE>

Where SUBNET is declared in CIDR format to match the subnet of your corporate network. (EXAMPLE 192.168.0.0/16)

Where INTERFACE is the interface that leads to the Windows Guest.

IMPORTANT: Your home, corp, and VM subnets must all be different! You need to maintain your paths for your mac to get to the internet so that the tunnel can route from Windows through the VPN. You also don't want local traffic on your LAN to go through the tunnel. You really only want corporate traffic to go to the corporate network, in this case.

PEDANTIC ANSWER: You specified ALL traffic which would include the connection to the internet and the tunnel itself. I would refer to this as "pulling the rug out from under your own feet". Imagine that these computers are physical with a cable connected between each machine; From Windows, through Mac, to the internet. Then you unplug the cable from the mac to the internet and plug it in to Windows. Now you have a loop. Two interfaces connected between the same two computers with no path to the outside world.

HackSlash

Posted 2017-07-13T06:48:01.333

Reputation: 3 174