Wednesday, 4 March 2015

Static Routes

How to Add Persistent Static Routes on CentOS 6

 

 

his example will show you on how to configure the Persistent static route in RedHat Enterprise Linux 6 (RHEL 6) server. This configuration may different with other version of RHEL but the basic is almost the same. Persistent static route will permanently stored the setting and will not be deleted after rebooted. The following setting is just example only, you need to update the ip addresses and netmask in order to fit your environment :


To add a persistent static route in Redhat Enterprise Linux 6, create a file called route-X in the /etc/sysconfig/network-scripts/ directory. In this case, i will add persistent static route for eth0 and eth1.
1. Create a file route-eth0 rot eth0 routing :

[root@rhel6 ~]# vi /etc/sysconfig/network-scripts/route-eth0
 
ADDRESS0=192.168.1.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.1.1
2. Create a file route-eth1 rot eth1 routing :

[root@rhel6 ~]# vi /etc/sysconfig/network-scripts/route-eth1
 
ADDRESS1=192.168.2.0
NETMASK1=255.255.255.0
GATEWAY1=192.168.2.1
 
Display routing table :

[root@rhel6 ~]# netstat -rn

 

No comments:

Post a Comment