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