Help Configure Multiple Network Interfaces

interfacenetworkingroutingvirtualizationvpn

I'm running Ubuntu inside a VM on my work laptop. I have to run my VPN software on my VM Host system and need access to my VPN network from within my Ubuntu VM.

I can set my VM's network interface to NAT and this takes care of my VPN connectivity issues. I can reach any host inside my work interface via the NAT interface.

In addition to my VPN needs, I would like hots on my LAN to connect to my VM. For example, I want to run a NFS server on my VM that another host on my LAN wants to connect to. (Note — I don't want a remote VPN host to connect to my VM).

To allow this, I added a second Bridge network interface to my VM. This works fine and I can reach my VM from any other host on my LAN.

The problem with enabling both interfaces is that the NAT interface (VPN) is no longer used, so my VPN hosts becomes unreachable.

I've tried altering the VMWare settings so that the NAT interface is eth0 and Bridged interface is eth1 and vice-versa without any luck.

I assume I need to do something with my routing table to tell Ubuntu to route anything to 192.168.99.255 (my LAN) with ethX and everything else through ethY.

How do I set these rules up? Can I do this via the network connections gui?


Output of route -n is below.
192.168.99.0 is the bridged interface (LAN), .222.0 is the NAT interface.

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.99.1    0.0.0.0         UG    0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
192.168.99.0    0.0.0.0         255.255.255.0   U     1      0        0 eth0
192.168.222.0   0.0.0.0         255.255.255.0   U     1      0        0 eth1

Best Answer

In VMware Workstation goto Edit > Virtual Network Editor then click on VMnet8 which should be your NAT adapter.

Then click on NAT settings, this will bring up a menu that will tell you what your NAT adapter gateway is (you will need that).

Once you have that you will need to then add a static route for your VPN subnet like so:

route add -net 10.1.50.0 netmask 255.0.0.0 gw 192.168.222.2

The syntax is:

route add -net $WORK-NETWORK netmask $NETMASK gw $NAT-ADAPTER-GW

Both networks should now be reachable from the VM.

If you want to add the route so it persists upon reboot you will then need to edit /etc/network/interfaces and add

# static route
post-up route add -net 10.1.50.0 netmask 255.0.0.0 gw 192.168.222.2 dev eth1
Related Question