Iptables – IPRouterEnable in Windows 7: how to redirect forwarded incoming traffic to VPN connection

iptablesvmware-esxvpnwindows 7

Wanted to move a bunch of VPN configs (including vpn-via-vpn-via-vpn scenarios) to existing Win7 installation under VMware. So the actual title is: "IPRouterEnable in virtualized Windows 7: how to redirect traffic, coming to VM, to VPN connection open at VM?"

There's a NAT configured at vmware, network 172.16.12.0, the experimental Win7 VM at 172.16.12.128 can connect to VPN, is available from host os and can run a proxy service available from outside.

Next, wanted it to route request;

  • set IPRouterEnable to 1, reboot'd, ipconfig /all shows that routing is enabled.
  • route add default gw 172.16.12.128 dev vmnet8
  • ping 172.16.12.128 was ok (no IP loop), and proxy is still available from outside

How can I tell Win7 to forward all incoming requests via established VPN connection? Or, is this a routing problem in host os (Linux)?

Best Answer

For this to work properly, you would need to use a Bridged Network interface with your vmware guest, in order to get the external traffic passed IN to your guest OS. The NAT is generally not a one-to-one NAT in vmware, thus inbound traffic that is not part of an established TCP session is dropped with nowhere to go.

You may possibly be able to achieve what you're trying to do with a combination of VMware networking options (Host Only + NAT) and iptables.

Here is a how-to for setting up your Linux host OS as a router for your vmware guests. You may be able to sufficiently modify it to allow external traffic to share one guest's VPN connection. http://www.cyberciti.biz/tips/setup-vmware-host-as-router-for-solaris-linux-freebsd-and-windows-xp-guest-os.html

These rules for sharing a Windows VPN connection using the windows Loopback Device, to a Linux host, might be applicable as well. http://www.big-bubbles.fluff.org/blogs/bubbles/archives/000524.html

Related Topic