LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How to save routing table entries? (https://www.linuxquestions.org/questions/linux-networking-3/how-to-save-routing-table-entries-95934/)

drgowans 09-23-2003 12:11 PM

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?

voltron1011 09-23-2003 01:08 PM

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.

drgowans 09-23-2003 01:21 PM

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?

voltron1011 09-23-2003 01:55 PM

The only other place that routes are stored on are in /etc/sysconfig/static-routes.

voltron1011 09-23-2003 01:56 PM

As I mentioned earlier, any changes made by the 'route add' command are lost on system reboot.

voltron1011 09-23-2003 02:16 PM

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.

drgowans 09-23-2003 02:35 PM

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?

bobyabraham 02-26-2019 06:16 PM

how to save routing table in oracle linux server 7
 
How do I save changes to the routing table in oracle linux

For example:

route add -net 10.5.0.0 netmask 255.255.0.0 gw 89.80.89.100 eno1

I add this to the table, magic happens, all is good. Then I reboot, and it goes away. after every rebooting i need to add routing table
how i save this table permanent


All times are GMT -5. The time now is 06:11 PM.