Annotation of src/etc/netstart, Revision 1.4
1.1 deraadt 1: #!/bin/sh -
2: #
1.3 deraadt 3: # $NetBSD: netstart,v 1.23 1995/12/30 01:30:03 thorpej Exp $
1.1 deraadt 4: # @(#)netstart 5.9 (Berkeley) 3/30/91
5:
6: # set these to "NO" to turn them off. otherwise, they're used as flags
7: routed_flags=-q
1.3 deraadt 8: mrouted_flags=NO # for 'normal' use: mrouted_flags=""
1.1 deraadt 9: rarpd_flags=NO # for 'normal' use: rarpd_flags="-a"
10: bootparamd_flags=NO # for 'normal' use: bootparamd_flags=""
11: rbootd_flags=NO # for 'normal' use: rbootd_flags=""
12: sendmail_flags=NO # for 'normal' use: sendmail_flags="-bd -q30m"
13: named_flags=NO # for 'normal' use: named_flags=""
14: timed_flags=
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.1 deraadt 24:
25: # miscellaneous other flags
26: # only used if the appropriate server is marked YES above
27: gated_flags=
28: amd_dir=/amd # AMD's mount directory
29: amd_master=/etc/amd/master # AMD 'master' map
1.4 ! dm 30: ipfilter_rules=/etc/ipf.rules # Rules for IP packet filtering
! 31: ipmon_flags=-s # To disable logging, use ipmon_flags=NO
1.1 deraadt 32:
33: # /etc/myname contains my symbolic name
34: #
35: hostname=`cat /etc/myname`
36: hostname $hostname
37: if [ -f /etc/defaultdomain ]; then
38: domainname `cat /etc/defaultdomain`
1.4 ! dm 39: fi
! 40:
! 41: # Configure the IP filter before configuring network interfaces
! 42: #
! 43: if [ X"${ipfilter}" = X"YES" -a -f "${ipfilter_rules}" ]; then
! 44: echo 'configuring IP filter'
! 45: ipf -Fa -f ${ipfilter_rules} -E
! 46: else
! 47: ipfilter=NO
1.1 deraadt 48: fi
49:
50: # configure all of the interfaces which we know about.
51: # do this by reading /etc/hostname.* files, where * is the name
52: # of a given interface.
53: #
54: # these files are formatted like the following, but with no # at the
55: # beginning of the line
56: #
57: # addr_family hostname netmask broadcast_addr options
58: # dest dest_addr
59: #
60: # addr_family is the address family of the interface, generally inet
61: # hostname is the host name that belongs to the interface, in /etc/hosts.
62: # netmask is the network mask for the interface.
63: # broadcast_addr is the broadcast address for the interface
64: # options are misc. options to ifconfig for the interface.
65: #
66: # dest is simply the string "dest" (no quotes, though) if the interface
67: # has a "destination" (i.e. it's a point-to-point link, like SLIP).
68: # dest_addr is the hostname of the other end of the link, in /etc/hosts
69: #
70: # the only required contents of the file are the addr_family field
71: # and the hostname.
72:
73: (
74: tmp="$IFS"
75: IFS="$IFS."
76: set -- `echo /etc/hostname*`
77: IFS=$tmp
78: unset tmp
79:
80: while [ $# -ge 2 ] ; do
81: shift # get rid of "hostname"
82: (
83: read af name mask bcaddr extras
84: read dt dtaddr
85:
86: if [ ! -n "$name" ]; then
87: echo "/etc/hostname.$1: invalid network configuration file"
88: exit
89: fi
90:
91: cmd="ifconfig $1 $af $name "
92: if [ "${dt}" = "dest" ]; then cmd="$cmd $dtaddr"; fi
93: if [ -n "$mask" ]; then cmd="$cmd netmask $mask"; fi
94: if [ -n "$bcaddr" -a "X$bcaddr" != "XNONE" ]; then
95: cmd="$cmd broadcast $bcaddr";
96: fi
97: cmd="$cmd $extras"
98:
99: $cmd
100: ) < /etc/hostname.$1
101: shift
102: done
103: )
104:
105: # set the address for the loopback interface
106: ifconfig lo0 inet localhost
107:
108: # use loopback, not the wire
109: route add $hostname localhost
110:
111: # /etc/mygate, if it exists, contains the name of my gateway host
112: # that name must be in /etc/hosts.
113: if [ -f /etc/mygate ]; then
114: route add default `cat /etc/mygate`
1.2 deraadt 115: fi
116:
117: # /etc/ifaliases, if it exists, contains the names of additional IP
118: # addresses for each interface. It is formatted as a series of lines
119: # that contain
120: # address interface
121: if [ -f /etc/ifaliases ]; then
122: (
123: set -- `cat /etc/ifaliases`
124:
125: while [ $# -ge 2 ] ; do
126: ifconfig $2 inet alias $1
127: route add $1 localhost
128: shift 2
129: done
130: )
1.1 deraadt 131: fi