defaultroute revision 31033
125184Sjkh#!/bin/sh - 225184Sjkh# 331033Ssef# $Id: rc.network,v 1.11 1997/09/18 22:43:48 danny 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 5729300Sdanny 5829300Sdanny # Initialize IP filtering using ipfw 5929300Sdanny echo "" 6029300Sdanny /sbin/ipfw -q flush > /dev/null 2>&1 6129590Sdanny if [ $? = 1 ] ; then 6229300Sdanny firewall_in_kernel=0 6329300Sdanny else 6429300Sdanny firewall_in_kernel=1 6529300Sdanny fi 6629300Sdanny 6729300Sdanny if [ $firewall_in_kernel = 0 -a "x$firewall_enable" = "xYES" ] ; then 6829300Sdanny modload /lkm/ipfw_mod.o 6929300Sdanny if [ $? = 0 ]; then 7029300Sdanny firewall_in_kernel=1 # module loaded successfully 7129300Sdanny echo "Kernel firewall module loaded." 7229300Sdanny else 7329300Sdanny echo "Warning: firewall kernel module failed to load." 7429300Sdanny fi 7529300Sdanny fi 7629300Sdanny 7729300Sdanny # Load the filters if required 7829300Sdanny if [ $firewall_in_kernel = 1 ]; then 7929300Sdanny if [ -n "$firewall_enable" -a -f /etc/rc.firewall -a \ 8029300Sdanny "x$firewall_enable" = "xYES" ] ; then 8125364Sjkh . /etc/rc.firewall 8229300Sdanny echo "Firewall rules loaded." 8329300Sdanny else 8429300Sdanny echo "Warning: kernel has firewall functionality, but firewall rules are not enabled." 8529300Sdanny echo " All ip services are disabled." 8629300Sdanny fi 8725184Sjkh fi 8825184Sjkh 8929300Sdanny # Configure routing 9029300Sdanny 9125184Sjkh if [ "x$defaultrouter" != "xNO" ] ; then 9225184Sjkh static_routes="default ${static_routes}" 9325184Sjkh route_default="default ${defaultrouter}" 9425184Sjkh fi 9525184Sjkh 9625184Sjkh # Set up any static routes. This should be done before router discovery. 9725184Sjkh if [ "x${static_routes}" != "x" ]; then 9825184Sjkh for i in ${static_routes}; do 9925184Sjkh eval route_args=\$route_${i} 10025184Sjkh route add ${route_args} 10125184Sjkh done 10225184Sjkh fi 10325184Sjkh 10425184Sjkh echo -n 'Additional routing options:' 10527218Spst if [ -n "$tcp_extensions" -a "x$tcp_extensions" != "xYES" ] ; then 10627218Spst echo -n ' tcp extensions=NO' 10727218Spst sysctl -w net.inet.tcp.rfc1323=0 >/dev/null 2>&1 10827218Spst sysctl -w net.inet.tcp.rfc1644=0 >/dev/null 2>&1 10927218Spst fi 11027218Spst 11125184Sjkh if [ "X$gateway_enable" = X"YES" ]; then 11225365Sjkh echo -n ' IP gateway=YES' 11325184Sjkh sysctl -w net.inet.ip.forwarding=1 >/dev/null 2>&1 11425184Sjkh fi 11525184Sjkh 11625184Sjkh if [ "X$router_enable" = X"YES" ]; then 11725184Sjkh echo -n " ${router}"; ${router} ${router_flags} 11825184Sjkh fi 11925184Sjkh 12025184Sjkh if [ "X$ipxgateway_enable" = X"YES" ]; then 12125365Sjkh echo -n ' IPX gateway=YES' 12225184Sjkh sysctl -w net.ipx.ipx.ipxforwarding=1 >/dev/null 2>&1 12325184Sjkh fi 12425184Sjkh 12525184Sjkh if [ "X$ipxrouted_enable" = X"YES" ]; then 12625184Sjkh echo -n ' IPXrouted: ' 12725184Sjkh IPXrouted ${ipxrouted_flags} > /dev/null 2>&1 12825184Sjkh fi 12925765Sjkh 13025765Sjkh if [ "X$arpproxy_all" = X"YES" ]; then 13125765Sjkh echo -n ' enabling ARP_PROXY_ALL: ' 13225765Sjkh sysctl -w net.link.ether.inet.proxyall=1 2>&1 13325765Sjkh fi 13425184Sjkh echo '.' 13525184Sjkh network_pass1_done=YES # Let future generations know we made it. 13625184Sjkh} 13725184Sjkh 13825184Sjkhnetwork_pass2() { 13925184Sjkh echo -n 'Doing additional network setup:' 14025184Sjkh if [ "X${named_enable}" = X"YES" ]; then 14125184Sjkh echo -n ' named'; named ${named_flags} 14225184Sjkh fi 14325184Sjkh 14425184Sjkh if [ "X${ntpdate_enable}" = X"YES" -o "X${xntpd_enable}" = X"YES" ]; then 14525184Sjkh if [ "X${ntpdate_enable}" = X"YES" ]; then 14625184Sjkh echo -n ' ntpdate'; ntpdate ${ntpdate_flags} >/dev/null 2>&1 14725184Sjkh fi 14825184Sjkh 14925184Sjkh if [ "X${xntpd_enable}" = X"YES" ]; then 15025184Sjkh echo -n ' xntpd'; xntpd ${xntpd_flags} 15125184Sjkh fi 15225184Sjkh fi 15325184Sjkh 15425184Sjkh if [ "X${timed_enable}" = X"YES" ]; then 15525184Sjkh echo -n ' timed'; timed ${timed_flags} 15625184Sjkh fi 15725184Sjkh 15825184Sjkh if [ "X${portmap_enable}" = X"YES" ]; then 15925184Sjkh echo -n ' portmap'; portmap ${portmap_flags} 16025184Sjkh fi 16125184Sjkh 16225184Sjkh # Start ypserv if we're an NIS server. 16325184Sjkh # Run rpc.ypxfrd and rpc.yppasswdd only on the NIS master server. 16425184Sjkh if [ "X${nis_server_enable}" = X"YES" ]; then 16525184Sjkh echo -n ' ypserv'; ypserv ${nis_server_flags} 16625184Sjkh 16725184Sjkh if [ "X${nis_ypxfrd_enable}" = X"YES" ]; then 16825184Sjkh echo -n ' rpc.ypxfrd'; rpc.ypxfrd ${nis_ypxfrd_flags} 16925184Sjkh fi 17025184Sjkh 17125184Sjkh if [ "X${nis_yppasswdd_enable}" = X"YES" ]; then 17225184Sjkh echo -n ' rpc.yppasswdd'; rpc.yppasswdd ${nis_yppasswdd_flags} 17325184Sjkh fi 17425184Sjkh fi 17525184Sjkh 17625184Sjkh # Start ypbind if we're an NIS client 17725184Sjkh if [ "X${nis_client_enable}" = X"YES" ]; then 17825184Sjkh echo -n ' ypbind'; ypbind ${nis_client_flags} 17925184Sjkh if [ "X${nis_ypset_enable}" = X"YES" ]; then 18025184Sjkh echo -n ' ypset'; ypset ${nis_ypset_flags} 18125184Sjkh fi 18225184Sjkh fi 18325184Sjkh 18425184Sjkh echo '.' 18525184Sjkh network_pass2_done=YES 18625184Sjkh} 18725184Sjkh 18825184Sjkhnetwork_pass3() { 18925184Sjkh echo -n 'Starting final network daemons:' 19025184Sjkh 19125184Sjkh if [ "X${nfs_server_enable}" = X"YES" -a -r /etc/exports ]; then 19225184Sjkh echo -n ' mountd' 19325184Sjkh if [ "X${weak_mountd_authentication}" = X"YES" ]; then 19425184Sjkh mountd_flags="-n" 19525184Sjkh fi 19625184Sjkh mountd ${mountd_flags} 19725184Sjkh if [ "X${nfs_reserved_port_only}" = X"YES" ]; then 19825365Sjkh echo -n ' nfsprivport=YES' 19925184Sjkh sysctl -w vfs.nfs.nfs_privport=1 >/dev/null 2>&1 20025184Sjkh fi 20125916Sjkh echo -n ' nfsd'; nfsd ${nfs_server_flags} 20225184Sjkh if [ "X$rpc_lockd_enable" = X"YES" ]; then 20325184Sjkh echo -n ' rpc.lockd'; rpc.lockd 20425184Sjkh fi 20525184Sjkh if [ "X$rpc_statd_enable" = X"YES" ]; then 20625184Sjkh echo -n ' rpc.statd'; rpc.statd 20725184Sjkh fi 20825184Sjkh fi 20925184Sjkh 21025184Sjkh if [ "X${nfs_client_enable}" = X"YES" ]; then 21125916Sjkh echo -n ' nfsiod'; nfsiod ${nfs_client_flags} 21225184Sjkh fi 21325184Sjkh 21425184Sjkh if [ "X${amd_enable}" = X"YES" ]; then 21525184Sjkh echo -n ' amd' 21625184Sjkh amd -p ${amd_flags} > /var/run/amd.pid 2> /dev/null 21725184Sjkh fi 21825184Sjkh 21925184Sjkh if [ "X${rwhod_enable}" = X"YES" ]; then 22025184Sjkh echo -n ' rwhod'; rwhod 22125184Sjkh fi 22225184Sjkh 22325184Sjkh # Kerberos runs ONLY on the Kerberos server machine 22425184Sjkh if [ "X${kerberos_server_enable}" = X"YES" ]; then 22531033Ssef if [ "X${kerberos_stash}" = "XYES" ]; then 22631033Ssef stash_flag=-n 22731033Ssef else 22831033Ssef stash_flag= 22931033Ssef fi 23031033Ssef echo -n ' kerberos'; \ 23131033Ssef kerberos ${stash_flags} >> /var/log/kerberos.log & 23231033Ssef if [ "X${kadmind_server_enable}" = "XYES" ]; then 23331033Ssef echo -n ' kadmind'; \ 23431033Ssef (sleep 20; kadmind ${stash_flags} >/dev/null 2>&1 &) & 23531033Ssef fi 23631033Ssef unset stash_flag 23725184Sjkh fi 23825184Sjkh 23925184Sjkh # IP multicast routing daemon 24025184Sjkh if [ "X${mrouted_enable}" = X"YES" ]; then 24125184Sjkh echo -n ' mrouted'; mrouted ${mrouted_flags} 24225184Sjkh fi 24325184Sjkh echo '.' 24425184Sjkh network_pass3_done=YES 24525184Sjkh} 246