Default gateway ignored under RHEL / CentOS 5.3

On RHEL or CentOS 5.3 it is possible that a noticed default gateway is ignored. In this case the routing table doesn’t contain any appropriate entry…

# netstat -r|grep default

…even if the gateway was noticed both in the main network configuration…

# cat /etc/sysconfig/network
...
GATEWAY=10.24.36.1

…and interface configuration:

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
...
GATEWAY=10.24.36.1

To fix this issue it is necessary to add the following entry to a routing file:

# vi /etc/sysconfig/network-scripts/route-eth0
default via 10.24.36.1 dev eth0 onlink

After restarting the network the default gateway is used:

# service network restart
# netstat -r|grep default
default       10.24.36.1     0.0.0.0     UG    0 0     0 eth0

🙂

Sharing is caring

Leave a Reply