1.\" $NetBSD: diskless.8,v 1.11 1997/06/16 07:50:35 mrg Exp $ 2.\" 3.\" Copyright (c) 1994 Gordon W. Ross, Theo de Raadt 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. The name of the author may not be used to endorse or promote products 15.\" derived from this software without specific prior written permission. 16.\" 17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27.\" 28.\" $FreeBSD$ 29.\" 30.Dd October 2, 1994 31.Dt DISKLESS 8 32.Os 33.Sh NAME 34.Nm diskless 35.Nd booting a system over the network 36.Sh DESCRIPTION 37The ability to boot a machine over the network is useful for 38.Em diskless 39or 40.Em dataless 41machines, or as a temporary measure while repairing or 42re-installing filesystems on a local disk. 43This file provides a general description of the interactions between 44a client and its server when a client is booting over the network. 45The general description is followed by specific instructions for 46configuring a server for diskless Sun clients. 47.Sh OPERATION 48When booting a system over the network, there are three 49phases of interaction between client and server: 50.Pp 51.Bl -tag -width 1.2 -compact 52.It 1. 53The PROM (or stage-1 bootstrap) loads a boot program. 54.It 2. 55The boot program loads a kernel. 56.It 3. 57The kernel does NFS mounts for root. 58.El 59.Pp 60Each of these phases are described in further detail below. 61.Pp 62In phase 1, the PROM loads a boot program. PROM designs 63vary widely, so this phase is inherently machine-specific. 64Sun machines use 65.Tn RARP 66to determine the client's 67.Tn IP 68address and then use 69.Tn TFTP 70to download a boot program from whoever sent the 71.Tn RARP 72reply. HP 300-series machines use the 73.Tn HP Remote Maintenance Protocol 74to download a boot program. 75Typical personal computers may load a 76network boot program either from diskette or 77using a special PROM on the network card. 78.Pp 79In phase 2, the boot program loads a kernel. Operation in 80this phase depends on the design of the boot program. 81(The design described here is the one used by Sun and NetBSD/hp300.) 82The boot program: 83.Pp 84.Bl -tag -width 2.2 -compact 85.It 2.1 86gets the client IP address using 87.Tn RARP . 88.It 2.2 89gets the client name and server 90.Tn IP 91address by broadcasting an 92.Tn RPC / BOOTPARAMS / WHOAMI 93request with the client IP address. 94.It 2.3 95gets the server path for this client's 96root using an 97.Tn RPC / BOOTPARAMS / GETFILE 98request with the client name. 99.It 2.4 100gets the root file handle by calling 101.Xr mountd 8 102with the server path for the client root. 103.It 2.5 104gets the kernel file handle by calling 105.Tn NFS 106lookup on the root file handle. 107.It 2.6 108loads the kernel using 109.Tn NFS 110read calls on the kernel file handle. 111.It 2.7 112transfers control to the kernel entry point. 113.El 114.Pp 115In phase 3, the kernel does NFS mounts for root. 116The kernel repeats much of the work done by the boot program 117because there is no standard way for the boot program to pass 118the information it gathered on to the kernel. 119The procedure used by the kernel is as follows: 120.Pp 121.Bl -tag -width 2.2 -compact 122.It 3.1 123The kernel finds a boot server using the same procedure 124as described in steps 2.1 and 2.2 above. 125.It 3.2 126The kernel gets the 127.Tn NFS 128file handle for root using the same procedure 129as described in steps 2.3 through 2.5 above. 130.It 3.3 131The kernel calls the 132.Tn NFS 133getattr function to get the last-modified time of the root 134directory, and uses it to check the system clock. 135.El 136.Sh CONFIGURATION 137Before a client can boot over the network, 138its server must be configured correctly. 139This example will demonstrate how a Sun client 140might be configured -- other clients should be similar. 141.Pp 142Assuming the client's hostname is to be 143"myclient", 144.Pp 145.Bl -tag -width 2.1 -compact 146.It 1. 147Add an entry to 148.Pa /etc/ethers 149corresponding to the client's ethernet address: 150.Bd -literal -offset indent -compact 1518:0:20:7:c5:c7 myclient 152.Ed 153This will be used by 154.Xr rarpd 8 . 155.Pp 156.It 2. 157Assign an IP address for myclient in your 158.Pa /etc/hosts 159or DNS database: 160.Bd -literal -offset indent -compact 161192.197.96.12 myclient 162.Ed 163.Pp 164.It 3. 165If booting a Sun machine, ensure that 166.Pa /etc/inetd.conf 167is configured to run 168.Xr tftpd 8 169in the directory 170.Pa /tftpboot . 171.Pp 172If booting an HP 300-series machine, ensure that 173.Pa /etc/rbootd.conf 174is configured properly to transfer the boot program to the client. 175An entry might look like this: 176.Bd -literal -offset indent -compact 17708:00:09:01:23:E6 SYS_UBOOT # myclient 178.Ed 179.Pp 180See the 181.Xr rbootd 8 182manual page for more information. 183.Pp 184.It 4. 185If booting a SPARC machine, install a copy of the appropriate diskless boot 186loader (such as 187.Pa /usr/mdec/boot ) 188in the 189.Pa /tftpboot 190directory. 191Make a link such that the boot program is 192accessible by a file name composed of the client's IP address 193in HEX, a dot, and the architecture name (all upper case). 194For example: 195.Bd -literal -offset indent -compact 196# cd /tftpboot 197# ln -s boot C0C5600C.SUN4 198.Ed 199.Pp 200For a Sun3 machine, the name would be just C0C5600C 201(the sun3 PROM does not append the architecture name). The name 202used is architecture dependent, it simply has to match what the 203booting client's PROM wishes to it to be. 204If the client's PROM fails to fetch the expected file, 205.Xr tcpdump 1 206can be used to discover which filename the client is trying to read. 207.Pp 208If booting an HP 300-series machine, ensure that the network boot program 209.Pa SYS_UBOOT 210(which may be called 211.Pa uboot.lif 212before installation) 213is installed in the directory 214.Pa /usr/mdec/rbootd . 215 216.It 5. 217Add myclient to the bootparams database 218.Pa /etc/bootparams : 219.Bd -literal -offset indent -compact 220myclient root=server:/export/myclient/root 221.Ed 222.Pp 223Note: For the swap file to be mountable, you have to make sure that mountd is 224started with the 225.Fl r 226flag. 227 228.It 6. 229Build the swap file for myclient: 230.Bd -literal -offset indent -compact 231# mkdir /export/myclient 232# cd /export/myclient 233# dd if=/dev/zero of=swap bs=16k count=1024 234.Ed 235This creates a 16 Megabyte swap file. 236.Pp 237.It 7. 238Populate myclient's 239.Pa / 240filesystem on the server. How this is done depends on the 241client architecture and the version of the NetBSD distribution. 242It can be as simple as copying and modifying the server's root 243filesystem, or perhaps you need to get those files out of the 244standard binary distribution. 245.Pp 246Note that, unlike SunOS, you need to create a mount point for the 247client's swap: 248.Bd -literal -offset indent -compact 249# mkdir /export/myclient/root/swap 250.Ed 251.Pp 252.It 8. 253Export the required filesystems in 254.Pa /etc/exports : 255.Bd -literal -offset indent -compact 256/usr -ro myclient 257# for SunOS: 258# /export/myclient -rw=myclient,root=myclient 259# for NetBSD: 260/export/myclient -maproot=root -alldirs myclient 261.Ed 262.Pp 263If the server and client are of the same architecture, then the client 264can share the server's 265.Pa /usr 266filesystem (as is done above). 267If not, you must build a properly fleshed out 268.Pa /usr 269partition for the client in some other place. 270.Pp 271If your server was a sparc, and your client a sun3, 272you might create and fill 273.Pa /export/usr.sun3 274and then use the following 275.Pa /etc/exports 276lines: 277.Bd -literal -offset indent -compact 278/export/usr.sun3 -ro myclient 279/export/myclient -rw=myclient,root=myclient 280.Ed 281.Pp 282.It 9. 283Copy and customize at least the following files in 284.Pa /export/myclient/root : 285.Bd -literal -offset indent -compact 286# cd /export/myclient/root/etc 287# cp fstab.nfs fstab 288# cp /etc/hosts hosts 289# echo myclient > myname 290# echo 192.197.96.12 > hostname.le0 291.Ed 292.Pp 293Note that "le0" above should be replaced with the name of 294the network interface that the client will use for booting. 295.Pp 296.It 10. 297Correct the critical mount points and the swap file in the client's 298.Pa /etc/fstab 299(which will be 300.Pa /export/myclient/root/etc/fstab ) 301ie. 302.Bd -literal -offset indent -compact 303myserver:/export/myclient/root / nfs rw 0 0 304myserver:/usr /usr nfs rw 0 0 305myserver:/export/myclient/swap none swap sw,nfsmntpt=/swap 306.Ed 307.Pp 308Note, you must specify the swap file in 309.Pa /etc/fstab 310or it will not be used! 311.El 312.Sh FILES 313.Bl -tag -width /usr/mdec/rbootd -compact 314.It Pa /etc/ethers 315Ethernet addresses of known clients 316.It Pa /etc/bootparams 317client root pathname 318.It Pa /etc/exports 319exported NFS mount points 320.It Pa /etc/rbootd.conf 321configuration file for HP Remote Boot Daemon 322.It Pa /tftpboot 323location of boot programs loaded by the Sun PROM 324.It Pa /usr/mdec/rbootd 325location of boot programs loaded by the HP Boot ROM 326.El 327.Sh SEE ALSO 328.Xr bootparams 5 , 329.Xr ethers 5 , 330.Xr exports 5 , 331.Xr bootparamd 8 , 332.Xr mountd 8 , 333.Xr nfsd 8 , 334.Xr rarpd 8 , 335.Xr rbootd 8 , 336.Xr reboot 8 , 337.Xr tftpd 8 338