1 .\" Copyright (c) 1994 Gordon W. Ross, Theo de Raadt
2 .\" Updated by Luigi Rizzo
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. The name of the author may not be used to endorse or promote products
14 .\" derived from this software without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 .\" $FreeBSD: src/share/man/man8/diskless.8,v 1.6.2.9 2003/01/25 18:56:44 dillon Exp $
28 .\" $DragonFly: src/share/man/man8/diskless.8,v 1.12 2008/08/30 19:02:49 swildner Exp $
35 .Nd booting a system over the network
37 The ability to boot a machine over the network is useful for
41 machines, or as a temporary measure while repairing or
42 re-installing filesystems on a local disk.
43 This file provides a general description of the interactions between
44 a client and its server when a client is booting over the network.
46 When booting a system over the network, there are three
47 phases of interaction between client and server:
51 The stage-1 bootstrap loads a boot program, from
53 The boot program loads a kernel.
55 The kernel does NFS mounts for root.
58 Each of these phases are described in further detail below.
60 In phase 1, the stage-1 bootstrap code loads a boot program,
61 which is typically able to control the network card.
62 The boot program can be stored in the BIOS, in a BOOT ROM
63 located on the network card (PXE, etherboot, netboot),
64 or come from a disk unit (e.g. etherboot or netboot).
66 In phase 2, the boot program loads a kernel.
68 this phase depends on the design of the boot program.
69 Typically, the boot program uses the
73 protocol to get the client's IP address and other boot
74 information, including but not limited to
75 the IP addresses of the NFS server, router and nameserver,
76 and the name of the kernel to load.
77 Then the kernel is loaded, either directly using NFS
78 (as it is the case for etherboot and netboot),
79 or through an intermediate loader called pxeboot and
80 loaded using TFTP or NFS.
82 In phase 3, the kernel again uses DHCP or BOOTP to acquire
83 configuration information, and proceeds to mount the
84 root filesystem and start operation. The boot
85 scripts recognize a diskless startup and perform
87 .Pa /etc/rc.d/initdiskless
89 .Pa /etc/rc.d/diskless .
91 In order to run a diskless client, you need the following:
94 An NFS server which exports a root and /usr partition with
95 appropriate permissions.
97 scripts work with readonly partitions, as long as root is exported with
99 so that some system files can be accessed.
102 can contain the following lines:
103 .Bd -literal -offset indent
104 <ROOT> -ro -maproot=0 -alldirs <list of diskless clients>
105 /usr -ro -alldirs <list of diskless clients>
110 is the mountpoint on the server of the root partition.
112 .Pa /usr/share/examples/diskless/clone_root
113 can be used to create a shared readonly root partition,
114 but in many cases you may decide to export
115 (again as readonly) the root directory used by
128 .Pa /etc/inetd.conf .
131 can be the following:
132 .Bd -literal -offset indent
134 hn:ht=1:vm=rfc1048:\\
138 :rp="<SERVER>:<ROOT>":
140 <CLIENT>:ha=0123456789ab:tc=.default
148 have the obvious meanings.
150 A properly initialized root partition.
152 .Pa /usr/share/examples/diskless/clone_root
153 can help in creating it, using the server's root partition
154 as a reference. If you are just starting out you should
155 simply use the server's own root directory,
157 and not try to clone it.
159 You often do not want to use the same
163 files for the diskless boot as you do on the server. The diskless boot
164 scripts provide a mechanism through which you can override various files
167 (as well as other subdirectories of root). The scripts provide four
168 overriding directories situated in
171 .Pa /conf/<BROADCAST-IP> ,
173 .Pa /conf/<MACHINE-IP> .
174 You should always create
176 which will entirely replace the server's
178 on the diskless machine.
179 You can clone the server's
181 here or you can create a special file which tells the diskless boot scripts
182 to remount the server's
186 You do this by creating the file
187 .Pa /conf/base/etc/diskless_remount
188 containing the mount point to use as a basis of the diskless machine's
190 For example, the file might contain:
191 .Bd -literal -offset 4n
195 The diskless scripts create memory filesystems to hold the overridden
196 directories. Only a 2MB partition is created by default, which may not
197 be sufficient for your purposes. To override this you can create the
199 .Pa /conf/base/etc/md_size
200 containing the size, in 512 byte sectors, of the memory disk to create
203 You then typically provide file-by-file overrides in the
204 .Pa /conf/default/etc
205 directory. At a minimum you must provides overrides for
211 .Pa /conf/default/etc/fstab ,
212 .Pa /conf/default/etc/rc.conf ,
214 .Pa /conf/default/etc/rc.local .
216 Overrides are hierarchical. You can supply network-specific defaults
218 .Pa /conf/<BROADCAST-IP>/etc
219 directory, where <BROADCAST-IP> represents the broadcast IP address of
220 the diskless system as given to it via
226 features work in any of these directories.
227 The configuration feature works on directories other then
229 you simply create the directory you wish to replace or override in
230 .Pa /conf/{base,default,<BROADCAST-IP>,<MACHINE-IP>}/*
231 and work it in the same way that you work
234 As a minimum, you normally need to have the following in
235 .Pa /conf/default/etc/fstab
236 .Bd -literal -offset indent
237 <SERVER>:<ROOT> / nfs ro 0 0
238 <SERVER>:/usr /usr nfs ro 0 0
239 proc /proc procfs rw 0 0
242 You also need to create a customized version of
243 .Pa /conf/default/etc/rc.conf
245 the startup options for the diskless client, and
246 .Pa /conf/default/etc/rc.local
247 which could be empty but prevents the server's own
249 from leaking onto the diskless system.
254 you will not need to set
258 because these will be already set by the startup code.
259 Finally, it might be convenient to use a
263 as the switch variable to do machine-specific configuration
264 in case a number of diskless clients share the same configuration
267 The kernel for the diskless clients, which will be loaded using
268 NFS or TFTP, should be built with at least the following options:
272 .D1 Cd options BOOTP_NFSROOT
273 .D1 Cd options BOOTP_COMPAT
275 If you use the firewall, remember to default to open or your kernel
276 will not be able to send/receive the bootp packets.
279 Be warned that using unencrypted NFS to mount root and user
280 partitions may expose information such as
283 .Bl -tag -width /usr/share/examples/diskless/clone_root -compact
284 .It Pa /usr/share/examples/diskless/clone_root
285 script to clone root filesystem
290 .It Pa /conf/<BROADCAST-IP>
292 .It Pa /conf/<MACHINE-IP>
294 .It Pa /conf/{base,default,<BROADCAST-IP>,<MACHINE-IP>}/<DIR>
297 .It Pa /conf/{base,default,<BROADCAST-IP>,<MACHINE-IP>}/<DIR>/md_size
298 size of memory disk for
300 .It Pa /conf/{base,default,<BROADCAST-IP>,<MACHINE-IP>}/<DIR>/diskless_remount
303 .It Pa /conf/{base,default,<BROADCAST-IP>,<MACHINE-IP>}/<DIR>.cpio.gz
306 .It Pa /conf/{base,default,<BROADCAST-IP>,<MACHINE-IP>}/<DIR>.remove
316 .Xr dhcpd 8 Pq Pa pkgsrc/net/isc-dhcpd4 ,
324 This manpage is probably incomplete.
327 sometimes requires to write onto
328 the root partition, so the startup scripts mount MFS
329 filesystems on some locations (e.g.\&
334 trying to preserve the original content.
335 The process might not handle all cases.