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