Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
share|improve this question
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

1 Answer 1

up vote 1 down vote accepted

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
share|improve this answer
Thanks @bigbash! –  KZ. Jul 31 '13 at 20:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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