Add routes permanently to Solaris 10

routingsolaris-10

I need to add several static routes to a solaris 10 box. On Solaris 9, I've always made these persist across reboots by adding an init script to reapply the route. With solaris 10, adding a service to an SMF seems somewhat overkill. What is best practise on how to add a route that persists across reboot?

Best Answer

The route command has the -p option, in OpenSolaris and I believe Solaris 10 as well. From man route:

 -p             Make changes to the network route tables per-
                sistent across system restarts. The operation
                is applied  to  the  network  routing  tables
                first  and, if successful, is then applied to
                the list  of  saved  routes  used  at  system
                startup.  In determining whether an operation
                was successful, a failure to add a route that
                already  exists  or to delete a route that is
                not in the routing table is ignored. Particu-
                lar  care  should be taken when using host or
                network  names  in  persistent   routes,   as
                network-based  name  resolution  services are
                not available at the time routes are added at
                startup.

I believe it writes them to the /etc/inet/static_routes file if they are applied successfully.

Related Topic