RHEL 6, CENTOS6

Adding static route to RHEL-CENTOS-FEDORA

In RHEL/CENTOS/FEDORA you can add static route by applying route add command as other linux distributions, but if you want static permanaent route you can do it by modifying route-eth files..


path of file : /etc/sysconfig/network-scripts

modify route-eth0 or route-eth1 file on which ehternet interface you want to add route,

if file is not present create a file

# vi /etc/sysconfig/network-scripts/route-eth0

add following lines :

ADDRESS0=X.X.X.X
NETMASK0=X.X.X.X
GATEWAY0=X.X.X.X
example : 
ADDRESS0=192.168.1.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.2.1
IF YOU WANT MORE ROUTES TO BE ADDED, APPLY 1,2,3, ETC. INSTEAD OF 0