How to Add Persistent Static Routes in CentOS 5.6

This example will show you on how to configure the persistent static route in CentOS 5.6 server. This configuration may different with other version of CentOS but the basic is almost the same. Persistent static route will permanently stored the setting and will not be deleted after rebooted.

1. Go to /etc/sysconfig/network-scripts/

[root@server ~]# cd /etc/sysconfig/network-scripts/

2. Modify the original default route to your requirement.

[root@server network-scripts]# vi route-eth0 dev eth0 scope host
default via

Change to below : dev eth0 scope host
default via via dev eth0

3. Restart the network to apply the new routing table

[root@server network-scripts]# service network restart
[root@server network-scripts]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface   UG        0 0          0 eth0   U         0 0          0 eth0     U         0 0          0 eth0         U         0 0          0 eth0

Leave a Comment