Print this page
want to add link-local routes first


  67 # configuration file.  The file can contain the hostnames or IP
  68 # addresses of one or more default routers.  If hostnames are used,
  69 # each hostname must also be listed in the local "/etc/hosts" file
  70 # because NIS is not running at the time that this script is
  71 # run.  Each router name or address is listed on a single line by
  72 # itself in the file.  Anything else on that line after the router's
  73 # name or address is ignored.  Lines that begin with "#" are
  74 # considered comments and ignored.
  75 #
  76 # The default routes listed in the "/etc/defaultrouter" file will
  77 # replace those added by the kernel during diskless booting.  An
  78 # empty "/etc/defaultrouter" file will cause the default route
  79 # added by the kernel to be deleted.
  80 #
  81 # Note that the default router file is ignored if we received routes
  82 # from a DHCP server.  Our policy is to always trust DHCP over local
  83 # administration.
  84 #
  85 smf_netstrategy
  86 










  87 if [ "$_INIT_NET_STRATEGY" = "dhcp" ] && \
  88     [ -n "`/sbin/dhcpinfo Router`" ]; then
  89         defrouters=`/sbin/dhcpinfo Router`
  90 elif [ -f /etc/defaultrouter ]; then
  91         defrouters=`/usr/bin/grep -v \^\# /etc/defaultrouter | \
  92             /usr/bin/awk '{print $1}'`
  93         if [ -n "$defrouters" ]; then
  94                 #
  95                 # We want the default router(s) listed in
  96                 # /etc/defaultrouter to replace the one added from the
  97                 # BOOTPARAMS WHOAMI response but we must avoid flushing
  98                 # the last route between the running system and its
  99                 # /usr file system.
 100                 #
 101 
 102                 # First, remember the original route.
 103                 shift $#
 104                 set -- `/usr/bin/netstat -rn -f inet | \
 105                     /usr/bin/grep '^default'`
 106                 route_IP="$2"


 199                     >> /etc/inet/static_routes
 200         else
 201                 cp /etc/svc/volatile/etc/inet/static_routes \
 202                     /etc/inet/static_routes
 203         fi
 204         /usr/bin/rm /etc/svc/volatile/etc/inet/static_routes
 205         
 206 fi
 207 
 208 #
 209 # Read /etc/inet/static_routes and add each route.
 210 #
 211 if [ -f /etc/inet/static_routes ]; then
 212         echo "Adding persistent routes:"
 213         /usr/bin/egrep -v "^(#|$)" /etc/inet/static_routes | while read line; do
 214                 /usr/sbin/route add $line
 215         done
 216 fi
 217 
 218 #
 219 # Read /etc/inet/static_routes.vmadm and add each route.
 220 #
 221 if [ -f /etc/inet/static_routes.vmadm ]; then
 222         echo "Adding vmadm persistent routes:"
 223         /usr/bin/egrep -v "^(#|$)" /etc/inet/static_routes.vmadm | while read line; do
 224                 /usr/sbin/route add $line
 225         done
 226 fi
 227 
 228 #
 229 # Log the result
 230 #
 231 echo "Routing setup complete:"
 232 /usr/bin/netstat -rn
 233 
 234 # Clear exit status.
 235 exit $SMF_EXIT_OK


  67 # configuration file.  The file can contain the hostnames or IP
  68 # addresses of one or more default routers.  If hostnames are used,
  69 # each hostname must also be listed in the local "/etc/hosts" file
  70 # because NIS is not running at the time that this script is
  71 # run.  Each router name or address is listed on a single line by
  72 # itself in the file.  Anything else on that line after the router's
  73 # name or address is ignored.  Lines that begin with "#" are
  74 # considered comments and ignored.
  75 #
  76 # The default routes listed in the "/etc/defaultrouter" file will
  77 # replace those added by the kernel during diskless booting.  An
  78 # empty "/etc/defaultrouter" file will cause the default route
  79 # added by the kernel to be deleted.
  80 #
  81 # Note that the default router file is ignored if we received routes
  82 # from a DHCP server.  Our policy is to always trust DHCP over local
  83 # administration.
  84 #
  85 smf_netstrategy
  86 
  87 #
  88 # Read /etc/inet/static_routes.vmadm and add each route.
  89 #
  90 if [ -f /etc/inet/static_routes.vmadm ]; then
  91         echo "Adding vmadm persistent link-local routes:"
  92         /usr/bin/egrep -v "^(#|$)"  /etc/inet/static_routes.vmadm | /usr/bin/egrep -e "-interface " | while read line; do
  93                 /usr/sbin/route add $line
  94         done
  95 fi
  96 
  97 if [ "$_INIT_NET_STRATEGY" = "dhcp" ] && \
  98     [ -n "`/sbin/dhcpinfo Router`" ]; then
  99         defrouters=`/sbin/dhcpinfo Router`
 100 elif [ -f /etc/defaultrouter ]; then
 101         defrouters=`/usr/bin/grep -v \^\# /etc/defaultrouter | \
 102             /usr/bin/awk '{print $1}'`
 103         if [ -n "$defrouters" ]; then
 104                 #
 105                 # We want the default router(s) listed in
 106                 # /etc/defaultrouter to replace the one added from the
 107                 # BOOTPARAMS WHOAMI response but we must avoid flushing
 108                 # the last route between the running system and its
 109                 # /usr file system.
 110                 #
 111 
 112                 # First, remember the original route.
 113                 shift $#
 114                 set -- `/usr/bin/netstat -rn -f inet | \
 115                     /usr/bin/grep '^default'`
 116                 route_IP="$2"


 209                     >> /etc/inet/static_routes
 210         else
 211                 cp /etc/svc/volatile/etc/inet/static_routes \
 212                     /etc/inet/static_routes
 213         fi
 214         /usr/bin/rm /etc/svc/volatile/etc/inet/static_routes
 215         
 216 fi
 217 
 218 #
 219 # Read /etc/inet/static_routes and add each route.
 220 #
 221 if [ -f /etc/inet/static_routes ]; then
 222         echo "Adding persistent routes:"
 223         /usr/bin/egrep -v "^(#|$)" /etc/inet/static_routes | while read line; do
 224                 /usr/sbin/route add $line
 225         done
 226 fi
 227 
 228 #
 229 # Read /etc/inet/static_routes.vmadm and add each non-link-local route.
 230 #
 231 if [ -f /etc/inet/static_routes.vmadm ]; then
 232         echo "Adding vmadm persistent routes:"
 233         /usr/bin/egrep -v "^(#|$)" /etc/inet/static_routes.vmadm | /usr/bin/egrep -v -e "-interface " | while read line; do
 234                 /usr/sbin/route add $line
 235         done
 236 fi
 237 
 238 #
 239 # Log the result
 240 #
 241 echo "Routing setup complete:"
 242 /usr/bin/netstat -rn
 243 
 244 # Clear exit status.
 245 exit $SMF_EXIT_OK