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...

1# netstat -r|grep default

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

1# cat /etc/sysconfig/network
2...
3GATEWAY=10.24.36.1

...and interface configuration:

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

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

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

After restarting the network the default gateway is used:

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

🙂

Translations: