1997-04-27 05:59:19 +02:00
|
|
|
#!/bin/sh -
|
|
|
|
#
|
1998-09-15 12:49:03 +02:00
|
|
|
# $Id: rc.network,v 1.30 1998/09/06 08:20:11 phk Exp $
|
1997-04-27 05:59:19 +02:00
|
|
|
# From: @(#)netstart 5.9 (Berkeley) 3/30/91
|
|
|
|
|
|
|
|
# Note that almost all the user-configurable behavior is no longer in
|
|
|
|
# this file, but rather in /etc/rc.conf. Please check that file
|
|
|
|
# first before contemplating any changes here. If you do need to change
|
|
|
|
# this file for some reason, we would like to know about it.
|
|
|
|
|
|
|
|
# First pass startup stuff.
|
|
|
|
|
|
|
|
network_pass1() {
|
|
|
|
echo -n 'Doing initial network setup:'
|
|
|
|
# Set the host name if it is not already set
|
|
|
|
if [ -z "`hostname -s`" ] ; then
|
|
|
|
hostname $hostname
|
|
|
|
echo -n ' hostname'
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set the domainname if we're using NIS
|
|
|
|
if [ -n "$nisdomainname" -a "x$nisdomainname" != "xNO" ] ; then
|
|
|
|
domainname $nisdomainname
|
|
|
|
echo -n ' domain'
|
|
|
|
fi
|
|
|
|
echo '.'
|
|
|
|
|
|
|
|
# Set up all the network interfaces, calling startup scripts if needed
|
|
|
|
for ifn in ${network_interfaces}; do
|
|
|
|
if [ -e /etc/start_if.${ifn} ]; then
|
1998-02-20 15:45:06 +01:00
|
|
|
. /etc/start_if.${ifn}
|
1997-04-27 05:59:19 +02:00
|
|
|
fi
|
|
|
|
# Do the primary ifconfig if specified
|
|
|
|
eval ifconfig_args=\$ifconfig_${ifn}
|
|
|
|
if [ -n "${ifconfig_args}" ] ; then
|
|
|
|
ifconfig ${ifn} ${ifconfig_args}
|
|
|
|
fi
|
|
|
|
# Check to see if aliases need to be added
|
|
|
|
alias=0
|
|
|
|
while :
|
|
|
|
do
|
|
|
|
eval ifconfig_args=\$ifconfig_${ifn}_alias${alias}
|
|
|
|
if [ -n "${ifconfig_args}" ]; then
|
|
|
|
ifconfig ${ifn} ${ifconfig_args} alias
|
|
|
|
alias=`expr ${alias} + 1`
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
# Do ipx address if specified
|
|
|
|
eval ifconfig_args=\$ifconfig_${ifn}_ipx
|
|
|
|
if [ -n "${ifconfig_args}" ]; then
|
|
|
|
ifconfig ${ifn} ${ifconfig_args}
|
|
|
|
fi
|
|
|
|
ifconfig ${ifn}
|
|
|
|
done
|
1997-09-11 12:59:02 +02:00
|
|
|
|
|
|
|
# Initialize IP filtering using ipfw
|
|
|
|
echo ""
|
|
|
|
/sbin/ipfw -q flush > /dev/null 2>&1
|
1998-01-10 04:33:39 +01:00
|
|
|
if [ $? = 0 ] ; then
|
1997-09-11 12:59:02 +02:00
|
|
|
firewall_in_kernel=1
|
1998-01-10 04:33:39 +01:00
|
|
|
else
|
|
|
|
firewall_in_kernel=0
|
1997-09-11 12:59:02 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $firewall_in_kernel = 0 -a "x$firewall_enable" = "xYES" ] ; then
|
1998-05-19 06:36:31 +02:00
|
|
|
if modload /lkm/ipfw_mod.o; then
|
1997-09-11 12:59:02 +02:00
|
|
|
firewall_in_kernel=1 # module loaded successfully
|
|
|
|
echo "Kernel firewall module loaded."
|
|
|
|
else
|
|
|
|
echo "Warning: firewall kernel module failed to load."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Load the filters if required
|
|
|
|
if [ $firewall_in_kernel = 1 ]; then
|
|
|
|
if [ -n "$firewall_enable" -a -f /etc/rc.firewall -a \
|
|
|
|
"x$firewall_enable" = "xYES" ] ; then
|
1997-05-01 22:04:42 +02:00
|
|
|
. /etc/rc.firewall
|
1997-09-11 12:59:02 +02:00
|
|
|
echo "Firewall rules loaded."
|
|
|
|
else
|
1998-02-14 05:12:23 +01:00
|
|
|
IPFW_DEFAULT=`ipfw l 65535`
|
|
|
|
if [ "$IPFW_DEFAULT" = "65535 deny ip from any to any" ]; then
|
1998-02-07 05:56:56 +01:00
|
|
|
echo -n "Warning: kernel has firewall functionality, "
|
|
|
|
echo "but firewall rules are not enabled."
|
|
|
|
echo " All ip services are disabled."
|
|
|
|
fi
|
1997-09-11 12:59:02 +02:00
|
|
|
fi
|
1997-04-27 05:59:19 +02:00
|
|
|
fi
|
|
|
|
|
1997-09-11 12:59:02 +02:00
|
|
|
# Configure routing
|
|
|
|
|
1997-04-27 05:59:19 +02:00
|
|
|
if [ "x$defaultrouter" != "xNO" ] ; then
|
|
|
|
static_routes="default ${static_routes}"
|
|
|
|
route_default="default ${defaultrouter}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set up any static routes. This should be done before router discovery.
|
|
|
|
if [ "x${static_routes}" != "x" ]; then
|
|
|
|
for i in ${static_routes}; do
|
|
|
|
eval route_args=\$route_${i}
|
|
|
|
route add ${route_args}
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -n 'Additional routing options:'
|
1997-07-06 02:33:34 +02:00
|
|
|
if [ -n "$tcp_extensions" -a "x$tcp_extensions" != "xYES" ] ; then
|
|
|
|
echo -n ' tcp extensions=NO'
|
|
|
|
sysctl -w net.inet.tcp.rfc1323=0 >/dev/null 2>&1
|
|
|
|
fi
|
|
|
|
|
1998-09-15 12:49:03 +02:00
|
|
|
if [ X"$icmp_bmcastecho" = X"YES" ]; then
|
|
|
|
echo -n ' broadcast ping responses=YES'
|
|
|
|
sysctl -w net.inet.icmp.bmcastecho=1 >/dev/null 2>&1
|
|
|
|
fi
|
|
|
|
|
1997-04-27 05:59:19 +02:00
|
|
|
if [ "X$gateway_enable" = X"YES" ]; then
|
1997-05-01 22:28:18 +02:00
|
|
|
echo -n ' IP gateway=YES'
|
1997-04-27 05:59:19 +02:00
|
|
|
sysctl -w net.inet.ip.forwarding=1 >/dev/null 2>&1
|
|
|
|
fi
|
|
|
|
|
1998-02-16 20:21:32 +01:00
|
|
|
if [ "X$forward_sourceroute" = X"YES" ]; then
|
|
|
|
echo -n ' do source routing=YES'
|
|
|
|
sysctl -w net.inet.ip.sourceroute=1 >/dev/null 2>&1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "X$accept_sourceroute" = X"YES" ]; then
|
|
|
|
echo -n ' accept source routing=YES'
|
|
|
|
sysctl -w net.inet.ip.accept_sourceroute=1 >/dev/null 2>&1
|
|
|
|
fi
|
|
|
|
|
1997-04-27 05:59:19 +02:00
|
|
|
if [ "X$ipxgateway_enable" = X"YES" ]; then
|
1997-05-01 22:28:18 +02:00
|
|
|
echo -n ' IPX gateway=YES'
|
1997-04-27 05:59:19 +02:00
|
|
|
sysctl -w net.ipx.ipx.ipxforwarding=1 >/dev/null 2>&1
|
|
|
|
fi
|
|
|
|
|
1998-05-19 06:36:31 +02:00
|
|
|
if [ "X$arpproxy_all" = X"YES" ]; then
|
|
|
|
echo -n ' enabling ARP_PROXY_ALL: '
|
|
|
|
sysctl -w net.link.ether.inet.proxyall=1 2>&1
|
|
|
|
fi
|
|
|
|
echo '.'
|
|
|
|
|
|
|
|
echo -n 'routing daemons:'
|
|
|
|
if [ "X$router_enable" = X"YES" ]; then
|
|
|
|
echo -n " ${router}"; ${router} ${router_flags}
|
|
|
|
fi
|
|
|
|
|
1997-04-27 05:59:19 +02:00
|
|
|
if [ "X$ipxrouted_enable" = X"YES" ]; then
|
1998-05-19 06:36:31 +02:00
|
|
|
echo -n ' IPXrouted'
|
1997-04-27 05:59:19 +02:00
|
|
|
IPXrouted ${ipxrouted_flags} > /dev/null 2>&1
|
|
|
|
fi
|
1997-05-13 10:22:27 +02:00
|
|
|
|
1998-05-19 06:36:31 +02:00
|
|
|
if [ "X${mrouted_enable}" = X"YES" ]; then
|
|
|
|
echo -n ' mrouted'; mrouted ${mrouted_flags}
|
1997-05-13 10:22:27 +02:00
|
|
|
fi
|
1998-05-19 06:36:31 +02:00
|
|
|
|
1998-03-09 09:50:30 +01:00
|
|
|
if [ "X$rarpd_enable" = X"YES" ]; then
|
|
|
|
echo -n ' rarpd'; rarpd ${rarpd_flags}
|
|
|
|
fi
|
1997-04-27 05:59:19 +02:00
|
|
|
echo '.'
|
|
|
|
network_pass1_done=YES # Let future generations know we made it.
|
|
|
|
}
|
|
|
|
|
|
|
|
network_pass2() {
|
|
|
|
echo -n 'Doing additional network setup:'
|
|
|
|
if [ "X${named_enable}" = X"YES" ]; then
|
1998-02-01 01:20:56 +01:00
|
|
|
echo -n ' named'; ${named_program-"named"} ${named_flags}
|
1997-04-27 05:59:19 +02:00
|
|
|
fi
|
|
|
|
|
1997-12-01 07:11:34 +01:00
|
|
|
if [ "X${ntpdate_enable}" = X"YES" ]; then
|
1998-05-06 19:36:16 +02:00
|
|
|
echo -n ' ntpdate'; ${ntpdate_program} ${ntpdate_flags} >/dev/null 2>&1
|
1997-12-01 07:11:34 +01:00
|
|
|
fi
|
1997-04-27 05:59:19 +02:00
|
|
|
|
1997-12-01 07:11:34 +01:00
|
|
|
if [ "X${xntpd_enable}" = X"YES" ]; then
|
1998-05-06 19:36:16 +02:00
|
|
|
echo -n ' xntpd'; ${xntpd_program} ${xntpd_flags}
|
1997-04-27 05:59:19 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "X${timed_enable}" = X"YES" ]; then
|
|
|
|
echo -n ' timed'; timed ${timed_flags}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "X${portmap_enable}" = X"YES" ]; then
|
|
|
|
echo -n ' portmap'; portmap ${portmap_flags}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Start ypserv if we're an NIS server.
|
|
|
|
# Run rpc.ypxfrd and rpc.yppasswdd only on the NIS master server.
|
|
|
|
if [ "X${nis_server_enable}" = X"YES" ]; then
|
|
|
|
echo -n ' ypserv'; ypserv ${nis_server_flags}
|
|
|
|
|
|
|
|
if [ "X${nis_ypxfrd_enable}" = X"YES" ]; then
|
|
|
|
echo -n ' rpc.ypxfrd'; rpc.ypxfrd ${nis_ypxfrd_flags}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "X${nis_yppasswdd_enable}" = X"YES" ]; then
|
|
|
|
echo -n ' rpc.yppasswdd'; rpc.yppasswdd ${nis_yppasswdd_flags}
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Start ypbind if we're an NIS client
|
|
|
|
if [ "X${nis_client_enable}" = X"YES" ]; then
|
|
|
|
echo -n ' ypbind'; ypbind ${nis_client_flags}
|
|
|
|
if [ "X${nis_ypset_enable}" = X"YES" ]; then
|
|
|
|
echo -n ' ypset'; ypset ${nis_ypset_flags}
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1998-04-12 11:47:43 +02:00
|
|
|
# Start keyserv if we are running Secure RPC
|
|
|
|
if [ "X${keyserv_enable}" = X"YES" ]; then
|
|
|
|
echo -n ' keyserv'; keyserv ${keyserv_flags}
|
|
|
|
fi
|
|
|
|
# Start ypupdated if we are running Secure RPC and we are NIS master
|
|
|
|
if [ "X$rpc_ypupdated_enable" = X"YES" ]; then
|
|
|
|
echo -n ' rpc.ypupdated'; rpc.ypupdated
|
|
|
|
fi
|
|
|
|
|
1997-04-27 05:59:19 +02:00
|
|
|
echo '.'
|
|
|
|
network_pass2_done=YES
|
|
|
|
}
|
|
|
|
|
|
|
|
network_pass3() {
|
|
|
|
echo -n 'Starting final network daemons:'
|
|
|
|
|
|
|
|
if [ "X${nfs_server_enable}" = X"YES" -a -r /etc/exports ]; then
|
|
|
|
echo -n ' mountd'
|
|
|
|
if [ "X${weak_mountd_authentication}" = X"YES" ]; then
|
|
|
|
mountd_flags="-n"
|
|
|
|
fi
|
|
|
|
mountd ${mountd_flags}
|
|
|
|
if [ "X${nfs_reserved_port_only}" = X"YES" ]; then
|
|
|
|
sysctl -w vfs.nfs.nfs_privport=1 >/dev/null 2>&1
|
|
|
|
fi
|
1997-05-19 09:46:51 +02:00
|
|
|
echo -n ' nfsd'; nfsd ${nfs_server_flags}
|
1997-04-27 05:59:19 +02:00
|
|
|
if [ "X$rpc_lockd_enable" = X"YES" ]; then
|
|
|
|
echo -n ' rpc.lockd'; rpc.lockd
|
|
|
|
fi
|
|
|
|
if [ "X$rpc_statd_enable" = X"YES" ]; then
|
|
|
|
echo -n ' rpc.statd'; rpc.statd
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "X${nfs_client_enable}" = X"YES" ]; then
|
1997-05-19 09:46:51 +02:00
|
|
|
echo -n ' nfsiod'; nfsiod ${nfs_client_flags}
|
1997-04-27 05:59:19 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "X${amd_enable}" = X"YES" ]; then
|
|
|
|
echo -n ' amd'
|
1998-04-26 08:32:13 +02:00
|
|
|
if [ "X${amd_map_program}" != X"NO" ]; then
|
|
|
|
amd_flags="${amd_flags} `${amd_map_program}`"
|
|
|
|
fi
|
1997-04-27 05:59:19 +02:00
|
|
|
amd -p ${amd_flags} > /var/run/amd.pid 2> /dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "X${rwhod_enable}" = X"YES" ]; then
|
|
|
|
echo -n ' rwhod'; rwhod
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Kerberos runs ONLY on the Kerberos server machine
|
|
|
|
if [ "X${kerberos_server_enable}" = X"YES" ]; then
|
1997-11-07 21:45:48 +01:00
|
|
|
if [ "X${kerberos_stash}" = "XYES" ]; then
|
|
|
|
stash_flag=-n
|
|
|
|
else
|
|
|
|
stash_flag=
|
|
|
|
fi
|
|
|
|
echo -n ' kerberos'; \
|
1998-08-14 08:55:17 +02:00
|
|
|
kerberos ${stash_flag} >> /var/log/kerberos.log &
|
1997-11-07 21:45:48 +01:00
|
|
|
if [ "X${kadmind_server_enable}" = "XYES" ]; then
|
|
|
|
echo -n ' kadmind'; \
|
1998-08-14 08:55:17 +02:00
|
|
|
(sleep 20; kadmind ${stash_flag} >/dev/null 2>&1 &) &
|
1997-11-07 21:45:48 +01:00
|
|
|
fi
|
|
|
|
unset stash_flag
|
1997-04-27 05:59:19 +02:00
|
|
|
fi
|
|
|
|
|
1998-04-18 12:27:19 +02:00
|
|
|
# Network Address Translation daemon
|
1998-07-08 17:40:53 +02:00
|
|
|
if [ "X${natd_enable}" = X"YES" -a X"${natd_interface}" != X"" \
|
|
|
|
-a X"${firewall_enable}" = X"YES" ]; then
|
|
|
|
if echo ${natd_interface} | \
|
|
|
|
grep -q -E '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then
|
|
|
|
natd_ifarg="-a ${natd_interface}"
|
|
|
|
else
|
|
|
|
natd_ifarg="-n ${natd_interface}"
|
|
|
|
fi
|
|
|
|
echo -n ' natd'; natd ${natd_flags} ${natd_ifarg}
|
|
|
|
fi
|
1998-04-18 12:27:19 +02:00
|
|
|
|
1997-04-27 05:59:19 +02:00
|
|
|
echo '.'
|
|
|
|
network_pass3_done=YES
|
|
|
|
}
|