defaultroute revision 25916
125184Sjkh#!/bin/sh - 225184Sjkh# 325916Sjkh# $Id: rc.network,v 1.7 1997/05/13 08:22:27 jkh Exp $ 425184Sjkh# From: @(#)netstart 5.9 (Berkeley) 3/30/91 525184Sjkh 625184Sjkh# Note that almost all the user-configurable behavior is no longer in 725184Sjkh# this file, but rather in /etc/rc.conf. Please check that file 825184Sjkh# first before contemplating any changes here. If you do need to change 925184Sjkh# this file for some reason, we would like to know about it. 1025184Sjkh 1125184Sjkh# First pass startup stuff. 1225184Sjkh 1325184Sjkhnetwork_pass1() { 1425184Sjkh echo -n 'Doing initial network setup:' 1525184Sjkh # Set the host name if it is not already set 1625184Sjkh if [ -z "`hostname -s`" ] ; then 1725184Sjkh hostname $hostname 1825184Sjkh echo -n ' hostname' 1925184Sjkh fi 2025184Sjkh 2125184Sjkh # Set the domainname if we're using NIS 2225184Sjkh if [ -n "$nisdomainname" -a "x$nisdomainname" != "xNO" ] ; then 2325184Sjkh domainname $nisdomainname 2425184Sjkh echo -n ' domain' 2525184Sjkh fi 2625184Sjkh echo '.' 2725184Sjkh 2825184Sjkh # Set up all the network interfaces, calling startup scripts if needed 2925184Sjkh for ifn in ${network_interfaces}; do 3025184Sjkh if [ -e /etc/start_if.${ifn} ]; then 3125184Sjkh . /etc/start_if.${ifn} ${ifn} 3225184Sjkh fi 3325184Sjkh # Do the primary ifconfig if specified 3425184Sjkh eval ifconfig_args=\$ifconfig_${ifn} 3525184Sjkh if [ -n "${ifconfig_args}" ] ; then 3625184Sjkh ifconfig ${ifn} ${ifconfig_args} 3725184Sjkh fi 3825184Sjkh # Check to see if aliases need to be added 3925184Sjkh alias=0 4025184Sjkh while : 4125184Sjkh do 4225184Sjkh eval ifconfig_args=\$ifconfig_${ifn}_alias${alias} 4325184Sjkh if [ -n "${ifconfig_args}" ]; then 4425184Sjkh ifconfig ${ifn} ${ifconfig_args} alias 4525184Sjkh alias=`expr ${alias} + 1` 4625184Sjkh else 4725184Sjkh break; 4825184Sjkh fi 4925184Sjkh done 5025184Sjkh # Do ipx address if specified 5125184Sjkh eval ifconfig_args=\$ifconfig_${ifn}_ipx 5225184Sjkh if [ -n "${ifconfig_args}" ]; then 5325184Sjkh ifconfig ${ifn} ${ifconfig_args} 5425184Sjkh fi 5525184Sjkh ifconfig ${ifn} 5625184Sjkh done 5725184Sjkh 5825184Sjkh # If IP filtering 5925184Sjkh if [ -n "$firewall" -a "x$firewall" != "xNO" -a -f /etc/rc.firewall ] ; then 6025184Sjkh echo -n ' firewall' 6125364Sjkh . /etc/rc.firewall 6225184Sjkh fi 6325184Sjkh 6425184Sjkh if [ "x$defaultrouter" != "xNO" ] ; then 6525184Sjkh static_routes="default ${static_routes}" 6625184Sjkh route_default="default ${defaultrouter}" 6725184Sjkh fi 6825184Sjkh 6925184Sjkh # Set up any static routes. This should be done before router discovery. 7025184Sjkh if [ "x${static_routes}" != "x" ]; then 7125184Sjkh for i in ${static_routes}; do 7225184Sjkh eval route_args=\$route_${i} 7325184Sjkh route add ${route_args} 7425184Sjkh done 7525184Sjkh fi 7625184Sjkh 7725184Sjkh echo -n 'Additional routing options:' 7825184Sjkh if [ "X$gateway_enable" = X"YES" ]; then 7925365Sjkh echo -n ' IP gateway=YES' 8025184Sjkh sysctl -w net.inet.ip.forwarding=1 >/dev/null 2>&1 8125184Sjkh fi 8225184Sjkh 8325184Sjkh if [ "X$router_enable" = X"YES" ]; then 8425184Sjkh echo -n " ${router}"; ${router} ${router_flags} 8525184Sjkh fi 8625184Sjkh 8725184Sjkh if [ "X$ipxgateway_enable" = X"YES" ]; then 8825365Sjkh echo -n ' IPX gateway=YES' 8925184Sjkh sysctl -w net.ipx.ipx.ipxforwarding=1 >/dev/null 2>&1 9025184Sjkh fi 9125184Sjkh 9225184Sjkh if [ "X$ipxrouted_enable" = X"YES" ]; then 9325184Sjkh echo -n ' IPXrouted: ' 9425184Sjkh IPXrouted ${ipxrouted_flags} > /dev/null 2>&1 9525184Sjkh fi 9625765Sjkh 9725765Sjkh if [ "X$arpproxy_all" = X"YES" ]; then 9825765Sjkh echo -n ' enabling ARP_PROXY_ALL: ' 9925765Sjkh sysctl -w net.link.ether.inet.proxyall=1 2>&1 10025765Sjkh fi 10125184Sjkh echo '.' 10225184Sjkh network_pass1_done=YES # Let future generations know we made it. 10325184Sjkh} 10425184Sjkh 10525184Sjkhnetwork_pass2() { 10625184Sjkh echo -n 'Doing additional network setup:' 10725412Sjkh if [ -n "$tcp_extensions" -a "x$tcp_extensions" != "xYES" ] ; then 10825412Sjkh echo -n ' tcp extensions=NO' 10925184Sjkh sysctl -w net.inet.tcp.rfc1323=0 >/dev/null 2>&1 11025184Sjkh sysctl -w net.inet.tcp.rfc1644=0 >/dev/null 2>&1 11125184Sjkh fi 11225184Sjkh if [ "X${named_enable}" = X"YES" ]; then 11325184Sjkh echo -n ' named'; named ${named_flags} 11425184Sjkh fi 11525184Sjkh 11625184Sjkh if [ "X${ntpdate_enable}" = X"YES" -o "X${xntpd_enable}" = X"YES" ]; then 11725184Sjkh if [ "X${ntpdate_enable}" = X"YES" ]; then 11825184Sjkh echo -n ' ntpdate'; ntpdate ${ntpdate_flags} >/dev/null 2>&1 11925184Sjkh fi 12025184Sjkh 12125184Sjkh if [ "X${xntpd_enable}" = X"YES" ]; then 12225184Sjkh echo -n ' xntpd'; xntpd ${xntpd_flags} 12325184Sjkh fi 12425184Sjkh fi 12525184Sjkh 12625184Sjkh if [ "X${timed_enable}" = X"YES" ]; then 12725184Sjkh echo -n ' timed'; timed ${timed_flags} 12825184Sjkh fi 12925184Sjkh 13025184Sjkh if [ "X${portmap_enable}" = X"YES" ]; then 13125184Sjkh echo -n ' portmap'; portmap ${portmap_flags} 13225184Sjkh fi 13325184Sjkh 13425184Sjkh # Start ypserv if we're an NIS server. 13525184Sjkh # Run rpc.ypxfrd and rpc.yppasswdd only on the NIS master server. 13625184Sjkh if [ "X${nis_server_enable}" = X"YES" ]; then 13725184Sjkh echo -n ' ypserv'; ypserv ${nis_server_flags} 13825184Sjkh 13925184Sjkh if [ "X${nis_ypxfrd_enable}" = X"YES" ]; then 14025184Sjkh echo -n ' rpc.ypxfrd'; rpc.ypxfrd ${nis_ypxfrd_flags} 14125184Sjkh fi 14225184Sjkh 14325184Sjkh if [ "X${nis_yppasswdd_enable}" = X"YES" ]; then 14425184Sjkh echo -n ' rpc.yppasswdd'; rpc.yppasswdd ${nis_yppasswdd_flags} 14525184Sjkh fi 14625184Sjkh fi 14725184Sjkh 14825184Sjkh # Start ypbind if we're an NIS client 14925184Sjkh if [ "X${nis_client_enable}" = X"YES" ]; then 15025184Sjkh echo -n ' ypbind'; ypbind ${nis_client_flags} 15125184Sjkh if [ "X${nis_ypset_enable}" = X"YES" ]; then 15225184Sjkh echo -n ' ypset'; ypset ${nis_ypset_flags} 15325184Sjkh fi 15425184Sjkh fi 15525184Sjkh 15625184Sjkh echo '.' 15725184Sjkh network_pass2_done=YES 15825184Sjkh} 15925184Sjkh 16025184Sjkhnetwork_pass3() { 16125184Sjkh echo -n 'Starting final network daemons:' 16225184Sjkh 16325184Sjkh if [ "X${nfs_server_enable}" = X"YES" -a -r /etc/exports ]; then 16425184Sjkh echo -n ' mountd' 16525184Sjkh if [ "X${weak_mountd_authentication}" = X"YES" ]; then 16625184Sjkh mountd_flags="-n" 16725184Sjkh fi 16825184Sjkh mountd ${mountd_flags} 16925184Sjkh if [ "X${nfs_reserved_port_only}" = X"YES" ]; then 17025365Sjkh echo -n ' nfsprivport=YES' 17125184Sjkh sysctl -w vfs.nfs.nfs_privport=1 >/dev/null 2>&1 17225184Sjkh fi 17325916Sjkh echo -n ' nfsd'; nfsd ${nfs_server_flags} 17425184Sjkh if [ "X$rpc_lockd_enable" = X"YES" ]; then 17525184Sjkh echo -n ' rpc.lockd'; rpc.lockd 17625184Sjkh fi 17725184Sjkh if [ "X$rpc_statd_enable" = X"YES" ]; then 17825184Sjkh echo -n ' rpc.statd'; rpc.statd 17925184Sjkh fi 18025184Sjkh fi 18125184Sjkh 18225184Sjkh if [ "X${nfs_client_enable}" = X"YES" ]; then 18325916Sjkh echo -n ' nfsiod'; nfsiod ${nfs_client_flags} 18425184Sjkh fi 18525184Sjkh 18625184Sjkh if [ "X${amd_enable}" = X"YES" ]; then 18725184Sjkh echo -n ' amd' 18825184Sjkh amd -p ${amd_flags} > /var/run/amd.pid 2> /dev/null 18925184Sjkh fi 19025184Sjkh 19125184Sjkh if [ "X${rwhod_enable}" = X"YES" ]; then 19225184Sjkh echo -n ' rwhod'; rwhod 19325184Sjkh fi 19425184Sjkh 19525184Sjkh # Kerberos runs ONLY on the Kerberos server machine 19625184Sjkh if [ "X${kerberos_server_enable}" = X"YES" ]; then 19725184Sjkh echo -n ' kerberos'; kerberos >> /var/log/kerberos.log & 19825184Sjkh echo -n ' kadmind'; \ 19925184Sjkh (sleep 20; kadmind -n >/dev/null 2>&1 &) & 20025184Sjkh fi 20125184Sjkh 20225184Sjkh # IP multicast routing daemon 20325184Sjkh if [ "X${mrouted_enable}" = X"YES" ]; then 20425184Sjkh echo -n ' mrouted'; mrouted ${mrouted_flags} 20525184Sjkh fi 20625184Sjkh echo '.' 20725184Sjkh network_pass3_done=YES 20825184Sjkh} 209