Of Gateways and Metric Values

I recently diagnosed an interesting issue regarding the default gateway on my server.  I run several network adapters on my server, on different subnets, mostly for the purpose of separating virtual machine traffic from traffic native to the server itself.  After upgrade from Ubuntu Server 8.04 LTS to 10.04 LTS, I noticed several strange issues:

  • Using my VPN connection, I could connect to every machine on my network but the server
  • My postfix server (which relays server alert mails through gmail) stopped working
  • I couldn’t reach the Internet (I didn’t notice this because I use package-cache)

My first thought was to make sure that none of my networking related files changed (e.g., /etc/network/interfaces), but they weren’t touched during the upgrade.  I then followed some guides on the Internet related to network troubleshooting.  The route command, in particular, was of interest, however the output looked correct.  I had a route from the native network adapter to the Internet, through my gateway.  What’s more, I was able to ping my gateway.  But, just to be sure, I tried the following command, which adds a default route:

sudo route add default gw 192.168.1.1 eth-native

Lo and behold, everything worked and I was able to reach the Internet.  I re-ran the route command and I had a second route to my gateway, but this time, it had a metric of 0.  Metric, apparently, is used to determine the priority of each gateway, and accordingly which one to use as the default.  Prior to making the change, all of my subnets had a metric of 100.  Something must have changed between Ubuntu 8.04 and 10.04 to make this difference.

To make the fix permanent, I added metric 0 under my native network adapter in the /etc/network/interfaces file.

This entry was posted in Software and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>