LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   permanent static routes on CentOS/Red Hat Enterprise Linux (http://www.linuxquestions.org/questions/linux-networking-3/permanent-static-routes-on-centos-red-hat-enterprise-linux-565828/)

whistl 07-01-2007 11:16 AM

permanent static routes on CentOS/Red Hat Enterprise Linux
 
I am building a few new CentOS 4.x servers, and they need two permanent host static routes to function properly. I've googled for "the proper" way to do this in RHEL4, but so far the only thing I can figure out is to put the route commands in /etc/rc.local. Red Hat's documentation mentions optional "route-ethN" files located in /etc/sysconfig/network-scripts, but I can't find any decent examples.

How do I configure the route-eth0 file to be the equivalent of the following commands? Is there a better way that I'm missing?

/sbin/route -host 10.30.1.232 gw 10.20.1.254
/sbin/route -host 10.30.1.233 gw 10.20.1.254

Lenard 07-01-2007 11:35 AM

See: http://www.linuxquestions.org/questi....php?p=2751595

whistl 07-03-2007 10:36 AM

nope
 
the method recommended in that article (/etc/sysconfig/static-routes) did not work on my CentOS 4.5 boxes. No error messages, no static routes. Perhaps that is old and only works with RHEL/CentOS 3.x?

I guess I'll just stick with route commands in /etc/rc.local for now. It works. I should probably leave good enough alone.

jrwsod 03-24-2009 12:24 PM

adding centos 5 static routes
 
The correct way to do this is to add a route-eth0 file in /etc/sysconfig/network-scripts/ (assuming you are using the eth0 interface) and add each of the following on a separate line ADDRESSx=x.x.x.x GATEWAYx=x.x.x.x and a NETMASKx=x.x.x.x

here is an example:

ADDRESS0=10.30.1.232
GATEWAY0=10.20.1.254
NETMASK0=255.255.255.255
ADDRESS1=10.30.1.233
GATEWAY1=10.20.1.254
NETMASK1=255.255.255.255

whistl 03-24-2009 12:30 PM

that works!
 
Thank you! That works!


All times are GMT -5. The time now is 07:37 AM.