How to Configure Persistent Static Routes on Linux CentOS 6.2

In this post, i will share on how to configure persistent static routes on linux CentOS 6.2 server. By using Static routes, we can improves overall performance of the network. 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 the following condition should be follow :

1. The static route configuration should take effect immediately without rebooting.
2. The static route configuration should also apply after the next reboot.

READ  How to Install wget on Linux RHEL 6/7, CentOS 6/7, Oracle Linux 6/7

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

[root@centos62 ~]# route add -net <network> netmask <netmask> gw <gateway_ip> dev <interface>

Examples :

[root@centos62 ~]# route add -net netmask gw dev eth0
[root@centos62 ~]# route add -net netmask gw dev eth1
[root@centos62 ~]# route add -net netmask gw dev eth2

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

[root@centos62 ~]# vi /etc/sysconfig/static-routes

Add the followings :

any -net netmask gw
any -net netmask gw
any -net netmask gw
Leave a Reply

Your email address will not be published. Required fields are marked *

A world leading hosting company that provides fully-managed innovative and secure solutions, suitable for hosting small to medium-sized websites

Built on the best available technologies combined with Google Cloud for strong redundancy and application availability. Backed by skilled experts to address web security threats, a devops team to create advanced custom security solutions, and 24/7 sysadmins to watch over the platform. This powerful, hands-on approach makes your sites faster, safer, and easier to manage. Starting from only $3.95/mo.


* up to 30 days money back guarantee