Three Ways to Configure Persistent Static Routes on Linux CentOS

Share this Article :

centos6There are several different ways to configure persistent static routes on Linux CentOS. By using Static routes, we can improves overall performance of the network and static routing is achieved by manually adding routes to the routing table. Static route can be added and delete using “route” command. But it will forget the static routes configuration when server rebooted. This will lead to the network interruption. Follow one of these three options to configure static route on CentOS.

Also Read :   How to Creates the /etc/httpd/passwords File and Configures a Password for Apache User?

1. Edit the file /etc/sysconfig/network-scripts/route- and then add the following lines :

[[email protected] ~]# vi /etc/sysconfig/network-scripts/route-eth0

GATEWAY0=<gateway address>
NETMASK0=<network netmask>
ADDRESS0=<network address>
GATEWAY1=<gateway address>
NETMASK1=<network netmask>
ADDRESS1=<network address>

Examples :


2. Edit the file /etc/sysconfig/network-scripts/route- and then add the following lines : via dev eth0 via dev eth0

3. Edit the file /etc/sysconfig/static-routes as below :

any -net netmask gw
any -net netmask gw

Leave a Reply