I occasionally have trouble with an ubuntu VM I set up for testing developement work - it occasionally becomes inaccessible to ssh, can't connect to archive.ubuntu.com for updates, etc. It has two network interfaces, an external one with a public IP
eth0, and and internal one
eth1 with a 10.0.x.x IP for talking to other VMs in the hypervisor group.
I noted today after booting it and being unable to ssh in and
apt-get update (so I log in via the web console to debug), that when I try to ping example.com, it tries to do so via
eth1 (presumably because
eth0 has no connectivity, despite being
up according to
If I do a
traceroute it does go all the way to the datacenter.
sshd is verified to be running. VM firewall accepting traffic on port 22 for
eth0. Here's an extract from
-A INPUT -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT -A OUTPUT -s eth0 -p tcp -m tcp --sport 22 -j ACCEPT
What's really confusing is that the problem isn't deterministically reproducible. I can get a lucky boot and connectivity will work, but sometimes, without touching the settings, it doesn't. Any ideas on how to debug this?
Edit: extract from
/etc/network/interfaces - no dhcp. I'm terrible at networking, so I wanted to check: is there anything here that indicates weird routing preferences?
auto eth0 iface eth0 inet static address x.x.x.x netmask 255.255.255.128 broadcast x.x.x.127 network x.x.x.0 gateway x.x.x.1 auto eth1 iface eth1 inet static address 10.0.x.x netmask 255.255.255.128 broadcast 10.0.0.255 network 10.0.0.0 gateway 10.0.0.1
Should I add the following lines to
up route add x.x.x.1 dev eth0 up route add default gw x.x.x.1