-   Linux - Networking (
-   -   permanent static routes on CentOS/Red Hat Enterprise Linux (

whistl 07-01-2007 12:16 PM

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 gw
/sbin/route -host gw

Lenard 07-01-2007 12:35 PM


whistl 07-03-2007 11:36 AM

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 01: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:


whistl 03-24-2009 01:30 PM

that works!
Thank you! That works!

All times are GMT -5. The time now is 12:23 PM.