1993-03-21 12:45:37 +03:00
|
|
|
#!/bin/sh -
|
|
|
|
#
|
1997-04-29 08:55:05 +04:00
|
|
|
# $NetBSD: netstart,v 1.33 1997/04/29 04:55:05 scottr Exp $
|
1997-02-15 13:02:07 +03:00
|
|
|
# from: @(#)netstart 8.1 (Berkeley) 7/23/93
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-04-29 08:55:05 +04:00
|
|
|
if [ -f /etc/rc.conf ]; then
|
|
|
|
. /etc/rc.conf
|
|
|
|
fi
|
|
|
|
|
1993-04-02 11:59:12 +04:00
|
|
|
# /etc/myname contains my symbolic name
|
1993-03-21 12:45:37 +03:00
|
|
|
#
|
1993-04-02 11:59:12 +04:00
|
|
|
hostname=`cat /etc/myname`
|
1993-03-21 12:45:37 +03:00
|
|
|
hostname $hostname
|
1993-04-02 17:15:31 +04:00
|
|
|
if [ -f /etc/defaultdomain ]; then
|
1993-04-02 17:11:42 +04:00
|
|
|
domainname `cat /etc/defaultdomain`
|
|
|
|
fi
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-03-30 23:08:14 +04:00
|
|
|
# enable, flush and install packet filter rules before configuring interfaces.
|
1997-03-10 12:34:59 +03:00
|
|
|
if [ "$ipfilter" != NO ] && [ -f /etc/ipf.conf ]; then
|
1997-01-05 15:01:54 +03:00
|
|
|
echo 'installing packet filter rules ... '
|
1997-03-30 23:08:14 +04:00
|
|
|
ipf -E -Fa -f /etc/ipf.conf
|
1997-01-05 15:01:54 +03:00
|
|
|
fi
|
|
|
|
|
1997-04-01 23:36:17 +04:00
|
|
|
# Configure all of the network interfaces listed in $net_interfaces;
|
|
|
|
# if $net_interfaces is DEFAULT, grab all interfaces from ifconfig.
|
|
|
|
# In the following, "xxN" stands in for interface names, like "le0".
|
|
|
|
# For any interfaces that has an $ifconfig_xxN variable associated,
|
|
|
|
# we do "ifconfig xxN $ifconfig_xxN".
|
|
|
|
# If there is no such variable, we take the contents of the file
|
|
|
|
# /etc/ifconfig.xxN, and run "ifconfig xxN" repeatedly, using each
|
|
|
|
# line of the file as the arguments for a seperate "ifconfig" invocation.
|
1993-04-02 11:59:12 +04:00
|
|
|
#
|
1997-04-01 23:36:17 +04:00
|
|
|
# In order to configure an interface reasonably, you at the very least
|
|
|
|
# need to specify "[addr_family] [hostname]" (as in "inet my.domain.org"),
|
|
|
|
# and probably a netmask (as in "netmask 0xffffffe0"). You will
|
|
|
|
# frequently need to specify a media type, as in "media UTP", for
|
|
|
|
# interface cards with multiple media connections that do not autoconfigure.
|
|
|
|
# see the ifconfig manual page for details.
|
1993-04-02 11:59:12 +04:00
|
|
|
|
1997-04-01 23:36:17 +04:00
|
|
|
if [ "$net_interfaces" != NO ]; then
|
|
|
|
if [ "$net_interfaces" = DEFAULT ]; then
|
|
|
|
tmp="`ifconfig -l`"
|
|
|
|
else
|
|
|
|
tmp="$net_interfaces"
|
|
|
|
fi
|
|
|
|
echo -n "configuring network interfaces:"
|
|
|
|
for i in $tmp; do
|
|
|
|
eval `echo 'args=$ifconfig_'$i`
|
|
|
|
if [ ! -z "$args" ]; then
|
|
|
|
echo -n " $i"
|
|
|
|
ifconfig $i $args
|
|
|
|
elif [ -f /etc/ifconfig.$i ]; then
|
|
|
|
echo -n " $i"
|
|
|
|
(while read args; do
|
|
|
|
ifconfig $i $args
|
|
|
|
done) < /etc/ifconfig.$i
|
|
|
|
elif [ "$net_interfaces" != DEFAULT ]; then
|
|
|
|
echo
|
|
|
|
echo -n "/etc/ifconfig.$i missing"
|
|
|
|
echo -n "& ifconfig_$i not set"
|
|
|
|
echo "; interface $i can't be configured"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "."
|
|
|
|
fi
|
1993-04-02 11:59:12 +04:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
# set the address for the loopback interface
|
|
|
|
ifconfig lo0 inet localhost
|
|
|
|
|
|
|
|
# use loopback, not the wire
|
|
|
|
route add $hostname localhost
|
1993-04-02 11:59:12 +04:00
|
|
|
|
|
|
|
# /etc/mygate, if it exists, contains the name of my gateway host
|
|
|
|
# that name must be in /etc/hosts.
|
|
|
|
if [ -f /etc/mygate ]; then
|
|
|
|
route add default `cat /etc/mygate`
|
|
|
|
fi
|
1995-12-17 21:31:09 +03:00
|
|
|
|
|
|
|
# /etc/ifaliases, if it exists, contains the names of additional IP
|
|
|
|
# addresses for each interface. It is formatted as a series of lines
|
|
|
|
# that contain
|
1997-01-05 15:01:54 +03:00
|
|
|
# address interface netmask
|
1995-12-17 21:31:09 +03:00
|
|
|
if [ -f /etc/ifaliases ]; then
|
|
|
|
(
|
1997-01-05 15:01:54 +03:00
|
|
|
while read addr int net; do
|
1997-03-10 12:34:59 +03:00
|
|
|
if [ ! -n "$net" ]; then
|
1997-01-05 15:01:54 +03:00
|
|
|
ifconfig $int inet alias $addr
|
|
|
|
else
|
|
|
|
ifconfig $int inet alias $addr netmask $net
|
|
|
|
fi
|
|
|
|
route add $addr localhost
|
|
|
|
done
|
|
|
|
) < /etc/ifaliases
|
|
|
|
fi
|
1995-12-17 21:31:09 +03:00
|
|
|
|
1997-01-05 15:01:54 +03:00
|
|
|
if [ -s /etc/netstart.local ]; then
|
|
|
|
. /etc/netstart.local
|
1995-12-17 21:31:09 +03:00
|
|
|
fi
|