1993-03-21 12:45:37 +03:00
|
|
|
#!/bin/sh -
|
|
|
|
#
|
1995-12-17 21:31:09 +03:00
|
|
|
# $NetBSD: netstart,v 1.22 1995/12/17 18:31:09 perry Exp $
|
1993-03-21 12:45:37 +03:00
|
|
|
# @(#)netstart 5.9 (Berkeley) 3/30/91
|
|
|
|
|
1993-04-02 11:59:12 +04:00
|
|
|
# set these to "NO" to turn them off. otherwise, they're used as flags
|
1993-11-07 13:36:48 +03:00
|
|
|
routed_flags=-q
|
1994-01-10 19:43:06 +03:00
|
|
|
rarpd_flags=NO # for 'normal' use: rarpd_flags="-a"
|
1994-01-10 19:57:24 +03:00
|
|
|
bootparamd_flags=NO # for 'normal' use: bootparamd_flags=""
|
1995-09-02 21:30:41 +04:00
|
|
|
rbootd_flags=NO # for 'normal' use: rbootd_flags=""
|
1993-11-07 13:42:45 +03:00
|
|
|
sendmail_flags=NO # for 'normal' use: sendmail_flags="-bd -q30m"
|
1994-09-17 03:38:01 +04:00
|
|
|
named_flags=NO # for 'normal' use: named_flags=""
|
1993-11-07 13:36:48 +03:00
|
|
|
timed_flags=
|
1993-04-02 11:59:12 +04:00
|
|
|
|
|
|
|
# set the following to "YES" to turn them on
|
1993-03-21 12:45:37 +03:00
|
|
|
rwhod=NO
|
1993-04-02 11:59:12 +04:00
|
|
|
nfs_server=NO
|
1993-04-11 00:15:30 +04:00
|
|
|
nfs_client=NO
|
1993-04-02 11:59:12 +04:00
|
|
|
gated=NO
|
|
|
|
kerberos_server=NO
|
1994-01-05 09:32:13 +03:00
|
|
|
amd=NO
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1993-11-07 13:36:48 +03:00
|
|
|
# miscellaneous other flags
|
1994-03-14 07:14:13 +03:00
|
|
|
# only used if the appropriate server is marked YES above
|
1993-11-07 13:36:48 +03:00
|
|
|
gated_flags=
|
1994-03-14 07:14:13 +03:00
|
|
|
amd_dir=/amd # AMD's mount directory
|
|
|
|
amd_master=/etc/amd/master # AMD 'master' map
|
1993-11-07 13:36:48 +03:00
|
|
|
|
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
|
|
|
|
1993-04-02 11:59:12 +04:00
|
|
|
# configure all of the interfaces which we know about.
|
|
|
|
# do this by reading /etc/hostname.* files, where * is the name
|
|
|
|
# of a given interface.
|
|
|
|
#
|
|
|
|
# these files are formatted like the following, but with no # at the
|
|
|
|
# beginning of the line
|
|
|
|
#
|
|
|
|
# addr_family hostname netmask broadcast_addr options
|
|
|
|
# dest dest_addr
|
|
|
|
#
|
|
|
|
# addr_family is the address family of the interface, generally inet
|
|
|
|
# hostname is the host name that belongs to the interface, in /etc/hosts.
|
|
|
|
# netmask is the network mask for the interface.
|
|
|
|
# broadcast_addr is the broadcast address for the interface
|
|
|
|
# options are misc. options to ifconfig for the interface.
|
|
|
|
#
|
|
|
|
# dest is simply the string "dest" (no quotes, though) if the interface
|
|
|
|
# has a "destination" (i.e. it's a point-to-point link, like SLIP).
|
|
|
|
# dest_addr is the hostname of the other end of the link, in /etc/hosts
|
|
|
|
#
|
|
|
|
# the only required contents of the file are the addr_family field
|
|
|
|
# and the hostname.
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1993-04-02 11:59:12 +04:00
|
|
|
(
|
|
|
|
tmp="$IFS"
|
|
|
|
IFS="$IFS."
|
1994-04-10 04:28:31 +04:00
|
|
|
set -- `echo /etc/hostname*`
|
1993-04-02 11:59:12 +04:00
|
|
|
IFS=$tmp
|
|
|
|
unset tmp
|
|
|
|
|
|
|
|
while [ $# -ge 2 ] ; do
|
|
|
|
shift # get rid of "hostname"
|
|
|
|
(
|
|
|
|
read af name mask bcaddr extras
|
|
|
|
read dt dtaddr
|
|
|
|
|
|
|
|
if [ ! -n "$name" ]; then
|
|
|
|
echo "/etc/hostname.$1: invalid network configuration file"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
cmd="ifconfig $1 $af $name "
|
|
|
|
if [ "${dt}" = "dest" ]; then cmd="$cmd $dtaddr"; fi
|
|
|
|
if [ -n "$mask" ]; then cmd="$cmd netmask $mask"; fi
|
1994-06-30 12:17:11 +04:00
|
|
|
if [ -n "$bcaddr" -a "X$bcaddr" != "XNONE" ]; then
|
|
|
|
cmd="$cmd broadcast $bcaddr";
|
|
|
|
fi
|
1993-04-02 11:59:12 +04:00
|
|
|
cmd="$cmd $extras"
|
|
|
|
|
|
|
|
$cmd
|
|
|
|
) < /etc/hostname.$1
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
)
|
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
|
|
|
|
# address interface
|
|
|
|
if [ -f /etc/ifaliases ]; then
|
|
|
|
(
|
|
|
|
set -- `cat /etc/ifaliases`
|
|
|
|
|
|
|
|
while [ $# -ge 2 ] ; do
|
|
|
|
ifconfig $2 inet alias $1
|
|
|
|
route add $1 localhost
|
|
|
|
shift 2
|
|
|
|
done
|
|
|
|
)
|
|
|
|
fi
|