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