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