Less known Solaris features - Persistant routes

When you work with the interesting features of Solaris, you forget about the small features in commands you use day by day. In my my IPMP tutorial i used an SMF script to make some host routes persistent … at foremost to show you that SMF scripts are really easy. But, well … this script isn’t nescessary because of the -p option of the route add command.
Using the -p command makes the route boot persistant:

jmoekamp@hivemind:~# route -p add -host -static
add host gateway
add persistent host gateway

At first the command tries to configure the route in the live system. When this step was successful, it makes the route boot persistant. You can check the routes already made persistant by using the route -p show command:

jmoekamp@hivemind:~# route -p show
persistent: route add -host -static</pre>
The routes are written into the <code>/etc/inet/static_routes</code> file:<br />
<pre><code>jmoekamp@hivemind:/etc/inet# cat static_routes 
# File generated by route(1M) - do not edit.
-host -static

Every line that isn’t empty or commented will be prepended with route add and executed at startup. The code responsible for this task is in the method script /lib/svc/method/net-routing-setup, which is used by the SMF service svc:/network/routing-setup. Deletion of a persitant routes is easy, too. Just use the route delete command with a -p:

jmoekamp@hivemind:/etc/inet# route -p delete  -host -static<br />
delete host gateway<br />
delete persistent host gateway