Operating System - Linux
1827238 Members
2305 Online
109716 Solutions
New Discussion

Re: How to create the specific route entry while the nework bootup?

 
SOLVED
Go to solution

How to create the specific route entry while the nework bootup?

Right yet I have to add the command in the end of /etc/init.d/network; Is there some conf file for setting? I found one file similar to this usage /etc/iproute2/rt_tables, however, I even can not found any tips for one route entry add.

Thanks
Frederick
5 REPLIES 5
Stuart Browne
Honored Contributor
Solution

Re: How to create the specific route entry while the nework bootup?

If you are using a RH box, try using '/etc/sysconfig/static-routes'.

Failing that, use something like /etc/rc.d/rc.local, tacking a route line onto the end ofit.

Otherwise, details! give us details! :)
One long-haired git at your service...
Mark Grant
Honored Contributor

Re: How to create the specific route entry while the nework bootup?

The unix way although, of course, it should still work in Red Hat is to put a "route add gw " command in the boot start up scripts after the network is up. However, if you use Red Hat, you are going to confuse sunsequent administrators if you don't do as Stuart has sugegsted above
Never preceed any demonstration with anything more predictive than "watch this"

Re: How to create the specific route entry while the nework bootup?

Dear both, however, there is no "/etc/sysconfig/static-route" available in my RH at all. version "Linux fw1 2.4.18-14". I even find all the system for the key word of "*static*" as well as "*route*", seems nothing useful likewise you said.

rgds
fredreick
Stuart Browne
Honored Contributor

Re: How to create the specific route entry while the nework bootup?

By default, the '/etc/sysconfig/static-routes' file isn't created upon an Install.

If you read the documentation in '/usr/share/doc/initscripts-6.95/sysconfig.txt', it will explain what the 'static-routes' file needs.

Simply put, you want a route to be added when a given interface comes up (eth0 for our example), add a line similar to:

eth0 net 10.1.1.0 netmask 255.255.255.0 gw 10.1.2.254

This states that it will add a network route for the 10.1.1.0/24 subnet via 10.1.2.254 host (standard routing stuff).

If you have any issues after that, give us specific details, and we'll help out as we can.
One long-haired git at your service...
Matthew Ausmus
Advisor

Re: How to create the specific route entry while the nework bootup?

Starting in RH8 and continuing on through Fedora Core versions, the static-route file has been replaced with files name route-ethx; x being whatever the adapter number is. The format of these files has also changed. Here is an example of a line from this file:
10.99.0.0/24 via 192.168.0.1

Once again, these files are not created by default but they are located in /etc/sysconfig/network-scripts just as the static-routes file was. Additional information on how to format the syntax in these can be found in the RH9 manuals online.
"What the gods get away with, the cows dont."