Wednesday, June 18, 2008

ESX: Service Console and default route being lost!

This may seem very trivial.. and indeed it is, the saying "maybe a set of fresh eyes will help" is quite possibly a required procedure rather than a question... geek ego's may get in the way though. :p

Too many late nights and a never ending list of tasks to complete with ever shortening deadlines. This is what lead me to discover some interesting behaviour in ESX and quite possibly apparent in Linux/Unix distro's too..?

To configure a default route in an ESX Service Console (or on a RHEL based distro) is to add the gateway into the /etc/sysconfig/network file. GATEWAY=10.0.0.1

You can then run the command route which should give you an output with something similar to this:
default 10.0.0.1 0.0.0.0 UG 0 0 0 eth0

What I had, no gateway was being set, even though my network file was correctly configured. Manually running the route command was a temporary fix, though it was lost once a reboot or network service restart command was executed:
route add default gw 10.0.0.1
As it turned out, the route was being dropped because of a configuration mis-match in my interfaces file. In the case of my ESX server, the interface file: /etc/sysconfig/network-scripts/ifcfg-vswif0

The culprit was the line: NETWORK=192.168.0.0 when in fact it should of been configured as NETWORK=10.0.0.0

Thus the end to my default route not being set by the configuration of /etc/sysconfig/network

2 comments:

RogierG said...

Thanks, this has been bugging me for ages on one of my ESX servers!

Joseph said...

Add one more to the list, just got me out of a troubleshooting nightmere, service restored in 5 minutes thanks to this post.