Solaris "Hidden feature": /etc/inet/static_routes
On our sites some of our machines have a nice init-Script called /etc/init.d/setroutes, that sets additional routes needed for correct operation. I always wondered why Sun obviously did not have such a feature built into the Solaris. I can't remember that we've spoken about this issue during the "Solaris 10 for experienced SysAdmins" seminar.
I recently had enough and wondered if there would be any /lib/svc/method that contained the route command. And sure enough, net-init closes with the following lines:
 
In other words: Create a file /etc/inet/static_routes, containing a route definition starting after the route add command. E.g. to add a network route, instead of using
 
This file came to my mind today after a colleague asked me today -- and two Sun Engineers afterwards.
  
  I recently had enough and wondered if there would be any /lib/svc/method that contained the route command. And sure enough, net-init closes with the following lines:
#
# Read /etc/inet/static_routes and add each route.
#
if [ -f /etc/inet/static_routes ]; then
        echo "Adding persistent routes:"
        /usr/bin/egrep -v "^(#|$)" /etc/inet/static_routes | while read line; do
                /usr/sbin/route add $line
        done
fi
In other words: Create a file /etc/inet/static_routes, containing a route definition starting after the route add command. E.g. to add a network route, instead of using
# route add -net 192.168.111.0 192.168.111.1open the part containing
-net 192.168.111.0 192.168.111.1to /etc/inet/static_routes. And you're set.
This file came to my mind today after a colleague asked me today -- and two Sun Engineers afterwards.
cptsalek - 23. Jul, 15:33
  
  



