How to Add Persistent Static Routes in CentOS 5.6

Share this Article :

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/

[[email protected] ~]# cd /etc/sysconfig/network-scripts/

2. Modify the original default route to your requirement.

[[email protected] network-scripts]# vi route-eth0
192.0.2.0/24 dev eth0 scope host
default via 192.0.2.1

Change to below :

192.0.2.0/24 dev eth0 scope host
default via 192.0.2.1
192.168.2.0/24 via 192.168.13.1 dev eth0

3. Restart the network to apply the new routing table

[[email protected] network-scripts]# service network restart
[[email protected] network-scripts]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     192.168.13.1    255.255.255.0   UG        0 0          0 eth0
192.0.2.0       0.0.0.0         255.255.255.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
0.0.0.0         0.0.0.0         0.0.0.0         U         0 0          0 eth0


Leave a Reply