Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto adding of routes on bootup

Status
Not open for further replies.

gfunk123

IS-IT--Management
May 22, 2001
143
GB
I need to run a command so that a specific route is added to the routing table if the machine is rebooted.

I have been advised that i should create a file in the /etc/rc2.d folder with the 'add route ' command in there

but how do i make it run just after the network services are started on bootup - i am running solaris 2.6

any help would be greatly appreciated

thanks
 
Take a look at /etc/rc2.d/S69inet

You are able to add a default route there, and this should be picked up on reboot. HTH.
 
Hi..
you have to add the route add command with proper syntax in /etc/rc2.d/S72inetsvc file to keep the route statement permanent.



thanks
Praful
 
That's right - ignore my previous post, I was in dreamland. You should also probably add it to /etc/defaultrouter. Cheers.
 
Thanks guys, so let me get this right. I need to add a line to the bottom of both S69inet and S72inetsvc that goes as follows

# DEST NET GATEWAY

route add -net 172.19.12.0 172.19.11.5

 


Follow the steps below.

----------------
# cd /etc
# vi defaultrouter

172.19.11.5

:wq!

-------------

# route -f
# netstat -nr and see if the default router is there.

I guess the easiest way is this. Good luck
 
The thing is , its not my default router, its just a router to access purely for the 172.19.12.0 network. I am presuming that the defaultrouter file is for precisely that (the default gateway). Do I need to add all gateways in there.or do i need to add just the 'route add' command to the two files in rc2.d folder listed above

cheers
 
Ahh, I see. I suggest creating your own file in /etc/rc2.d called something like S99routeadd and containing one line consisting of route add <IP address>

This will be picked up on reboot and should give you what you require. Cheers.
 
/etc/gateway is the file where you add your passive routers.
 
Might be a good idea to create a file, say /etc/routes and enter your routes here. Then have script, sat S99addroues add routes from the file. Makes future changes easier and prevents boot problems if you make editting mistakes.
I believe Solaris 9 & later versions of Solaris 8 may use this model with the gateways file, I am still trying to find info on this.

Ged Jones

Top man
 
You want to add a static router, right?

Edit the file /etc/init.d/inetinit, at the bottom add:

route add -net 172.19.12.0 -netmask 255.255.255.0 172.19.11.5

so it will automatically be added when system restarts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top