net-routing-setup revision a192e900f6d2b0e1a822e3252c0dfd795ed49d76
0N/A# The contents of this file are subject to the terms of the 0N/A# Common Development and Distribution License (the "License"). 0N/A# You may not use this file except in compliance with the License. 0N/A# See the License for the specific language governing permissions 0N/A# and limitations under the License. 0N/A# When distributing Covered Code, include this CDDL HEADER in each 0N/A# If applicable, add the following below this CDDL HEADER, with the 0N/A# fields enclosed by brackets "[]" replaced with your own identifying 0N/A# information: Portions Copyright [yyyy] [name of copyright owner] 0N/A# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 0N/A# Use is subject to license terms. 1879N/A# ident "%Z%%M% %I% %E% SMI" 1879N/A# This script configures IP routing. 0N/A# In a zone we need this service to be up, but all of the work 0N/A# it tries to do is irrelevant (and will actually lead to the service 0N/A# failing if we try to do it), so just bail out. 0N/A# by previous invokation of routeadm, we run routeadm -u here to get 0N/A# and apply legacy configuration. We also run "routeadm -u" when 0N/A# which need to be applied. It would be nice if we could do this in 0N/A# point in boot, we cannot. 0N/A# Are we routing dynamically? routeadm(1M) reports this in the 0N/A# "current" values of ipv4/6-routing - if either are true, we are running 0N/A# routing daemons (or at least they are enabled to run). 0N/A # Add a static route for multicast packets out of a link-local 0N/A # interface, although would like to specify multicast interface using 0N/A # an interface name! 0N/A print substr($2, 1, index($2, "/") - 1) 0N/A if [ -n
"$1" ];
then 0N/A echo "Setting default IPv6 interface for multicast:" \
0N/A "add net ff00::/8: gateway $1" 0N/A# configuration file. The file can contain the hostnames or IP 0N/A# addresses of one or more default routers. If hostnames are used, 1703N/A# because NIS and NIS+ are not running at the time that this script is 0N/A# run. Each router name or address is listed on a single line by 2252N/A# itself in the file. Anything else on that line after the router's 2252N/A# name or address is ignored. Lines that begin with "#" are 2252N/A# considered comments and ignored. 2252N/A# replace those added by the kernel during diskless booting. An 2252N/A# added by the kernel to be deleted. 2252N/A# Note that the default router file is ignored if we received routes 2252N/A# from a DHCP server. Our policy is to always trust DHCP over local 0N/A # We want the default router(s) listed in 0N/A # BOOTPARAMS WHOAMI response but we must avoid flushing 0N/A # the last route between the running system and its 0N/A # First, remember the original route. 0N/A # this, if one of the routes we add is for the route 0N/A # previously added as a result of the BOOTPARAMS 0N/A # response, we will see a message of the form: 0N/A # "add net default: gateway a.b.c.d: entry exists" 0N/A # Finally, delete the original default route unless it 0N/A # was also listed in the defaultrouter file. 0N/A# Use routeadm(1M) to configure forwarding and launch routing daemons 0N/A# for IPv4 and IPv6 based on preset values. These settings only apply 0N/A# to the global zone. For IPv4 dynamic routing, the system will default 0N/A# to disabled if a default route was previously added via BOOTP, DHCP, 0N/A # No default routes were setup by "route" command above. 0N/A # Check the kernel routing table for any other default 0N/A# has run "routeadm -e/-d ipv4-routing". If not, we revert to the 0N/A# appropriate defaults. We no longer run "routeadm -u" on every boot 0N/A# however, as persistent daemon state is now controlled by SMF. 0N/A # Set default value for ipv4-routing to enabled. If routeadm -e/-d 0N/A # has not yet been run by the administrator, we apply this default. 0N/A # Default router(s) have been found, so ipv4-routing default value 1703N/A # should be disabled. If routaedm -e/d has not yet been run by 0N/A # the administrator, we apply this default. 1703N/A# Set 6to4 Relay Router communication support policy and, if applicable, 1703N/A# setting and further info on ACCEPT6TO4RELAY and RELAY6TO4ADDR. 1703N/A# If ACCEPT6TO4RELAY=NO, the default value in the kernel will 0N/A echo "Adding persistent routes:"