Discussion Locked

Adding routes in Solaris - revisited

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I read a previous answer for this issue but it was for SCO.
In my case, I use "route add -net...-nostatic" to add a route but everytime we reboot the system they go away
how can I add them to the kernel so they get loaded at boot time?

11 replies

by ticoloco

It may be me or the system. I can't seem to
find the gateways file nor don't know how to
edit the rc file (don't know much of unix)

with netstat -r I get a destination, gateway
(our router), flags: UG
is there a possibility that our box is
reading the routes from our router (gateway)?

Elliott

by ryttinch

In order to do this, you will have to create a startup script. The standard way this is done in Solaris is as follows:

1. create the script in /etc/init.d
2. create a link to the script in /etc/rc?.d
(the ? is for the runtime that you want the script to start in).

ie.

you may create a script called routes in /etc/init.d that may look something like this:

#!/sbin/sh
# Add the route to network
route add -net ... -nostatic

and then in /etc/rc2.d you would run the following:

# ln /etc/init.d/routes S98routes

the S98 specifies that this is a start script, and that the priority is 98 (in other words, it will happen after the scripts that have a lower number.

This would add the routes whenever the system boots into boot level 2 or greater, which would be my guess as to where you would want the script.

I hope this helps,

Chad Rytting

by ryttinch

Solaris does use rdisc and rip to find routes. The flags when typing netstat -r are as follows:

G The route uses a gateway
U The interface to be used is up.
H Only a single host can be reached
through the route (ie the loopback address)
D This route is dynamically created. It
is set if the table entry has been
generated by a routing daemon like gated
or by an ICMP redirect message.
M This route is set if the table entry was
modified byan ICMP redirect
! The route is a reject route and
datagrams will be dropped

by lieane

If you're looking to add a default router address to the system here's what you can do:
1. Create a file using vi in /etc called: defaultrouter and enter the IP address of the default route.
2. Once done run the following:
route add default $(cat/etc/defaultrouter) 1

Just to check in worked use either netstat or ifconfig.

by lieane

If you're looking to add a default router address to the system here's what you can do:
1. Create a file using vi in /etc called: defaultrouter and enter the IP address of the default route.
2. Once done run the following:
route add default $(cat/etc/defaultrouter) 1

Just to check in worked use either netstat or ifconfig.

This discussion is closed to new replies.