Persistent static routes in Solaris 10 11/06, 08/07

Static routes are a very common necessity once your networks become even a little complex. Whether you need to route specific traffic over a VPN or setup specific test addresses for IPMP failover, static routes are indispensable.

For many years the “correct” way of configuring static routes in Solaris has been to create an init.d script which ran the ‘route add’ commands.

As of Solaris 10 11/06, a more reasonable approach has been implemented. The ‘route’ command has a new option ‘-p’.

Make changes to the network route tables persistent 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. Particular 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.

Now you may be asking “Where is my configuration file?” The route command currently stores your static routes in the file /etc/inet/static_routes but this has been declared volatile. Sun is not promising to keep these configurations in that file or in the same format from release to release.

I personally am not happy with Sun’s general move to administrative utilities for configuration as opposed to configuration files. I agree that utilities are useful. They ensure correct syntax, etc. but I want the ability to configure a system on the file system level as well. Otherwise I loose the ability to keep a system’s configuration files in version control. I loose the ability to deploy a system by transferring the appropriate files (ala scp, cfengine, puppet, home grown script, etc.) I prefer something along the lines of crontab where the syntax is checked but the configuration itself is a file in userspace.

Still, a standard method for configuring static routes is welcome in place of creating init scripts, especially with SMF services phasing out init scripts altogether.

Be Sociable, Share!
  • Twitter
  • Facebook
  • email
  • LinkedIn
  • HackerNews
  • Reddit

3 comments for “Persistent static routes in Solaris 10 11/06, 08/07

  1. marcus.chase
    April 20, 2009 at 2:11 pm

    thanks for info yonah. I am new to solaris 10 and some things are taking me by surprise… we had to reboot our server today and it came up with a pack of extraneous routes killing most traffic. Will make use of -p as you mentioned.

  2. Harry
    June 24, 2009 at 12:38 pm

    Thank you for the concise explanation – seems to work fine.

    What happens if the additional route is not available upon boot up ? Can I add routes today that won't exist until next week ? ( this implies that the routes can be added but won't be "permanent" ).

  3. me
    August 2, 2009 at 12:05 pm

    Harry-
    You are exactly correct. You could always create a route using 'route add …' but it would only remain valid until the next reboot. With the '-p' flag the route will be permanent.

Leave a Reply

Your email address will not be published.