I have a network of test VMs whose traffic I need to go through another VM (in VMware). I figured the best solution would be to set the 'router' VM to have both a NAT and a host-only adapter and put the test VMs on a host-only network.
I changed /etc/network/interfaces on router VM:
...
auto vmnet8
iface vmnet8 inet static
address 10.10.10.15
gateway 10.10.10.2
broadcast 10.10.10.255
netmask 255.255.255.0
auto vmnet9
iface vmnet9 inet static
address 10.10.11.1
broadcast 10.10.11.255
netmask 255.255.255.0
And an example VM on the host-only network:
...
auto vmnet9
iface vmnet9 inet static
address 10.10.11.12
broadcast 10.10.11.255
netmask 255.255.255.0
gateway 10.10.11.1
I've also set /proc/sys/net/ipv4/ip_forward to 1 on the router VM
As of right now, the router VM has internet access and can talk to the other VMs but is not forwarding the traffic from the host-only network to the NAT connection.