3 # $Id: rc.network,v 1.24 1998/05/05 21:14:27 andreas Exp $
4 # From: @(#)netstart 5.9 (Berkeley) 3/30/91
6 # Note that almost all the user-configurable behavior is no longer in
7 # this file, but rather in /etc/rc.conf. Please check that file
8 # first before contemplating any changes here. If you do need to change
9 # this file for some reason, we would like to know about it.
11 # First pass startup stuff.
14 echo -n 'Doing initial network setup:'
15 # Set the host name if it is not already set
16 if [ -z "`hostname -s`" ] ; then
21 # Set the domainname if we're using NIS
22 if [ -n "$nisdomainname" -a "x$nisdomainname" != "xNO" ] ; then
23 domainname $nisdomainname
28 # Set up all the network interfaces, calling startup scripts if needed
29 for ifn in ${network_interfaces}; do
30 if [ -e /etc/start_if.${ifn} ]; then
31 . /etc/start_if.${ifn}
33 # Do the primary ifconfig if specified
34 eval ifconfig_args=\$ifconfig_${ifn}
35 if [ -n "${ifconfig_args}" ] ; then
36 ifconfig ${ifn} ${ifconfig_args}
38 # Check to see if aliases need to be added
42 eval ifconfig_args=\$ifconfig_${ifn}_alias${alias}
43 if [ -n "${ifconfig_args}" ]; then
44 ifconfig ${ifn} ${ifconfig_args} alias
45 alias=`expr ${alias} + 1`
50 # Do ipx address if specified
51 eval ifconfig_args=\$ifconfig_${ifn}_ipx
52 if [ -n "${ifconfig_args}" ]; then
53 ifconfig ${ifn} ${ifconfig_args}
58 # Initialize IP filtering using ipfw
60 /sbin/ipfw -q flush > /dev/null 2>&1
67 if [ $firewall_in_kernel = 0 -a "x$firewall_enable" = "xYES" ] ; then
68 modload /lkm/ipfw_mod.o
70 firewall_in_kernel=1 # module loaded successfully
71 echo "Kernel firewall module loaded."
73 echo "Warning: firewall kernel module failed to load."
77 # Load the filters if required
78 if [ $firewall_in_kernel = 1 ]; then
79 if [ -n "$firewall_enable" -a -f /etc/rc.firewall -a \
80 "x$firewall_enable" = "xYES" ] ; then
82 echo "Firewall rules loaded."
84 IPFW_DEFAULT=`ipfw l 65535`
85 if [ "$IPFW_DEFAULT" = "65535 deny ip from any to any" ]; then
86 echo -n "Warning: kernel has firewall functionality, "
87 echo "but firewall rules are not enabled."
88 echo " All ip services are disabled."
95 if [ "x$defaultrouter" != "xNO" ] ; then
96 static_routes="default ${static_routes}"
97 route_default="default ${defaultrouter}"
100 # Set up any static routes. This should be done before router discovery.
101 if [ "x${static_routes}" != "x" ]; then
102 for i in ${static_routes}; do
103 eval route_args=\$route_${i}
104 route add ${route_args}
108 echo -n 'Additional routing options:'
109 if [ -n "$tcp_extensions" -a "x$tcp_extensions" != "xYES" ] ; then
110 echo -n ' tcp extensions=NO'
111 sysctl -w net.inet.tcp.rfc1323=0 >/dev/null 2>&1
112 sysctl -w net.inet.tcp.rfc1644=0 >/dev/null 2>&1
115 if [ "X$gateway_enable" = X"YES" ]; then
116 echo -n ' IP gateway=YES'
117 sysctl -w net.inet.ip.forwarding=1 >/dev/null 2>&1
120 if [ "X$forward_sourceroute" = X"YES" ]; then
121 echo -n ' do source routing=YES'
122 sysctl -w net.inet.ip.sourceroute=1 >/dev/null 2>&1
125 if [ "X$accept_sourceroute" = X"YES" ]; then
126 echo -n ' accept source routing=YES'
127 sysctl -w net.inet.ip.accept_sourceroute=1 >/dev/null 2>&1
130 if [ "X$router_enable" = X"YES" ]; then
131 echo -n " ${router}"; ${router} ${router_flags}
134 if [ "X$ipxgateway_enable" = X"YES" ]; then
135 echo -n ' IPX gateway=YES'
136 sysctl -w net.ipx.ipx.ipxforwarding=1 >/dev/null 2>&1
139 if [ "X$ipxrouted_enable" = X"YES" ]; then
140 echo -n ' IPXrouted: '
141 IPXrouted ${ipxrouted_flags} > /dev/null 2>&1
144 if [ "X$arpproxy_all" = X"YES" ]; then
145 echo -n ' enabling ARP_PROXY_ALL: '
146 sysctl -w net.link.ether.inet.proxyall=1 2>&1
148 if [ "X$rarpd_enable" = X"YES" ]; then
149 echo -n ' rarpd'; rarpd ${rarpd_flags}
153 network_pass1_done=YES # Let future generations know we made it.
157 echo -n 'Doing additional network setup:'
158 if [ "X${named_enable}" = X"YES" ]; then
159 echo -n ' named'; ${named_program-"named"} ${named_flags}
162 if [ "X${ntpdate_enable}" = X"YES" ]; then
163 echo -n ' ntpdate'; ${ntpdate_program} ${ntpdate_flags} >/dev/null 2>&1
166 if [ "X${xntpd_enable}" = X"YES" ]; then
167 echo -n ' xntpd'; ${xntpd_program} ${xntpd_flags}
170 if [ "X${timed_enable}" = X"YES" ]; then
171 echo -n ' timed'; timed ${timed_flags}
174 if [ "X${portmap_enable}" = X"YES" ]; then
175 echo -n ' portmap'; portmap ${portmap_flags}
178 # Start ypserv if we're an NIS server.
179 # Run rpc.ypxfrd and rpc.yppasswdd only on the NIS master server.
180 if [ "X${nis_server_enable}" = X"YES" ]; then
181 echo -n ' ypserv'; ypserv ${nis_server_flags}
183 if [ "X${nis_ypxfrd_enable}" = X"YES" ]; then
184 echo -n ' rpc.ypxfrd'; rpc.ypxfrd ${nis_ypxfrd_flags}
187 if [ "X${nis_yppasswdd_enable}" = X"YES" ]; then
188 echo -n ' rpc.yppasswdd'; rpc.yppasswdd ${nis_yppasswdd_flags}
192 # Start ypbind if we're an NIS client
193 if [ "X${nis_client_enable}" = X"YES" ]; then
194 echo -n ' ypbind'; ypbind ${nis_client_flags}
195 if [ "X${nis_ypset_enable}" = X"YES" ]; then
196 echo -n ' ypset'; ypset ${nis_ypset_flags}
200 # Start keyserv if we are running Secure RPC
201 if [ "X${keyserv_enable}" = X"YES" ]; then
202 echo -n ' keyserv'; keyserv ${keyserv_flags}
204 # Start ypupdated if we are running Secure RPC and we are NIS master
205 if [ "X$rpc_ypupdated_enable" = X"YES" ]; then
206 echo -n ' rpc.ypupdated'; rpc.ypupdated
210 network_pass2_done=YES
214 echo -n 'Starting final network daemons:'
216 if [ "X${nfs_server_enable}" = X"YES" -a -r /etc/exports ]; then
218 if [ "X${weak_mountd_authentication}" = X"YES" ]; then
221 mountd ${mountd_flags}
222 if [ "X${nfs_reserved_port_only}" = X"YES" ]; then
223 echo -n ' nfsprivport=YES'
224 sysctl -w vfs.nfs.nfs_privport=1 >/dev/null 2>&1
226 echo -n ' nfsd'; nfsd ${nfs_server_flags}
227 if [ "X$rpc_lockd_enable" = X"YES" ]; then
228 echo -n ' rpc.lockd'; rpc.lockd
230 if [ "X$rpc_statd_enable" = X"YES" ]; then
231 echo -n ' rpc.statd'; rpc.statd
235 if [ "X${nfs_client_enable}" = X"YES" ]; then
236 echo -n ' nfsiod'; nfsiod ${nfs_client_flags}
239 if [ "X${amd_enable}" = X"YES" ]; then
241 if [ "X${amd_map_program}" != X"NO" ]; then
242 amd_flags="${amd_flags} `${amd_map_program}`"
244 amd -p ${amd_flags} > /var/run/amd.pid 2> /dev/null
247 if [ "X${rwhod_enable}" = X"YES" ]; then
248 echo -n ' rwhod'; rwhod
251 # Kerberos runs ONLY on the Kerberos server machine
252 if [ "X${kerberos_server_enable}" = X"YES" ]; then
253 if [ "X${kerberos_stash}" = "XYES" ]; then
258 echo -n ' kerberos'; \
259 kerberos ${stash_flags} >> /var/log/kerberos.log &
260 if [ "X${kadmind_server_enable}" = "XYES" ]; then
261 echo -n ' kadmind'; \
262 (sleep 20; kadmind ${stash_flags} >/dev/null 2>&1 &) &
267 # IP multicast routing daemon
268 if [ "X${mrouted_enable}" = X"YES" ]; then
269 echo -n ' mrouted'; mrouted ${mrouted_flags}
272 # Network Address Translation daemon
273 if [ "X${natd_enable}" = X"YES" -a "X${natd_interface}" != X"" ]; then
274 if [ -a "X${firewall_enable}" = X"YES" ]; then
275 echo -n ' natd'; natd ${natd_flags} -n ${natd_interface}
280 network_pass3_done=YES