I'm having a strange issue with a new Ubuntu server VM install in ESXi. With DHCP enabled in /etc/network/interfaces all network connectivity works fine. However, when i use a static route with the following parameters the routing table is wrong at startup:
auto lo
iface lo inet loopback
auto ens192
iface ens192 inet static
address 192.168.70.21/24
gateway 192.168.168.70.1
dns-nameservers 192.168.70.1
With the above in place, the machine can still reach all machines on the 192.168.70.0/24 network but not any other local network (there are many). A ping to any other local network would immediately return connect: Network is unreachable.
When i run route -n I get the following which is wrong:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.70.1 0.0.0.0 255.255.255.0 U 0 0 0 ens192
It should be this:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.70.1 0.0.0.0 UG 0 0 0 ens192
192.168.70.1 0.0.0.0 255.255.255.0 U 0 0 0 ens192
Even my /etc/resolve.conf isn't getting the nameserver (it has none). So to temporarily get around the problem, I added a route:
ip route add default via 192.168.70.1
Now the machine can access all other local networks allowed in pfsense (192.168.15.0/24, 192.168.38.0/24, etc), and they can reach it. But even with this work around i have to add google nameservers to reach the web.
I have another Ubuntu Server VM in ESXi on the same network and it works fine with just the /etc/network/interfaces parameters above (with different static IP). So I'm not sure what is going on with this fresh Ubuntu16.04 LTS server install.
I realize i can add a permanent route but that seems like a hack in this case because that wasn't required in the other Ubuntu VM with a static route. How do i correct this properly?