[BACK]Return to netstart CVS log [TXT][DIR] Up to [local] / src / etc

Annotation of src/etc/netstart, Revision 1.3

1.1       deraadt     1: #!/bin/sh -
                      2: #
1.3     ! deraadt     3: #      $NetBSD: netstart,v 1.23 1995/12/30 01:30:03 thorpej Exp $
1.1       deraadt     4: #      @(#)netstart    5.9 (Berkeley) 3/30/91
                      5:
                      6: # set these to "NO" to turn them off.  otherwise, they're used as flags
                      7: routed_flags=-q
1.3     ! deraadt     8: mrouted_flags=NO       # for 'normal' use: mrouted_flags=""
1.1       deraadt     9: rarpd_flags=NO         # for 'normal' use: rarpd_flags="-a"
                     10: bootparamd_flags=NO    # for 'normal' use: bootparamd_flags=""
                     11: rbootd_flags=NO                # for 'normal' use: rbootd_flags=""
                     12: sendmail_flags=NO      # for 'normal' use: sendmail_flags="-bd -q30m"
                     13: named_flags=NO         # for 'normal' use: named_flags=""
                     14: timed_flags=
                     15:
                     16: # set the following to "YES" to turn them on
                     17: rwhod=NO
                     18: nfs_server=NO
                     19: nfs_client=NO
                     20: gated=NO
                     21: kerberos_server=NO
                     22: amd=NO
                     23:
                     24: # miscellaneous other flags
                     25: # only used if the appropriate server is marked YES above
                     26: gated_flags=
                     27: amd_dir=/amd                   # AMD's mount directory
                     28: amd_master=/etc/amd/master     # AMD 'master' map
                     29:
                     30: # /etc/myname contains my symbolic name
                     31: #
                     32: hostname=`cat /etc/myname`
                     33: hostname $hostname
                     34: if [ -f /etc/defaultdomain ]; then
                     35:        domainname `cat /etc/defaultdomain`
                     36: fi
                     37:
                     38: # configure all of the interfaces which we know about.
                     39: # do this by reading /etc/hostname.* files, where * is the name
                     40: # of a given interface.
                     41: #
                     42: # these files are formatted like the following, but with no # at the
                     43: # beginning of the line
                     44: #
                     45: # addr_family hostname netmask broadcast_addr options
                     46: # dest dest_addr
                     47: #
                     48: # addr_family is the address family of the interface, generally inet
                     49: # hostname is the host name that belongs to the interface, in /etc/hosts.
                     50: # netmask is the network mask for the interface.
                     51: # broadcast_addr is the broadcast address for the interface
                     52: # options are misc. options to ifconfig for the interface.
                     53: #
                     54: # dest is simply the string "dest" (no quotes, though) if the interface
                     55: # has a "destination" (i.e. it's a point-to-point link, like SLIP).
                     56: # dest_addr is the hostname of the other end of the link, in /etc/hosts
                     57: #
                     58: # the only required contents of the file are the addr_family field
                     59: # and the hostname.
                     60:
                     61: (
                     62:     tmp="$IFS"
                     63:     IFS="$IFS."
                     64:     set -- `echo /etc/hostname*`
                     65:     IFS=$tmp
                     66:     unset tmp
                     67:
                     68:     while [ $# -ge 2 ] ; do
                     69:         shift            # get rid of "hostname"
                     70:         (
                     71:             read af name mask bcaddr extras
                     72:             read dt dtaddr
                     73:
                     74:             if [ ! -n "$name" ]; then
                     75:                 echo "/etc/hostname.$1: invalid network configuration file"
                     76:                 exit
                     77:             fi
                     78:
                     79:            cmd="ifconfig $1 $af $name "
                     80:            if [ "${dt}" = "dest" ]; then cmd="$cmd $dtaddr"; fi
                     81:            if [ -n "$mask" ]; then cmd="$cmd netmask $mask"; fi
                     82:            if [ -n "$bcaddr" -a "X$bcaddr" != "XNONE" ]; then
                     83:                cmd="$cmd broadcast $bcaddr";
                     84:            fi
                     85:            cmd="$cmd $extras"
                     86:
                     87:            $cmd
                     88:         ) < /etc/hostname.$1
                     89:         shift
                     90:     done
                     91: )
                     92:
                     93: # set the address for the loopback interface
                     94: ifconfig lo0 inet localhost
                     95:
                     96: # use loopback, not the wire
                     97: route add $hostname localhost
                     98:
                     99: # /etc/mygate, if it exists, contains the name of my gateway host
                    100: # that name must be in /etc/hosts.
                    101: if [ -f /etc/mygate ]; then
                    102:        route add default `cat /etc/mygate`
1.2       deraadt   103: fi
                    104:
                    105: # /etc/ifaliases, if it exists, contains the names of additional IP
                    106: # addresses for each interface. It is formatted as a series of lines
                    107: # that contain
                    108: # address interface
                    109: if [ -f /etc/ifaliases ]; then
                    110: (
                    111:        set -- `cat /etc/ifaliases`
                    112:
                    113:        while [ $# -ge 2 ] ; do
                    114:                ifconfig $2 inet alias $1
                    115:                route add $1 localhost
                    116:                shift 2
                    117:        done
                    118: )
1.1       deraadt   119: fi