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 (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. is the bridged interface (LAN), .222.0 is the NAT interface.

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 eth0     U     1000   0        0 eth0   U     1      0        0 eth0   U     1      0        0 eth1
  • I'd contact VMWare directly.
    – mdpc
    Jul 31 '13 at 16:28
  • Why? Isn't this a Ubuntu network manager configuration issue?
    – KZ.
    Jul 31 '13 at 16:30
  • What does the output of route -n look like with both adapters enabled?
    – bigbash
    Jul 31 '13 at 16:33
  • @bigbash I added the output to the original question. Code blocks don't seem to work in comments
    – KZ.
    Jul 31 '13 at 17:19
  • @KZ. Are you using VMware Workstation or VMware Player? Also, does your work VPN subnet overlap with your local LAN? ie both are 192.168.1.x I was able to reproduce your issue and fix it but I'll need those details first.
    – bigbash
    Jul 31 '13 at 18:12

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 netmask gw

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 netmask gw dev eth1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.