How to Setup Persistent Static Routes on Linux CentOS 6.4

Share this Article :

linuxStatic routing is a type of method of network routing. Static routing is not actually a routing protocol but it’s just a manual configuration on the network route. This usualy managed by network system administrator. In Linux, static route can be added and delete using “route” command. But the drawback is when linux server is rebooted, it will forget the static routes configuration. To avoid network interruption on the linux server, you can configure static route to take effect immediately without rebooting and also should apply after the next reboot. Static Routes that apply after next reboot is called Persistent Static Routes. To achieve this on CentOS 6.4, the following steps should be perform :

Also Read :   How to Install, Configure and Use Linux Iptables Firewall on CentOS 6.2

1. To make configuration take effect immediately, run the following command :

[[email protected] ~]# route add -net <network> netmask <netmask> gw <gateway_ip> dev <interface>

Examples :

[[email protected] ~]# route add -net netmask gw dev eth0
[[email protected] ~]# route add -net netmask gw dev eth1

2. To apply the configuration on next reboot, configure the following in /etc/sysconfig/static-routes :

[[email protected] ~]# vi /etc/sysconfig/static-routes

Add the followings :

any -net netmask gw
any -net netmask gw

Leave a Reply