LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-01-2007, 11:16 AM   #1
whistl
Member
 
Registered: May 2005
Location: USA
Distribution: Ubuntu, CentOS
Posts: 37

Rep: Reputation: 15
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
 
Old 07-01-2007, 11:35 AM   #2
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

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

Last edited by Lenard; 07-01-2007 at 11:47 AM.
 
Old 07-03-2007, 10:36 AM   #3
whistl
Member
 
Registered: May 2005
Location: USA
Distribution: Ubuntu, CentOS
Posts: 37

Original Poster
Rep: Reputation: 15
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.
 
Old 03-24-2009, 12:24 PM   #4
jrwsod
LQ Newbie
 
Registered: Mar 2009
Posts: 4

Rep: Reputation: 3
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
 
Old 03-24-2009, 12:30 PM   #5
whistl
Member
 
Registered: May 2005
Location: USA
Distribution: Ubuntu, CentOS
Posts: 37

Original Poster
Rep: Reputation: 15
that works!

Thank you! That works!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Red Hat to launch Red Hat Enterprise Linux 5 before March LXer Syndicated Linux News 0 12-30-2006 08:03 AM
How to create new permanent environment variable in Red hat Linux? halturata Linux - Newbie 2 04-10-2006 10:38 AM
Video4Linux On Red Hat Enterprise Linux 4 / CentOS 4 linux-rulz Linux - Hardware 1 04-14-2005 03:05 AM
Adding persistent(permanent) route entries on Red hat Linux 7.1 sram Linux - Networking 1 02-08-2002 10:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration