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

Annotation of src/etc/netstart, Revision 1.14

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