How to Add Persistent or Static Routes to CentOS 5.9 and 6
-
Upload
ralagarsan -
Category
Documents
-
view
223 -
download
8
description
Transcript of How to Add Persistent or Static Routes to CentOS 5.9 and 6
-
2/5/2015 HowToAddPersistentorStaticRoutestoCentOS5.9and6.4|WINGLOON
data:text/htmlcharset=utf8,%3Cheader%20class%3D%22entryheader%22%20style%3D%22boxsizing%3A%20borderbox%3B%20display%3A%20block% 1/2
HowToAddPersistentorStaticRoutestoCentOS5.9and6.4SEPTEMBER13,2013BYWINGLOON COMMENTSOFF
Inthishowto,IamgoingtosharehowtoaddpersistentorstaticroutesonCentOS5.9and6.4versions.Assumingthenetworkinformationbelowconfiguredontheserveritselfwithonenetworkinterfacecard,eth0:
Interface:eth0
IPAddress:172.16.0.1
Netmask:255.255.255.0
Gateway:172.16.0.254
Weneedtoaddtwostaticroutesbelowandtheseroutesdontroutetothedefaultrouteofeth0interface,172.16.0.254:
Interface:eth0
Address:192.168.1.0
Netmask:255.255.255.0
Gateway:172.16.0.11
Interface:eth0
Address:10.20.30.0
Netmask:255.255.255.0
Gateway:172.16.0.12
Hereishowwecandoitbycreatingthis/etc/sysconfig/networkscripts/routeeth0file.Youhavetwowaystodefinethecontent.IhadtestedonCentOS5.9and6.4versionanditworks.
Option1,includethebelowin/etc/sysconfig/networkscripts/routeeth0file:
GATEWAY0=172.16.0.11
NETMASK0=255.255.255.0
ADDRESS0=192.168.1.0
GATEWAY1=172.16.0.12
NETMASK1=255.255.255.0
ADDRESS1=10.20.30.0
Option2,includethebelowin/etc/sysconfig/networkscripts/routeeth0file:
-
2/5/2015 HowToAddPersistentorStaticRoutestoCentOS5.9and6.4|WINGLOON
data:text/htmlcharset=utf8,%3Cheader%20class%3D%22entryheader%22%20style%3D%22boxsizing%3A%20borderbox%3B%20display%3A%20block% 2/2
192.168.1.0/24via172.16.0.11deveth0
10.20.30.0/24via172.16.0.12deveth0
Youcanrestartthenetworkservicetohavethechangestotakeeffectusingthiscommand:
#servicenetworkrestart
Ifthereisnoerror,youcanverifytheroutesusingthiscommand:
#routen
or
#netstatrn
Yourrouteswillbeaddedautomaticallyaftereveryreboot.Pleasenotethatifyouneedtoaddroutestoeth1interfacethenyouneedtocreate/etc/sysconfig/networkscripts/routeeth1file.Hopethishelpsyou.Thankyou.