Networking Forums

Networking Forums > Computer Networking > Linux Networking > config. file to add a static route to on RHEL / CentOS.

Reply
Thread Tools Display Modes

config. file to add a static route to on RHEL / CentOS.

 
 
Rahul
Guest
Posts: n/a

 
      10-03-2010, 07:14 PM
I had added a static route using:

route add -net 172.16.0.0 netmask 255.255.0.0 dev eth3

But each time I reboot this route seems to disappear. Google seems to point
to a file "/etc/sysconfig/static_routes". But my CentOS / RHEL system
doesn't seem to have this file. Is there an alternative location where
static routes should be added to?

--
Rahul
 
Reply With Quote
 
 
 
 
Dale Dellutri
Guest
Posts: n/a

 
      10-04-2010, 12:54 AM
On Sun, 03 Oct 2010 23:05:23 +0200, jack <(E-Mail Removed)> wrote:
> Rahul wrote:
> > I had added a static route using:
> >
> > route add -net 172.16.0.0 netmask 255.255.0.0 dev eth3
> >
> > But each time I reboot this route seems to disappear. Google seems to point
> > to a file "/etc/sysconfig/static_routes". But my CentOS / RHEL system
> > doesn't seem to have this file. Is there an alternative location where
> > static routes should be added to?
> >


> Seems about the right location, my CentOS5 boxen have something in
> /etc/init.d/network that looks like


> # Add non interface-specific static-routes.
> if [ -f /etc/sysconfig/static-routes ]; then
> grep "^any" /etc/sysconfig/static-routes | while read ignore
> args ; do
> /sbin/route add -$args
> done
> fi


> In a default install the file doesn't exist, but if you create it (note
> that it is static-routes, not static_routes), with contents


> any -net 172.16.0.0 netmask 255.255.0.0 dev eth3


> it should pick it up. It looks like (once) one could put per-interface
> routes in there too, but I haven't seen any script that does that.


Per-interface routes are put in
/etc/sysconfig/network-scripts/route-eth<n>
with <n> replaced by 0, 1, and so on.

The format of the file is triplets such as:
GATEWAY0=<lan gateway IP address>
NETMASK0=255.255.255.0 <for example>
ADDRESS0=<wan net IP address>
and the next one uses GATEWAY1, NETMASK1, ADDRESS1 and so on.

--
Dale Dellutri <(E-Mail Removed)> (lose the Q's)
 
Reply With Quote
 
Rahul
Guest
Posts: n/a

 
      10-04-2010, 05:46 PM
jack <(E-Mail Removed)> wrote in news:kp7nn7-(E-Mail Removed):

> In a default install the file doesn't exist, but if you create it (note
> that it is static-routes, not static_routes), with contents
>
> any -net 172.16.0.0 netmask 255.255.0.0 dev eth3
>
>


Thanks! I added it there. I'll see if it works on the next reboot!

--
Rahul
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a

 
      10-06-2010, 03:27 PM
On Mon, 2010-10-04, Dale Dellutri wrote:
> On Sun, 03 Oct 2010 23:05:23 +0200, jack <(E-Mail Removed)> wrote:
>> Rahul wrote:
>> > I had added a static route using:
>> >
>> > route add -net 172.16.0.0 netmask 255.255.0.0 dev eth3
>> >
>> > But each time I reboot this route seems to disappear. Google seems to point
>> > to a file "/etc/sysconfig/static_routes". But my CentOS / RHEL system
>> > doesn't seem to have this file. Is there an alternative location where
>> > static routes should be added to?
>> >

>
>> Seems about the right location, my CentOS5 boxen have something in
>> /etc/init.d/network that looks like

>
>> # Add non interface-specific static-routes.
>> if [ -f /etc/sysconfig/static-routes ]; then
>> grep "^any" /etc/sysconfig/static-routes | while read ignore
>> args ; do
>> /sbin/route add -$args
>> done
>> fi

>
>> In a default install the file doesn't exist, but if you create it (note
>> that it is static-routes, not static_routes), with contents

>
>> any -net 172.16.0.0 netmask 255.255.0.0 dev eth3

