xref: /freebsd/share/man/man8/diskless.8 (revision 99253b64fbe4cf216438f09be7c8b6f39ab23a78)
1247ca3deSSteve Price.\" Copyright (c) 1994 Gordon W. Ross, Theo de Raadt
24f329666SBrian S. Dean.\" Updated by Luigi Rizzo
3247ca3deSSteve Price.\" All rights reserved.
4247ca3deSSteve Price.\"
5247ca3deSSteve Price.\" Redistribution and use in source and binary forms, with or without
6247ca3deSSteve Price.\" modification, are permitted provided that the following conditions
7247ca3deSSteve Price.\" are met:
8247ca3deSSteve Price.\" 1. Redistributions of source code must retain the above copyright
9247ca3deSSteve Price.\"    notice, this list of conditions and the following disclaimer.
10247ca3deSSteve Price.\" 2. Redistributions in binary form must reproduce the above copyright
11247ca3deSSteve Price.\"    notice, this list of conditions and the following disclaimer in the
12247ca3deSSteve Price.\"    documentation and/or other materials provided with the distribution.
13247ca3deSSteve Price.\" 3. The name of the author may not be used to endorse or promote products
14247ca3deSSteve Price.\"    derived from this software without specific prior written permission.
15247ca3deSSteve Price.\"
16247ca3deSSteve Price.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17247ca3deSSteve Price.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18247ca3deSSteve Price.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19247ca3deSSteve Price.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20247ca3deSSteve Price.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21247ca3deSSteve Price.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22247ca3deSSteve Price.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23247ca3deSSteve Price.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24247ca3deSSteve Price.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25247ca3deSSteve Price.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26950c15fcSAlexey Zelkin.\"
277f3dea24SPeter Wemm.\" $FreeBSD$
28247ca3deSSteve Price.\"
294f329666SBrian S. Dean.Dd April 18, 2001
30247ca3deSSteve Price.Dt DISKLESS 8
31247ca3deSSteve Price.Os
32247ca3deSSteve Price.Sh NAME
33247ca3deSSteve Price.Nm diskless
34247ca3deSSteve Price.Nd booting a system over the network
35247ca3deSSteve Price.Sh DESCRIPTION
36247ca3deSSteve PriceThe ability to boot a machine over the network is useful for
37950c15fcSAlexey Zelkin.Em diskless
38247ca3deSSteve Priceor
39950c15fcSAlexey Zelkin.Em dataless
40247ca3deSSteve Pricemachines, or as a temporary measure while repairing or
41247ca3deSSteve Pricere-installing filesystems on a local disk.
42247ca3deSSteve PriceThis file provides a general description of the interactions between
43247ca3deSSteve Pricea client and its server when a client is booting over the network.
44247ca3deSSteve Price.Sh OPERATION
45247ca3deSSteve PriceWhen booting a system over the network, there are three
46247ca3deSSteve Pricephases of interaction between client and server:
47247ca3deSSteve Price.Pp
483136363fSRuslan Ermilov.Bl -enum -compact
493136363fSRuslan Ermilov.It
504f329666SBrian S. DeanThe stage-1 bootstrap loads a boot program, from
513136363fSRuslan Ermilov.It
52247ca3deSSteve PriceThe boot program loads a kernel.
533136363fSRuslan Ermilov.It
54247ca3deSSteve PriceThe kernel does NFS mounts for root.
55247ca3deSSteve Price.El
56247ca3deSSteve Price.Pp
57247ca3deSSteve PriceEach of these phases are described in further detail below.
58247ca3deSSteve Price.Pp
594f329666SBrian S. DeanIn phase 1, the stage-1 bootstrap code loads a boot program,
604f329666SBrian S. Deanwhich is typically able to control the network card.
614f329666SBrian S. DeanThe boot program can be stored in the BIOS, in a BOOT ROM
624f329666SBrian S. Deanlocated on the network card (PXE, etherboot, netboot),
634f329666SBrian S. Deanor come from a disk unit (e.g. etherboot or netboot).
64247ca3deSSteve Price.Pp
6579731c7bSRuslan ErmilovIn phase 2, the boot program loads a kernel.
6679731c7bSRuslan ErmilovOperation in
67247ca3deSSteve Pricethis phase depends on the design of the boot program.
684f329666SBrian S. DeanTypically, the boot program uses the
694f329666SBrian S. Dean.Tn BOOTP
704f329666SBrian S. Deanor
714f329666SBrian S. Dean.Tn DHCP
724f329666SBrian S. Deanprotocol to get the client's IP address and other boot
734f329666SBrian S. Deaninformation, including but not limited to
744f329666SBrian S. Deanthe IP addresses of the NFS server, router and nameserver,
754f329666SBrian S. Deanand the name of the kernel to load.
764f329666SBrian S. DeanThen the kernel is loaded, either directly using NFS
774f329666SBrian S. Dean(as it is the case for etherboot and netboot),
784f329666SBrian S. Deanor through an intermediate loader called pxeboot and
794f329666SBrian S. Deanloaded using TFTP or NFS.
80247ca3deSSteve Price.Pp
814f329666SBrian S. DeanIn phase 3, the kernel uses again DHCP or BOOTP to acquire
824f329666SBrian S. Deanconfiguration information, and proceeds to mount the
834f329666SBrian S. Deanroot filesystem and start operation.
844f329666SBrian S. DeanSome specific actions performed during the startup
854f329666SBrian S. Deanof a diskless system are listed in
864f329666SBrian S. Dean.Pa /etc/rc.diskless1
874f329666SBrian S. Deanand
884f329666SBrian S. Dean.Pa /etc/rc.diskless2
89247ca3deSSteve Price.Sh CONFIGURATION
904f329666SBrian S. DeanIn order to run a diskless client, you need the following:
914f329666SBrian S. Dean.Bl -bullet
923136363fSRuslan Ermilov.It
934f329666SBrian S. Deanan NFS server which exports a root and /usr partition with
944f329666SBrian S. Deanappropriate permissions.
954f329666SBrian S. DeanThe
964f329666SBrian S. Dean.Pa rc.diskless{1,2}
974f329666SBrian S. Deanscripts work with readonly partitions, as long as root is exported with
984f329666SBrian S. Dean.Fl maproot Ns =0
994f329666SBrian S. Deanso that some system files can be accessed.
1004f329666SBrian S. DeanAs an example,
101247ca3deSSteve Price.Pa /etc/exports
1024f329666SBrian S. Deancan contain the following lines:
1034f329666SBrian S. Dean.Bd -literal -offset indent
10499253b64SDima Dorfman<ROOT> -ro -maproot=0 -alldirs <list of diskless clients>
10599253b64SDima Dorfman/usr -ro -alldirs <list of diskless clients>
106247ca3deSSteve Price.Ed
107247ca3deSSteve Price.Pp
1084f329666SBrian S. Deanwhere
1094f329666SBrian S. Dean.Aq ROOT
1104f329666SBrian S. Deanis the mountpoint on the server of the root partition.
1114f329666SBrian S. DeanThe script
1124f329666SBrian S. Dean.Pa /usr/share/examples/diskless/clone_root
1134f329666SBrian S. Deancan be used to create a shared readonly root partition,
1144f329666SBrian S. Deanbut in same cases you can also decide to export
1154f329666SBrian S. Dean(again as readonly) the root directory used by
1164f329666SBrian S. Deanthe server itself.
1173136363fSRuslan Ermilov.It
1184f329666SBrian S. Deana
1194f329666SBrian S. Dean.Tn BOOTP
1204f329666SBrian S. Deanor
1214f329666SBrian S. Dean.Tn DHCP
1224f329666SBrian S. Deanserver.
1234f329666SBrian S. Dean.Xr bootpd 8
1244f329666SBrian S. Deancan be enabled by
1254f329666SBrian S. Deanuncommenting the
1264f329666SBrian S. Dean.Em bootps
1274f329666SBrian S. Deanline in
1284f329666SBrian S. Dean.Pa /etc/inetd.conf .
1294f329666SBrian S. DeanA sample
1304f329666SBrian S. Dean.Pa /etc/bootptab
1314f329666SBrian S. Deancan be the following:
1324f329666SBrian S. Dean.Bd -literal -offset indent
1334f329666SBrian S. Dean .default:\\
1344f329666SBrian S. Dean    hn:ht=1:vm=rfc1048:\\
1354f329666SBrian S. Dean    :sm=255.255.255.0:\\
1364f329666SBrian S. Dean    :sa=<SERVER>:\\
1374f329666SBrian S. Dean    :gw=<GATEWAY>:\\
1384f329666SBrian S. Dean    :rp="<SERVER>:<ROOT>":
1394f329666SBrian S. Dean
1404f329666SBrian S. Dean<CLIENT>:ha=0123456789ab:tc=.default
141247ca3deSSteve Price.Ed
142247ca3deSSteve Price.Pp
1434f329666SBrian S. Deanwhere
1444f329666SBrian S. Dean.Aq SERVER ,
1454f329666SBrian S. Dean.Aq GATEWAY
1464f329666SBrian S. Deanand
1474f329666SBrian S. Dean.Aq ROOT
1484f329666SBrian S. Deanhave the obvious meanings.
1494f329666SBrian S. Dean.It
150c4c3a00dSBrian S. DeanOn the root partition, create the directory
151c4c3a00dSBrian S. Dean.Pa /conf/default/etc ,
152c4c3a00dSBrian S. Deanand populate it with a copy of the contents of
153c4c3a00dSBrian S. Dean.Pa /etc .
154c4c3a00dSBrian S. DeanThe files and subdirectories within
155c4c3a00dSBrian S. Dean.Pa /conf/default/etc
156c4c3a00dSBrian S. Deanare used to bootstrap the diskless environment's
157c4c3a00dSBrian S. Dean.Pa /etc
158c4c3a00dSBrian S. Deanmemory filesystem.
159c4c3a00dSBrian S. DeanBe sure and copy the entirety of
160c4c3a00dSBrian S. Dean.Pa /etc ,
161c4c3a00dSBrian S. Deanand not just overrides.
162c4c3a00dSBrian S. Dean.It
163c4c3a00dSBrian S. DeanAdditionally, one may supply per-network or per-host overrides for
164c4c3a00dSBrian S. Deanfiles in
165c4c3a00dSBrian S. Dean.Pa /etc
166c4c3a00dSBrian S. Deanby creating and populating the directories
1674f329666SBrian S. Dean.Pa /conf/${i}/etc ,
1684f329666SBrian S. Deanwhere
1694f329666SBrian S. Dean.Va i
170c4c3a00dSBrian S. Deancan be either the subnet broadcast address for the client, or the IP
171c4c3a00dSBrian S. Deanaddress of the client.
1724f329666SBrian S. Dean.Pp
1734f329666SBrian S. DeanFiles are copied from the above directories into
1744f329666SBrian S. Dean.Pa /etc
1754f329666SBrian S. Dean(overriding the previous content of
1764f329666SBrian S. Dean.Pa /etc )
1774f329666SBrian S. Deanstarting from the most generic one by
1784f329666SBrian S. Dean.Pa /etc/rc.diskless1 ,
1794f329666SBrian S. Deanbefore the main part of
1804f329666SBrian S. Dean.Pa /etc/rc
1814f329666SBrian S. Dean(including reading
1824f329666SBrian S. Dean.Pa rc.conf )
1834f329666SBrian S. Deanis run.
1844f329666SBrian S. Dean.Pp
1854f329666SBrian S. DeanAs a minimum, you normally need to have the following in
1864f329666SBrian S. Dean.Pa /conf/default/etc/fstab
1874f329666SBrian S. Dean.Bd -literal -offset indent
1884f329666SBrian S. Dean<SERVER>:<ROOT> /     nfs    ro 0 0
1894f329666SBrian S. Dean<SERVER>:/usr   /usr  nfs    ro 0 0
1904f329666SBrian S. Deanproc            /proc procfs rw 0 0
1914f329666SBrian S. Dean.Ed
1924f329666SBrian S. Dean.Pp
1934f329666SBrian S. Deanand also a customized version of
1944f329666SBrian S. Dean.Pa /conf/default/etc/rc.conf
1954f329666SBrian S. Deanwhich should contain
1964f329666SBrian S. Deanthe startup options for the diskless client.
1974f329666SBrian S. Dean.Pp
1984f329666SBrian S. DeanMost likely
1994f329666SBrian S. Deanyou will not need to set
2004f329666SBrian S. Dean.Va hostname
2014f329666SBrian S. Deanand
2024f329666SBrian S. Dean.Va ifconfig_*
2034f329666SBrian S. Deanbecause these will be already set by the startup code.
2044f329666SBrian S. DeanYou will also probably need to set
2054f329666SBrian S. Dean.Va local_startup Ns = Ns Qq
2064f329666SBrian S. Deanso that the server's
2074f329666SBrian S. Deanlocal startup files will not be used.
208f3e5e31eSRobert Watson.Pp
20979731c7bSRuslan ErmilovWhile an
21079731c7bSRuslan Ermilov.Xr md 4 Ns -backed
21179731c7bSRuslan Ermilovfilesystem is mounted on
21279731c7bSRuslan Ermilov.Pa /var
21379731c7bSRuslan Ermilovby the startup scripts,
214f3e5e31eSRobert Watsonsome sites may want to disable the saving of entropy by setting
21579731c7bSRuslan Ermilov.Va entropy_dir Ns = Ns Qq Li NO
216f3e5e31eSRobert Watsonin
217f3e5e31eSRobert Watson.Pa /etc/defaults/rc.conf .
218f3e5e31eSRobert Watson.Pp
2194f329666SBrian S. DeanFinally, it might be convenient to use a
2204f329666SBrian S. Dean.Ic case
2214f329666SBrian S. Deanstatement using
2224f329666SBrian S. Dean.Li `hostname`
2234f329666SBrian S. Deanas the switch variable to do machine-specific configuration
2244f329666SBrian S. Deanin case a number of diskless clients share the same configuration
2254f329666SBrian S. Deanfiles.
2264f329666SBrian S. Dean.It
2274f329666SBrian S. Deanbuild a kernel whose config file (e.g.\&
2284f329666SBrian S. Dean.Pa /sys/i386/conf/DISKLESS )
2292e6c92ffSRobert Watsonhas at least the following options and devices:
2304f329666SBrian S. Dean.Bd -literal -offset indent
2312e6c92ffSRobert Watsondevice md
2324f329666SBrian S. Deanoptions BOOTP
2334f329666SBrian S. Deanoptions BOOTP_NFSROOT
2344f329666SBrian S. Deanoptions BOOTP_COMPAT
2354f329666SBrian S. Dean.Ed
2364f329666SBrian S. Dean.Pp
2374f329666SBrian S. DeanIf you use the firewall, remember to default to open or your kernel
2384f329666SBrian S. Deanwill not be able to send/receive the bootp packets.
239247ca3deSSteve Price.El
2404f329666SBrian S. Dean.Sh SECURITY ISSUES
2414f329666SBrian S. DeanBe warned that using unencrypted NFS to mount root and user
2424f329666SBrian S. Deanpartitions may expose information such as
2434f329666SBrian S. Deanencryption keys.
2444f329666SBrian S. Dean.Sh BUGS
2454f329666SBrian S. DeanThis manpage is probably incomplete.
2464f329666SBrian S. Dean.Pp
2474f329666SBrian S. Dean.Fx
2484f329666SBrian S. Deansometimes requires to write onto
24979731c7bSRuslan Ermilovthe root partition, so the startup scripts create and mount
25079731c7bSRuslan Ermilov.Xr md 4 Ns -backed
2514f329666SBrian S. Deanfilesystems on some locations (e.g.\&
2524f329666SBrian S. Dean.Pa /etc
2534f329666SBrian S. Deanand
2544f329666SBrian S. Dean.Pa /var ) ,
2554f329666SBrian S. Deanwhile
2564f329666SBrian S. Deantrying to preserve the original content.
2574f329666SBrian S. DeanThe process might not handle all cases.
258950c15fcSAlexey Zelkin.Sh SEE ALSO
25979731c7bSRuslan Ermilov.Xr md 4 ,
260bceb8aedSWolfram Schneider.Xr ethers 5 ,
261247ca3deSSteve Price.Xr exports 5 ,
2624f329666SBrian S. Dean.Xr bootpd 8 ,
263bceb8aedSWolfram Schneider.Xr mountd 8 ,
264247ca3deSSteve Price.Xr nfsd 8 ,
2654f329666SBrian S. Dean.Xr pxeboot 8 ,
266bceb8aedSWolfram Schneider.Xr reboot 8 ,
2674f329666SBrian S. Dean.Xr tftpd 8 ,
2684f329666SBrian S. Dean.Xr ports/net/etherboot
269