Route internet traffic to isolated vm

2

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.

John wess

Posted 2013-06-20T21:00:39.610

Reputation: 63

Answers

1

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.

Ivaylo Petrov

Posted 2013-06-20T21:00:39.610

Reputation: 146

Ah, that was simpler than i expected. Was messing around with routing. But simply sharing the connection with the VLAN network and then setting the correct gateway in VM-2 was enough. Thanks! – John wess – 2013-06-21T04:14:19.173