LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 09-23-2003, 12:11 PM   #1
drgowans
LQ Newbie
 
Registered: Sep 2003
Location: Salt Lake City, Utah
Distribution: Red Hat 9
Posts: 22

Rep: Reputation: 15
How to save routing table entries?


I have looked at the networking how-to, the man pages, everything, but I can't seem to find the answer to this question.

How do I save changes to the routing table in redhat 9?

For example:

route add -net 10.5.0.0 netmask 255.255.0.0 gw 89.80.89.100

I add this to the table, magic happens, all is good. Then I reboot, and it goes away. I can't find documentation anywhere on how to make it stay. Could somebody clue me in?

The way most people talk, it should just be saved automatically. Is my installation messing up?
 
Old 09-23-2003, 01:08 PM   #2
voltron1011
Member
 
Registered: Aug 2003
Location: Tucson, AZ
Distribution: Red Hat 8
Posts: 62

Rep: Reputation: 15
Did you configure your gateway in /etc/sysconfig/network? This file contains your default gw information persistently. The way that you entered it is nonpersistently, which means it will go bye, bye on reboot.
 
Old 09-23-2003, 01:21 PM   #3
drgowans
LQ Newbie
 
Registered: Sep 2003
Location: Salt Lake City, Utah
Distribution: Red Hat 9
Posts: 22

Original Poster
Rep: Reputation: 15
Thanks for your help. However, nobody ever seems to just answer the question when I post this one. I think because it is a difficult question. If you must know, the gateway to that network isn't my default gateway. It is a little network in the back. The default gateway is to another net.

And I know, I could add a route to the main gateway to redirect to this other gateway, but I just want to do it at the Linux box, since it is the only machine connecting to this other network.

So,
Is there a way to add this route persistently so it will stick around? Is it a switch for route (like -p on Wondoze), or must I modify a file somewhere?
 
Old 09-23-2003, 01:55 PM   #4
voltron1011
Member
 
Registered: Aug 2003
Location: Tucson, AZ
Distribution: Red Hat 8
Posts: 62

Rep: Reputation: 15
The only other place that routes are stored on are in /etc/sysconfig/static-routes.
 
Old 09-23-2003, 01:56 PM   #5
voltron1011
Member
 
Registered: Aug 2003
Location: Tucson, AZ
Distribution: Red Hat 8
Posts: 62

Rep: Reputation: 15
As I mentioned earlier, any changes made by the 'route add' command are lost on system reboot.
 
Old 09-23-2003, 02:16 PM   #6
voltron1011
Member
 
Registered: Aug 2003
Location: Tucson, AZ
Distribution: Red Hat 8
Posts: 62

Rep: Reputation: 15
Some Linux versions don't have anything under /etc/sysconfig/static-routes, so you'll have to create the file using emacs or vi... Hope this helps.
 
Old 09-23-2003, 02:35 PM   #7
drgowans
LQ Newbie
 
Registered: Sep 2003
Location: Salt Lake City, Utah
Distribution: Red Hat 9
Posts: 22

Original Poster
Rep: Reputation: 15
Thanks much for your help. I looked through the

/etc/rc.d/init.d/network

script that is run on startup, and saw that it looked for that file. At first I was confused about the syntax. What it looks like is that the config file just does a 'route add -' and then appends any lines in the '/etc/sysconfig/static-routes' file that start with "any"

Example: A line like this in static-routes:

any host 10.5.1.5 gw 89.80.89.100

runs command:

route add -host 10.5.1.5 gw 89.80.89.100

It seems to work. Any better ideas?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
forced reconnect creates multiple ppp0 entries in snmp table vimico Linux - Networking 0 11-07-2005 05:01 AM
where to put routing entries jbako Linux - Networking 3 05-23-2005 07:14 AM
Adding entries to route table in C? kuronai Programming 2 04-04-2005 02:42 PM
filter /etc/messages for certain IP table entries don_wombat Linux - Software 0 12-14-2004 03:45 PM
Route table loses entries filth Linux - Networking 3 05-05-2003 05:27 PM


All times are GMT -5. The time now is 05:15 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration