route after reboot

Hello,

I just added a route in solaris 10 system for host to use gateway.

I see that new route in the netstat command

Will this stay after reboot or I have to make any provision for this? Please let me know

Thanks

It wont stay that way you will have to add it to an onboot script. I dont know solaris so I cant help where to put it.

create a file /etc/defaultrouter and append the ip in here.

Thanks for the reply,

I already have the file on solaris10 machine with a default gateway IP in it. Actually machine for which route is being added is on same network as solaris10 machine but I want to route it through gateway, so could you please tell me what IPs should go in /etc/defaultrouter? 192.168.100.5 is already in file

I'm not sure what you mean. Router and gateway mean the same thing.
You already have one default route. Do you need to access another network. If so do this
modify the /etc/rc0

route add 192.168.1.0 192.168.1.1

http://www.unix.com/sun-solaris/79447-solaris-routing.html\#post302236983

There you go , this link is very useful, there is a specific file meant for this purpose and command on solaris 10 to make changes persistent.

Well sometimes (in same network) machines also need to be routed through the gateway only so that incoming and outgoing routes remain same for that machine for specific services. that's the kind of setup I have here.

Thanks Seg and others.

Or you can just add 2 ip's to the /etc/defaultrouter file ...

There can be only 1 default gateway.

No, there can be one for each network ....

That's not what 'default' means. You can set gateways for each network yes, but there can only be 1 default gateway.

Im not sure what you mean here ... you add multiple entries to the /etc/defaultrouter file and reboot, do a netstat -rn and you will see multiple default gateways ... You can also do a

route -f add default 10.1.0.1
route add default 10.2.0.1
route add default 10.3.0.1

etc .... to flush all curent routes and add 3 default gateways for the 3 interfaces on 3 subnets configured on my imaginary box...

This defines default gateways for each subnet that is configured on the box ...

root[bash]@imaginary# netstat -rn

Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ---------- ---------
127.0.0.1 127.0.0.01 UG 1 4504755
10.1.0.0 10.1.0.5 U 1 100 bge0
10.2.0.0 10.2.0.5 U 1 200 bge1
10.3.0.0 10.3.0.5 U 1 300 bge2
default 10.1.0.1 UG 1 500
default 10.2.0.1 UG 1 501
default 10.3.0.1 UG 1 502

You can also add multiple default gateways in on the same subnet in the same way, they will be used in a round robin manner ...