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