Route internet traffic to isolated vm

Posted on

QUESTION :

I got two VMs, i want VM-2 to be an isolated host, forced to route it’s traffic through VM-1. So for example if i use a VPN on VM-1 this will affect VM-2.

VM-1: 
Windows 7, 2 NICs
192.168.1.80 255.255.255.0 Bridged networking
192.168.50.2 255.255.255.0 VLAN1

VM-2: 
Debian 7, 1 NIC
192.168.50.3 255.255.255.0 VLAN1

Is this possible? Thanks in advance for any help.

ANSWER :

If you set VM-1 to share it’s internet and VM-2 to route all it’s traffic through VM-1 this should work. You can set this setting either with ip route or route command.

I guess this should be the configuration needed on VM-2:

ifconfig eth0 192.168.50.3/24 
route add default gw 192.168.50.2

Note: that as far as I remember, vmplayer/vmware workstation creates a few virtual network cards, one is for the host private network, one is for the nat network. If both VM-1 and VM-2 use host private network, they should be ok.

Leave a Reply

Your email address will not be published.