>
>> it should pick it up. It looks like (once) one could put per-interface
>> routes in there too, but I haven't seen any script that does that.

>
> Per-interface routes are put in
> /etc/sysconfig/network-scripts/route-eth<n>
> with <n> replaced by 0, 1, and so on.
>
> The format of the file is triplets such as:
> GATEWAY0=<lan gateway IP address>
> NETMASK0=255.255.255.0 <for example>
> ADDRESS0=<wan net IP address>
> and the next one uses GATEWAY1, NETMASK1, ADDRESS1 and so on.


There should also be official documentation somewhere which describes
this in detail. If not, I suggest switching to e.g. Debian which has
detailed man pages for things like these (see interfaces(5) for
example).

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
Rahul
Guest
Posts: n/a

 
      10-06-2010, 08:20 PM
Jorgen Grahn <grahn+(E-Mail Removed)> wrote in
news:slrniap5be.dlt.grahn+(E-Mail Removed):

> There should also be official documentation somewhere which describes
> this in detail. If not, I suggest switching to e.g. Debian which has
> detailed man pages for things like these (see interfaces(5) for
> example).
>


I couldn't find much. Maybe I was using the wrong info / man keywords.


--
Rahul
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a

 
      10-07-2010, 07:55 AM
On Wed, 2010-10-06, Rahul wrote:
> Jorgen Grahn <grahn+(E-Mail Removed)> wrote in
> news:slrniap5be.dlt.grahn+(E-Mail Removed):
>
>> There should also be official documentation somewhere which describes
>> this in detail. If not, I suggest switching to e.g. Debian which has
>> detailed man pages for things like these (see interfaces(5) for
>> example).
>>

>
> I couldn't find much. Maybe I was using the wrong info / man keywords.


I have never done real sysadmin work on RHEL, but I get the feeling
they typically don't use man pages for things like this. I *hope* they
have a reference manual in HTML format somewhere, but I haven't really
looked for one.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
Rahul
Guest
Posts: n/a

 
      10-07-2010, 06:01 PM
Jorgen Grahn <grahn+(E-Mail Removed)> wrote in
news:slrniaqv7a.dlt.grahn+(E-Mail Removed):

> I have never done real sysadmin work on RHEL, but I get the feeling
> they typically don't use man pages for things like this. I *hope* they
> have a reference manual in HTML format somewhere, but I haven't really
> looked for one.
>


True. They do have a large online knowledgebase. I will look into that.

--
Rahul
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a

 
      10-07-2010, 07:37 PM
On Thu, 2010-10-07, Rahul wrote:
> Jorgen Grahn <grahn+(E-Mail Removed)> wrote in
> news:slrniaqv7a.dlt.grahn+(E-Mail Removed):
>
>> I have never done real sysadmin work on RHEL, but I get the feeling
>> they typically don't use man pages for things like this. I *hope* they
>> have a reference manual in HTML format somewhere, but I haven't really
>> looked for one.
>>

>
> True. They do have a large online knowledgebase. I will look into that.


"Knowledgebase" sounds to my ears like a cop-out when you can't be
bothered to produce a real reference manual, but it turns out they
*do* have a "deployment guide" which contains what you're looking for:

<http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Deployment_Guide/s1-networkscripts-interfaces.html>

Oddly, the manual says you shouldn't edit these files because their
user-friendly GUI config tools want to have them for themselves ...
but I suspect most people happily ignore that warning, and that tool.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Static Route to Access Modem Config? BigAl.NZ@gmail.com Windows Networking 6 07-19-2008 11:14 PM
Static Route to Access Modem Config? BigAl.NZ@gmail.com Wireless Internet 6 07-19-2008 11:14 PM
CentOS (RHEL) apache encoding Andy Linux Networking 1 02-24-2007 12:47 PM
config file for route tibo Linux Networking 3 07-16-2004 04:41 PM
How Do I Config Static Route Permanent On Fedora mpanlop Linux Networking 3 04-15-2004 03:03 PM



1 2 3 4 5 6 7 8 9 10 11