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
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.
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:
Thank you! That works!
|All times are GMT -5. The time now is 01:01 PM.|