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

Annotation of src/etc/netstart, Revision 1.27

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