-   Linux - Networking (
-   -   persistent static route (

ANU 04-27-2006 10:39 AM

persistent static route
what is the best, most reliable way in a solaris/unix to do a persistent or static route?
I need the system to remember this route after reboot.

route add -net x.x.x.x netmask 255.255.255.x gw x.x.x.x metric 1

For example, is there a file that I can simply put this in like in RH there was /etc/sysconfig/static-routes
i know that i can also write a script and put it in the rc.d dir so it runs after booting... are there some other way?

whysyn 04-27-2006 11:19 AM

Some *nix's have a conf file to set these in, but it usually is a shell-script kludge... ymmv. The one in RH is just a shell script that runs the route command with your arguments.

Personally, I think it's best to just put the route command into your "local" init scripts. (/etc/init.d/rc.local on Linux). You shouldn't have to write your whole own init script, there should already be a "local" file for running simple commands at boot time.

EDIT: clarification

ANU 04-27-2006 11:51 AM

thanks for your answer whysyn
i know its no big deal to write the commands in a files and put it in rc.d dir
im interested if there is some other way beside this one.
I would use a config file like /etc/sysconfig/static-routes but i dont know to exist one in Solaris 10 or maybe another program that does this static route stuff :D

whysyn 04-27-2006 12:17 PM

Sorry, I guess I read into your question incorrectly... =)

I don't know Solaris much myself, but I do know that the last SCO box I admined had to just have persistent routes in init scripts manually. If there is a more elegant solution on Solaris I don't know it.

The /etc/sysconfig/static-routes file in RedHat is used by a relatively simple shell script. If you have ten minutes and feel like tinkering a bit I imagine you could use the RH scripts on your Solaris box. If you want to try to adapt them but don't have access to a RH box any longer I'd be glad to link them up for you.

Good luck!

ehowstuff 02-22-2012 06:13 AM

Steps Change The Default Route or Gateway on Solaris :
1. Edit /etc/defaultrouter
-This configuration will apply after next reboot.

[root@SolarisServer ~]# vi /etc/defaultrouter

Proceed to change the ip to your preferred/new ip address of your gateway and save.

2. Run the following command to delete and add the default route.
-This will apply the configuration with immediate effect. Assume that the existing gateway will be change to

[root@SolarisServer ~]# route delete default
[root@SolarisServer ~]# route add default

How to Change The Default Route or Gateway on Solaris

jschiwal 04-01-2012 07:23 PM

Please don't resurrect ancient threads. The original poster most likely won't notice it to benefit. Also, it seems you posted this merely to spam your website (SEO). Please remove the advertisement from your signature.

All times are GMT -5. The time now is 01:45 AM.