Commit | Line | Data |
---|---|---|
25767e9e RG |
1 | #!/bin/sh - |
2 | # | |
3 | # @(#)netstart 5.9 (Berkeley) 3/30/91 | |
4 | ||
c70d8950 | 5 | # set these to "NO" to turn them off. otherwise, they're used as flags |
25767e9e | 6 | routedflags=-q |
c70d8950 RG |
7 | timedflags= |
8 | ||
9 | # set the following to "YES" to turn them on | |
25767e9e | 10 | rwhod=NO |
c70d8950 RG |
11 | nfs_server=NO |
12 | nfs_client=NO | |
13 | name_server=NO | |
14 | gated=NO | |
15 | kerberos_server=NO | |
25767e9e | 16 | |
c70d8950 | 17 | # /etc/myname contains my symbolic name |
25767e9e | 18 | # |
c70d8950 | 19 | hostname=`cat /etc/myname` |
25767e9e | 20 | hostname $hostname |
c70d8950 RG |
21 | if [ -f /etc/defaultdomain ]; then |
22 | domainname `cat /etc/defaultdomain` | |
23 | fi | |
24 | ||
25 | # configure all of the interfaces which we know about. | |
26 | # do this by reading /etc/hostname.* files, where * is the name | |
27 | # of a given interface. | |
28 | # | |
29 | # these files are formatted like the following, but with no # at the | |
30 | # beginning of the line | |
31 | # | |
32 | # addr_family hostname netmask broadcast_addr options | |
33 | # dest dest_addr | |
34 | # | |
35 | # addr_family is the address family of the interface, generally inet | |
36 | # hostname is the host name that belongs to the interface, in /etc/hosts. | |
37 | # netmask is the network mask for the interface. | |
38 | # broadcast_addr is the broadcast address for the interface | |
39 | # options are misc. options to ifconfig for the interface. | |
40 | # | |
41 | # dest is simply the string "dest" (no quotes, though) if the interface | |
42 | # has a "destination" (i.e. it's a point-to-point link, like SLIP). | |
43 | # dest_addr is the hostname of the other end of the link, in /etc/hosts | |
44 | # | |
45 | # the only required contents of the file are the addr_family field | |
46 | # and the hostname. | |
47 | ||
48 | ( | |
49 | tmp="$IFS" | |
50 | IFS="$IFS." | |
51 | set `echo /etc/hostname.*` | |
52 | IFS=$tmp | |
53 | unset tmp | |
54 | ||
55 | while [ $# -ge 2 ] ; do | |
56 | shift # get rid of "hostname" | |
57 | ( | |
58 | read af name mask bcaddr extras | |
59 | read dt dtaddr | |
25767e9e | 60 | |
c70d8950 RG |
61 | if [ ! -n "$name" ]; then |
62 | echo "/etc/hostname.$1: invalid network configuration file" | |
63 | exit | |
64 | fi | |
25767e9e | 65 | |
c70d8950 RG |
66 | cmd="ifconfig $1 $af $name " |
67 | if [ "${dt}" = "dest" ]; then cmd="$cmd $dtaddr"; fi | |
68 | if [ -n "$mask" ]; then cmd="$cmd netmask $mask"; fi | |
69 | if [ -n "$bcaddr" ]; then cmd="$cmd broadcast $bcaddr"; fi | |
70 | cmd="$cmd $extras" | |
71 | ||
72 | $cmd | |
73 | ) < /etc/hostname.$1 | |
74 | shift | |
75 | done | |
76 | ) | |
25767e9e RG |
77 | |
78 | # set the address for the loopback interface | |
c70d8950 | 79 | ifconfig lo0 inet localhost |
25767e9e RG |
80 | |
81 | # use loopback, not the wire | |
82 | route add $hostname localhost | |
c70d8950 RG |
83 | |
84 | # /etc/mygate, if it exists, contains the name of my gateway host | |
85 | # that name must be in /etc/hosts. | |
86 | if [ -f /etc/mygate ]; then | |
87 | route add default `cat /etc/mygate` | |
88 | fi | |
89 | ||
90 | if [ -f /usr/sbin/ypbind -a -d /var/yp ]; then | |
91 | ypbind; echo ypbind | |
92 | fi |