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 192.168.2.3 192.168.2.3 -static
add host 192.168.2.3: gateway 192.168.2.3
add persistent host 192.168.2.3: gateway 192.168.2.3

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 192.168.2.3 192.168.2.3 -static</pre>
</code></blockquote>
The routes are written into the <code>/etc/inet/static_routes</code> file:<br />
<blockquote>
<pre><code>jmoekamp@hivemind:/etc/inet# cat static_routes 
# File generated by route(1M) - do not edit.
-host 192.168.2.3 192.168.2.3 -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 192.168.2.3 192.168.2.3 -static<br />
delete host 192.168.2.3: gateway 192.168.2.3<br />
delete persistent host 192.168.2.3: gateway 192.168.2.3