I am using VMWare work station. eth0 is set as NAT and eth1 is host-only.

I want to connect to a static network and internet but so far can only connect to static part.

Here is my network interfaces on /etc/network/interfaces:

eth0 auto
iface eth0 inet dhcp
eth1 auto
iface eth1 inet static

My ip route shows default is going through and ping to all VMs to that network works, but while pinging real networks like google.com it says hosts are unreachable.

How do I solve this?


The problem might be caused because of the default route of your Ubuntu. Your default route is currently your LAN (host-only) gateway which doesn't have any access to the internet. Your default route must point to your NAT network:

sudo route add default dev eth0
  • can it be made permanent in interfaces file? – Prodip Mitra Jan 6 '18 at 20:30
  • Yes, I've never tried this but apparently, you can use the post-up option in /etc/network/interfaces in order to force a specific default route. and make sure that another one doesn't become one. auto eth0 iface eth1 inet dhcp post-up route add default via [gateway-ip-address] dev eth0 auto eth1 iface eth1 inet static [...] post-up route del default dev eth1 Source: xmodulo.com/how-to-set-default-route-in-linux.html However, for this conf, you need to know your NAT gateway's IP (use Virtual Network Editor of VMWare). Keep me informed if it works – Kian Jan 6 '18 at 21:16

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.