Breaking News
Loading...
Sunday, June 16, 2013

How to Setup Persistent Static Routes on Linux CentOS 6.4

8:06 AM
Static 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 : 1. 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@centos64 ~]# route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 dev eth0
[root@centos64 ~]# route add -net 172.13.1.0 netmask 255.255.0.0 gw 172.13.1.1 dev eth1
2. 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 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1
any -net 172.13.1.0 netmask 255.255.0.0 gw 172.13.1.1

2 comments:

  1. Very Good. Thanks Pro

    ReplyDelete
  2. Step 1 is fine, step 2 does not work, the link below does work.

    http://wingloon.com/2013/09/13/how-to-add-persistent-or-static-routes-to-centos-5-9-and-6-4/

    ReplyDelete

 
Toggle Footer