Annotation of src/etc/netstart, Revision 1.21
1.1 deraadt 1: #!/bin/sh -
2: #
1.21 ! provos 3: # $OpenBSD: netstart,v 1.20 1997/06/17 13:13:48 niklas 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.21 ! provos 14: photurisd_flags="-f" # for 'normal' use: photurisd_flags="-f"
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.1 deraadt 34: amd_dir=/amd # AMD's mount directory
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.1 deraadt 67:
68: # configure all of the interfaces which we know about.
69: # do this by reading /etc/hostname.* files, where * is the name
70: # of a given interface.
71: #
72: # these files are formatted like the following, but with no # at the
73: # beginning of the line
74: #
75: # addr_family hostname netmask broadcast_addr options
76: # dest dest_addr
77: #
78: # addr_family is the address family of the interface, generally inet
79: # hostname is the host name that belongs to the interface, in /etc/hosts.
80: # netmask is the network mask for the interface.
81: # broadcast_addr is the broadcast address for the interface
82: # options are misc. options to ifconfig for the interface.
83: #
84: # dest is simply the string "dest" (no quotes, though) if the interface
85: # has a "destination" (i.e. it's a point-to-point link, like SLIP).
86: # dest_addr is the hostname of the other end of the link, in /etc/hosts
87: #
88: # the only required contents of the file are the addr_family field
89: # and the hostname.
90:
91: (
92: tmp="$IFS"
93: IFS="$IFS."
94: set -- `echo /etc/hostname*`
95: IFS=$tmp
96: unset tmp
97:
98: while [ $# -ge 2 ] ; do
99: shift # get rid of "hostname"
100: (
101: read af name mask bcaddr extras
102: read dt dtaddr
103:
104: if [ ! -n "$name" ]; then
105: echo "/etc/hostname.$1: invalid network configuration file"
106: exit
107: fi
108:
109: cmd="ifconfig $1 $af $name "
110: if [ "${dt}" = "dest" ]; then cmd="$cmd $dtaddr"; fi
111: if [ -n "$mask" ]; then cmd="$cmd netmask $mask"; fi
112: if [ -n "$bcaddr" -a "X$bcaddr" != "XNONE" ]; then
113: cmd="$cmd broadcast $bcaddr";
114: fi
115: cmd="$cmd $extras"
116:
117: $cmd
118: ) < /etc/hostname.$1
119: shift
120: done
121: )
122:
123: # set the address for the loopback interface
124: ifconfig lo0 inet localhost
125:
1.14 deraadt 126: # /etc/mygate, if it exists, contains the name of my gateway host
127: # that name must be in /etc/hosts.
128: if [ -f /etc/mygate ]; then
129: route add default `cat /etc/mygate`
130: fi
131:
1.1 deraadt 132: # use loopback, not the wire
133: route add $hostname localhost
1.8 deraadt 134: route add -net 127 127.0.0.1 -reject
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: