defaultroute revision 25365
125184Sjkh#!/bin/sh - 225184Sjkh# 325365Sjkh# $Id: rc.network,v 1.4 1997/05/01 20:04:42 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 9625184Sjkh echo '.' 9725184Sjkh network_pass1_done=YES # Let future generations know we made it. 9825184Sjkh} 9925184Sjkh 10025184Sjkhnetwork_pass2() { 10125184Sjkh echo -n 'Doing additional network setup:' 10225365Sjkh if [ -n "$tcp_extentions" -a "x$tcp_extentions" != "xYES" ] ; then 10325365Sjkh echo -n ' tcp extentions=NO' 10425184Sjkh sysctl -w net.inet.tcp.rfc1323=0 >/dev/null 2>&1 10525184Sjkh sysctl -w net.inet.tcp.rfc1644=0 >/dev/null 2>&1 10625184Sjkh fi 10725184Sjkh if [ "X${named_enable}" = X"YES" ]; then 10825184Sjkh echo -n ' named'; named ${named_flags} 10925184Sjkh fi 11025184Sjkh 11125184Sjkh if [ "X${ntpdate_enable}" = X"YES" -o "X${xntpd_enable}" = X"YES" ]; then 11225184Sjkh if [ "X${tickadj_enable}" = X"YES" ]; then 11325184Sjkh echo -n ' tickadj'; tickadj ${tickadj_flags--Aq} 11425184Sjkh fi 11525184Sjkh 11625184Sjkh if [ "X${ntpdate_enable}" = X"YES" ]; then 11725184Sjkh echo -n ' ntpdate'; ntpdate ${ntpdate_flags} >/dev/null 2>&1 11825184Sjkh fi 11925184Sjkh 12025184Sjkh if [ "X${xntpd_enable}" = X"YES" ]; then 12125184Sjkh echo -n ' xntpd'; xntpd ${xntpd_flags} 12225184Sjkh fi 12325184Sjkh fi 12425184Sjkh 12525184Sjkh if [ "X${timed_enable}" = X"YES" ]; then 12625184Sjkh echo -n ' timed'; timed ${timed_flags} 12725184Sjkh fi 12825184Sjkh 12925184Sjkh if [ "X${portmap_enable}" = X"YES" ]; then 13025184Sjkh echo -n ' portmap'; portmap ${portmap_flags} 13125184Sjkh fi 13225184Sjkh 13325184Sjkh # Start ypserv if we're an NIS server. 13425184Sjkh # Run rpc.ypxfrd and rpc.yppasswdd only on the NIS master server. 13525184Sjkh if [ "X${nis_server_enable}" = X"YES" ]; then 13625184Sjkh echo -n ' ypserv'; ypserv ${nis_server_flags} 13725184Sjkh 13825184Sjkh if [ "X${nis_ypxfrd_enable}" = X"YES" ]; then 13925184Sjkh echo -n ' rpc.ypxfrd'; rpc.ypxfrd ${nis_ypxfrd_flags} 14025184Sjkh fi 14125184Sjkh 14225184Sjkh if [ "X${nis_yppasswdd_enable}" = X"YES" ]; then 14325184Sjkh echo -n ' rpc.yppasswdd'; rpc.yppasswdd ${nis_yppasswdd_flags} 14425184Sjkh fi 14525184Sjkh fi 14625184Sjkh 14725184Sjkh # Start ypbind if we're an NIS client 14825184Sjkh if [ "X${nis_client_enable}" = X"YES" ]; then 14925184Sjkh echo -n ' ypbind'; ypbind ${nis_client_flags} 15025184Sjkh if [ "X${nis_ypset_enable}" = X"YES" ]; then 15125184Sjkh echo -n ' ypset'; ypset ${nis_ypset_flags} 15225184Sjkh fi 15325184Sjkh fi 15425184Sjkh 15525184Sjkh echo '.' 15625184Sjkh network_pass2_done=YES 15725184Sjkh} 15825184Sjkh 15925184Sjkhnetwork_pass3() { 16025184Sjkh echo -n 'Starting final network daemons:' 16125184Sjkh 16225184Sjkh if [ "X${nfs_server_enable}" = X"YES" -a -r /etc/exports ]; then 16325184Sjkh echo -n ' mountd' 16425184Sjkh if [ "X${weak_mountd_authentication}" = X"YES" ]; then 16525184Sjkh mountd_flags="-n" 16625184Sjkh fi 16725184Sjkh mountd ${mountd_flags} 16825184Sjkh if [ "X${nfs_reserved_port_only}" = X"YES" ]; then 16925365Sjkh echo -n ' nfsprivport=YES' 17025184Sjkh sysctl -w vfs.nfs.nfs_privport=1 >/dev/null 2>&1 17125184Sjkh fi 17225184Sjkh echo -n ' nfsd'; nfsd -u -t 4 17325184Sjkh if [ "X$rpc_lockd_enable" = X"YES" ]; then 17425184Sjkh echo -n ' rpc.lockd'; rpc.lockd 17525184Sjkh fi 17625184Sjkh if [ "X$rpc_statd_enable" = X"YES" ]; then 17725184Sjkh echo -n ' rpc.statd'; rpc.statd 17825184Sjkh fi 17925184Sjkh fi 18025184Sjkh 18125184Sjkh if [ "X${nfs_client_enable}" = X"YES" ]; then 18225184Sjkh echo -n ' nfsiod'; nfsiod -n 4 18325184Sjkh fi 18425184Sjkh 18525184Sjkh if [ "X${amd_enable}" = X"YES" ]; then 18625184Sjkh echo -n ' amd' 18725184Sjkh amd -p ${amd_flags} > /var/run/amd.pid 2> /dev/null 18825184Sjkh fi 18925184Sjkh 19025184Sjkh if [ "X${rwhod_enable}" = X"YES" ]; then 19125184Sjkh echo -n ' rwhod'; rwhod 19225184Sjkh fi 19325184Sjkh 19425184Sjkh # Kerberos runs ONLY on the Kerberos server machine 19525184Sjkh if [ "X${kerberos_server_enable}" = X"YES" ]; then 19625184Sjkh echo -n ' kerberos'; kerberos >> /var/log/kerberos.log & 19725184Sjkh echo -n ' kadmind'; \ 19825184Sjkh (sleep 20; kadmind -n >/dev/null 2>&1 &) & 19925184Sjkh fi 20025184Sjkh 20125184Sjkh # IP multicast routing daemon 20225184Sjkh if [ "X${mrouted_enable}" = X"YES" ]; then 20325184Sjkh echo -n ' mrouted'; mrouted ${mrouted_flags} 20425184Sjkh fi 20525184Sjkh echo '.' 20625184Sjkh network_pass3_done=YES 20725184Sjkh} 208