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