Hey guys,
I needed to add a route to my routing table and I got it to work but on reboot it gets removed. Anyone know what file I can add this route to so it stays on the machine after a reboot?
Hey guys,
I needed to add a route to my routing table and I got it to work but on reboot it gets removed. Anyone know what file I can add this route to so it stays on the machine after a reboot?
Create a startup script that contains your command in /etc/init.d then create a symbolic link to the file in /etc/rc2.d.
It's best to create a separate file so if you apply a patch that modifies an existing script, you don't lose your custom mod.
Carl
Put the command in /etc/rc.local file.
This is not a good solution, try to find appropriate config file, e.g. http://www.cyberciti.biz/nixcraft/vivek/blogger/2006/04/configuring-static-routes-in-debian-or.php
As far as I know, such files do not exist on, for instance, Solaris systems. So, in these cases, you have to write your own rc scripts as said above. ![]()
Yea, I'm a Solaris admin so I tend to immediately think in my terms when answering questions. Of course there are alternate methods to make the necessary changes 
Carl
Yea, I'm using Solaris 9... I'll have to check out the rc file.. thanks guys.
Yep, that did the trick.
I guess I'll put what I did in here just incase someone else needs it some other time.
in /etc/rc3.d/
I created a file called S99addroute (why S99 it was with the naming convention with the other files soooo you can probably just make a file called addroute and it should work)
-rwxr--r-- 1 root sys 244 Oct 6 09:31 S99addroute (make sure perms are same as other files)
(inside file)
#!/sbin/sh
ifconfig hme0:1 plumb
ifconfig hme0:1 172.28.66.10 netmask 255.255.255.252 broadcast 172.28.66.11
ifconfig hme0:1 up
route add 10.192.0.0/10 172.28.66.9
I changed the ip's around so they aren't mine, but you get the idea... if anyone thinks the script can be improved or start it in a different rc dir let me know this is kinda new to me.
Ok, two things.
First, Solaris goes into the rc directories upon startup and shutdown and runs the scripts in the rc directory. On startup, all scripts that begin with 'S' are run in order. Shutdown runs the scripts that begin with 'K'.
So the script must start with an S or K depending on when you want the script to run. The numbers ensure the scripts are executed in the proper order. That the network is started before the web server or mail daemon for example. If you have a necessary route, I would think (I haven't tried this) that it would need to be run after the interface is set up and active.
Second, it is convention and highly suggested that you put the addroute script in the /etc/init.d directory. Then use ln -s to link the S script in the rc2.d or rc3.d directories
# ln -s ../init.d/addroute S99addroute
Generally when I'm checking the system for startup files, I'll check the /etc/init.d directory first since each of the scripts in the rc.d directories should link to a script that exists in /etc/init.d. It's a centralized repository of the startup scripts. Otherwise I have to go into each of the rc directories (not like there's 200 of them or anything) and search.
Hope this helps.
Carl
Oh and you shouldn't need to configure your interface in your script. It should already be up if there's a /etc/hostname.hme0 file. This file tells the startup scripts to initialize the hme0 interface with information in the other files (netmask, hosts, etc).
Carl