README.BOOTP revision 43240
1
2		        BOOTP configuration mechanism
3
4			    Matthew Dillon
5			    dillon@backplane.com
6
7    BOOTP kernels automatically configure the machine's IP address, netmask,
8    optional NFS based swap, and NFS based root mount.  The NFS server will
9    typically export a shared read-only /, /usr, and /var to any number of
10    workstations.  The shared read-only root is typically either the server's
11    own root or, if you are more security concious, a contrived root.
12
13    The key issue with starting up a BOOTP kernel is that you typically want
14    to export read-only NFS partitions from the server, yet still be able to
15    customize each workstation ( or not ).
16
17    The current /etc/rc.diskless file takes over the function of mounting 
18    'disks' and retargets rc.conf.local and rc.local from /etc
19    to /conf/$IP_OF_WORKSTATION.  The typical automatic configuration and
20    mounting of disks in /etc/rc is bypassed, but most if not all rc.conf
21    style options are left intact.
22
23    In the BOOTP workstation /conf/$IP/rc.conf.local, you must typically
24    turn *OFF* most of the system option defaults in /etc/rc.conf as well
25    as do additional custom configuration of your environment
26
27    The /usr/src/share/examples/diskless directory contains a typical
28    X session / sshd based workstation configuration.  The directories
29    involved are HT.DISKLESS/ and 192.157.86.12/. 
30
31    Essentially, the $IP/ directory ( which rc.diskless looks for in
32    /conf/$IP/ ) contains all the junk.  The HT.DISKLESS directory exists
33    to hold common elements of your custom configuration so you do not have
34    to repeat those elements for each workstation.  The example /conf 
35    structure included here shows how to create a working sshd setup ( so
36    you can sshd into the diskless workstation ), retarget xdm's pid and error
37    files to R+W directories if /usr is mounted read-only, and retarget
38    syslogd and other programs.  This example is not designed to run out of
39    the box and some modifications are required.
40
41    Typically you should start with a clean slate by tar-copying this example
42    directory to /conf and then hack on it in /conf rather then in 
43    /usr/share/examples/diskless.
44
45				BOOTP CLIENT SETUP
46
47    Here is a typical kernel configuration.  If you have only one ethernet
48    interface you do not need to wire BOOTP to a specific interface name.
49    BOOTP requires NFS and NFS_ROOT, and our boot scripts require MFS.  If
50    your /tmp is *not* a softlink to /var/tmp, the scripts also require NULLFS
51
52# BootP
53#
54options         BOOTP           # Use BOOTP to obtain IP address/hostname
55options         BOOTP_NFSROOT   # NFS mount root filesystem using BOOTP info
56options         "BOOTP_NFSV3"   # Use NFS v3 to NFS mount rootoptions
57options         BOOTP_COMPAT    # Workaround for broken bootp daemons.
58#options         "BOOTP_WIRED_TO=de0"
59
60options         MFS                     # Memory File System
61options         NFS                     # Network Filesystem
62options         NFS_ROOT		# Nfs can be root
63options		NULLFS			# nullfs to map /var/tmp to /tmp
64
65				BOOTP SERVER SETUP
66
67    The BOOTP server must be running on the same logical LAN as the the
68    BOOTP client(s).  You need to setup two things:
69
70    (1) You need to NFS-export /, /usr, and /var.
71
72    (2) You need to run a BOOTP server.  DHCPD can do this.
73
74
75    NFS Export:
76
77	Here is an example "/etc/exports" file.
78
79/ -ro -maproot=root: -network 192.157.86.0 -mask 255.255.255.192
80/usr -ro -maproot=root: -network 192.157.86.0 -mask 255.255.255.192
81/var -ro -maproot=root: -network 192.157.86.0 -mask 255.255.255.192
82
83    In order to be an NFS server, the server must run portmap, mountd,
84    nfsd, and rpc.statd.  The standard NFS server options in /etc/rc.conf
85    will work ( you should put your overrides in /etc/rc.conf.local on the
86    server and not edit the distribution /etc/rc.conf, though ).
87
88    BOOTP Server:
89
90	This configuration file "/etc/dhcpd.conf" example is for 
91	the '/usr/ports/net/isc-dhcp' dhcpd port.
92
93	    subnet 192.157.86.0 netmask 255.255.255.192 {
94		# range if you want to run the core dhcpd service of
95		# dynamic IP assignment, but it is not used with BOOTP 
96		# workstations
97		range 192.157.86.32 192.157.86.62;
98
99		# misc configuration.
100		#
101		option routers 192.157.86.2;
102		option domain-name-servers 192.157.86.2;
103
104		server-name "apollo.fubar.com";
105		option subnet-mask 255.255.255.192;
106		option domain-name-servers 192.157.86.2;
107		option domain-name "fubar.com";
108		option broadcast-address 192.157.86.63;
109		option routers 192.157.86.2;
110	    }
111
112	    host test1 {
113		hardware ethernet 00:a0:c9:d3:38:25;
114		fixed-address 192.157.86.11;
115		option root-path "192.157.86.2:/";
116		option option-128 "192.157.86.2:/images/swap";
117	    }
118
119	    host test2 {
120	    #    hardware ethernet 00:e0:29:1d:16:09;
121		hardware ethernet 00:10:5a:a8:94:0e;
122		fixed-address 192.157.86.12;
123		option root-path "192.157.86.2:/";
124		option option-128 "192.157.86.2:/images/swap";
125	    }
126
127    SWAP.  This example includes options to automatically BOOTP configure
128    NFS swap on each workstation.  In order to use this capabilities you
129    need to NFS-export a swap directory READ+WRITE to the workstations.
130
131    You must then create a swap directory for each workstation you wish to
132    assign swap to.  In this example I created a dummy user 'lander' and
133    did an NFS export of /images/swap enforcing a UID of 'lander' for
134    all accesses.
135
136	apollo:/usr/ports/net# ls -la /images/swap
137	total 491786
138	drwxr-xr-x  2 root    wheel        512 Dec 28 07:00 .
139	drwxr-xr-x  8 root    wheel        512 Jan 20 10:54 ..
140	-rw-r--r--  1 lander  wheel   33554432 Dec 23 14:35 swap.192.157.86.11
141	-rw-r--r--  1 lander  wheel  335544320 Jan 24 16:55 swap.192.157.86.12
142	-rw-r--r--  1 lander  wheel  134217728 Jan 21 17:19 swap.192.157.86.6
143
144    A swap file is best created with dd:
145
146	# create a 32MB swap file for a BOOTP workstation
147	dd if=/dev/zero of=swap.IPADDRESS bs=1m count=32
148
149    It is generally a good idea to give your workstations some swap space,
150    but not a requirement if they have a lot of memory.
151
152