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