xref: /netbsd-src/share/man/man8/man8.x86/pxeboot.8 (revision 9aa5e65867d65343760f3c01c8d8d032aba94b7a)
1*9aa5e658Smanu.\"	$NetBSD: pxeboot.8,v 1.6 2023/04/24 13:55:45 manu Exp $
2a9969a86Ssoren.\"
3a9969a86Ssoren.\" Copyright (c) 2003
4a9969a86Ssoren.\" 	Matthias Drochner.  All rights reserved.
5a9969a86Ssoren.\"
6a9969a86Ssoren.\" Redistribution and use in source and binary forms, with or without
7a9969a86Ssoren.\" modification, are permitted provided that the following conditions
8a9969a86Ssoren.\" are met:
9a9969a86Ssoren.\" 1. Redistributions of source code must retain the above copyright
10a9969a86Ssoren.\"    notice, this list of conditions and the following disclaimer.
11a9969a86Ssoren.\" 2. Redistributions in binary form must reproduce the above copyright
12a9969a86Ssoren.\"    notice, this list of conditions and the following disclaimer in the
13a9969a86Ssoren.\"    documentation and/or other materials provided with the distribution.
14a9969a86Ssoren.\"
15a9969a86Ssoren.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16a9969a86Ssoren.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17a9969a86Ssoren.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18a9969a86Ssoren.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19a9969a86Ssoren.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20a9969a86Ssoren.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21a9969a86Ssoren.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22a9969a86Ssoren.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23a9969a86Ssoren.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24a9969a86Ssoren.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25a9969a86Ssoren.\" SUCH DAMAGE.
26a9969a86Ssoren.\"
273af2acdcSchristos.Dd February 17, 2017
28a9969a86Ssoren.Dt PXEBOOT 8 x86
29a9969a86Ssoren.Os
30a9969a86Ssoren.Sh NAME
31a9969a86Ssoren.Nm pxeboot
32a9969a86Ssoren.Nd network boot NetBSD/x86 through a PXE BIOS extension
33a9969a86Ssoren.Sh DESCRIPTION
34a9969a86Ssoren.Nm
35a9969a86Ssorenis a
36a9969a86Ssoren.Nx
37a9969a86Ssorenboot program running on top of a
38a9969a86Ssoren.Tn PXE
39a9969a86Ssoren.Tn BIOS
40a9969a86Ssorenextension which is
41a9969a86Ssorenprovided by the motherboard or a plug-in network adapter,
42a9969a86Ssorenin accordance with the
43a9969a86Ssoren.Tn Intel
44527132ccSfcambusPreboot eXecution Environment
45a9969a86Ssoren.Pq Tn PXE
46a9969a86Ssorenspecification.
47a9969a86Ssoren.Pp
48a9969a86SsorenBy default, the
49a9969a86Ssoren.Nm
50a9969a86Ssorenprogram is configured with modules loading and
5199f13c16Swiz.Xr boot.cfg 5
52a9969a86Ssorensupport disabled.
53a9969a86SsorenSee
54a9969a86Ssoren.Sx EXAMPLES
55a9969a86Ssorenfor how to enable these options individually.
56a9969a86SsorenThis manual page assumes that
5799f13c16Swiz.Xr boot.cfg 5
58a9969a86Ssorensupport is enabled.
59a9969a86Ssoren.Pp
60a9969a86SsorenNetwork booting a system through
61a9969a86Ssoren.Tn PXE
62a9969a86Ssorenis a two-stage process:
63a9969a86Ssoren.Pp
64a9969a86Ssoren.Bl -enum
65a9969a86Ssoren.It
66a9969a86SsorenThe
67a9969a86Ssoren.Tn PXE
68a9969a86Ssoren.Tn BIOS
69a9969a86Ssorenissues a
70a9969a86Ssoren.Tn DHCP
71a9969a86Ssorenrequest and fetches the
72a9969a86Ssoren.Nx
73a9969a86Ssoren.Nm
74a9969a86Ssorenprogram using
75a9969a86Ssoren.Tn TFTP .
76a9969a86Ssoren.It
77a9969a86SsorenThe
78a9969a86Ssoren.Nx
79a9969a86Ssoren.Nm
80a9969a86Ssorenprogram takes control.
81a9969a86SsorenIt immediately issues another
82a9969a86Ssoren.Tn DHCP
83a9969a86Ssorenrequest to get the name of a
8499f13c16Swiz.Xr boot.cfg 5
85a9969a86Ssorenfile to load, using
86a9969a86Ssoren.Dq boot.cfg
87a9969a86Ssorenby default.
88a9969a86SsorenIf the boot config file is not found, or if the supplied file appears
89a9969a86Ssorennot to be a boot configuration file, the file is skipped.
90a9969a86SsorenOtherwise it is loaded and obeyed as described in
9199f13c16Swiz.Xr boot.cfg 5 .
92a9969a86SsorenIf a boot configuration is not loaded, the user has the option to
93a9969a86Ssorenenter a limited version of the standard interactive boot mode by
94a9969a86Ssorenpressing a key within five seconds.
95a9969a86SsorenAfter this time, or after the user's
96a9969a86Ssoren.Ic boot
97a9969a86Ssorencommand, another
98a9969a86Ssoren.Tn DHCP
99a9969a86Ssorenrequest is issued and the kernel filename returned by the
100a9969a86Ssoren.Tn DHCP
101a9969a86Ssorenreply, using
102a9969a86Ssoren.Dq netbsd
103a9969a86Ssorenby default,
104a9969a86Ssorenis loaded.
105a9969a86SsorenTo read the kernel file, the
106a9969a86Ssoren.Tn NFS
107a9969a86Ssoren.Pq version 2
108a9969a86Ssorenor
109a9969a86Ssoren.Tn TFTP
110a9969a86Ssorenprotocols can be used.
111a9969a86Ssoren.El
112a9969a86Ssoren.Pp
113a9969a86SsorenThe
114a9969a86Ssoren.Tn DHCP
115a9969a86Ssorenrequest issued by the
116a9969a86Ssoren.Nx
117a9969a86Ssoren.Nm
118a9969a86Ssorenprogram has the following special parameters:
119a9969a86Ssoren.Bl -tag -width xxxx
120a9969a86Ssoren.It Bootfile name
121a9969a86Ssorenis set to
122a9969a86Ssoren.Dq boot.cfg
123a9969a86Ssorenduring the first request, and then to
124a9969a86Ssorenthe
125a9969a86Ssoren.Va filename
126a9969a86Ssorenargument on the
127a9969a86Ssoren.Ic boot
128a9969a86Ssorencommand line typed in by the user (can be empty), using
129a9969a86Ssoren.Dq netbsd
130a9969a86Ssorenin the non-interactive case.
131a9969a86Ssoren.It DHCP Vendor class identifier tag
132a9969a86Ssorenis set to
133a9969a86Ssoren.Dq NetBSD:i386:libsa .
134a9969a86Ssoren.El
135a9969a86Ssoren.Pp
136a9969a86SsorenThe
137a9969a86Ssoren.Tn DHCP
138a9969a86Ssorenserver can use these fields (i.e. the
139a9969a86Ssoren.Tn DHCP
140a9969a86Ssorenvendor class identifier tag and the requested file name, possibly
141a9969a86Ssorensupplied by the user's command line input to the
142a9969a86Ssoren.Nm
143a9969a86Ssorenprogram) to distinguish between the various originators of requests
144a9969a86Ssoren(PXE BIOS, first and second
145a9969a86Ssoren.Nm
146a9969a86Ssorenstage,
147a9969a86Ssoren.Nx
148a9969a86Ssorenkernel), and to alter its behaviour.
149a9969a86SsorenFor example, this can be used to support alternative
150a9969a86Ssoren.Nx
151a9969a86Ssoreninstallations on one machine.
152a9969a86Ssoren.Pp
153a9969a86SsorenIn addition to the standard network interface configuration,
154a9969a86Ssorenthe following fields in the
155a9969a86Ssoren.Tn DHCP
156a9969a86Ssorenreply are interpreted:
157a9969a86Ssoren.Bl -tag -width xxxx
158a9969a86Ssoren.It Bootfile name
159a9969a86Ssorenspecifies the protocol to be used, and the filename of the
160a9969a86Ssorenboot config or
161a9969a86Ssoren.Nx
162a9969a86Ssorenkernel to be booted, separated by a colon.
163a9969a86SsorenAvailable protocols are
164a9969a86Ssoren.Dq nfs
165a9969a86Ssorenand
166a9969a86Ssoren.Dq tftp .
167a9969a86SsorenThe boot config or kernel filename part is interpreted relatively to
168a9969a86Ssorenthe NFS root directory (see the
169a9969a86Ssoren.Em Root path
170a9969a86Ssorenreply field below) or the TFTP server's root directory (which might be a
171a9969a86Ssorensubdirectory within the TFTP server's filesystem, depending on the
172a9969a86Ssorenimplementation), respectively.
173a9969a86SsorenIf the
174a9969a86Ssoren.Em Bootfile name
175a9969a86Ssorenfield replied by the DHCP server does not contain a colon,
176a9969a86Ssorenit is ignored, and the
177a9969a86Ssoren.Va filename
178a9969a86Ssorentyped in at the
179a9969a86Ssoren.Nm
180a9969a86Ssorencommand line prompt (or the
181a9969a86Ssoren.Dq netbsd
182a9969a86Ssorendefault, see the section about the
183a9969a86Ssoren.Em Bootfile name
184a9969a86Ssorenfield in the DHCP request above) is used.
185a9969a86SsorenIf no protocol was specified,
186a9969a86Ssoren.Dq nfs
187a9969a86Ssorenis assumed.
188a9969a86Ssoren.It Next server
189a9969a86Ssorenis used as the location of the tftp server.
190a9969a86Ssoren.It Swap server
191a9969a86Ssorencan be used to override the
192a9969a86Ssoren.Dq server IP address
193a9969a86Ssorenif
194a9969a86Ssoren.Tn NFS
195a9969a86Ssorenis used to access the kernel.
196a9969a86SsorenThis matches the behaviour of the
197a9969a86Ssoren.Nx
198a9969a86Ssorenkernel to access its root file system on
199a9969a86Ssoren.Tn NFS .
200a9969a86SsorenThis way, different
201a9969a86Ssoren.Tn TFTP
202a9969a86Ssorenand
203a9969a86Ssoren.Tn NFS
204a9969a86Ssorenservers can be communicated to
205a9969a86Ssorenthe
206a9969a86Ssoren.Tn DHCP
207a9969a86Ssorenclient
208a9969a86Ssoren.Po
209a9969a86Ssorenit is actually a deficiency of the
210a9969a86Ssoren.Tn DHCP
211a9969a86Ssorenprotocol to provide a
212a9969a86Ssoren.Dq root path
213a9969a86Ssorenfield but no corresponding IP address
214a9969a86Ssoren.Pc .
215a9969a86Ssoren.It Root path
216a9969a86Ssorenis used as path to be mounted in the
217a9969a86Ssoren.Tn NFS
218a9969a86Ssorencase to access the kernel file, matching the
219a9969a86Ssoren.Nx
220a9969a86Ssorenkernel's behaviour.
221a9969a86Ssoren.El
222a9969a86Ssoren.Pp
223a9969a86SsorenSee
2243af2acdcSchristos.Xr x86/boot 8
225*9aa5e658Smanufor the commands accepted in interactive mode.
226a9969a86Ssoren.Pp
227a9969a86SsorenBy default the output from
228a9969a86Ssoren.Nm
229a9969a86Ssorenand from the booted kernel will go to the system's BIOS console.
230a9969a86SsorenThis can be changed to be one of the serial ports by using
231a9969a86Ssoren.Nm installboot
232a9969a86Ssorento modify the boot options contained in the
233a9969a86Ssoren.Pa pxeboot_ia32.bin
234a9969a86Ssorenfile.
235a9969a86Ssoren.Sh FILES
236a9969a86Ssoren.Bl -tag -width /usr/mdec/pxeboot_ia32.bin
237a9969a86Ssoren.It Pa /usr/mdec/pxeboot_ia32.bin
238a9969a86Ssoren.El
239a9969a86Ssoren.Sh EXAMPLES
240a9969a86SsorenTo enable
24199f13c16Swiz.Xr boot.cfg 5
242a9969a86Ssorensupport in the
243a9969a86Ssoren.Nm
244a9969a86Ssorenprogram:
245a9969a86Ssoren.Bd -literal -offset indent
246a9969a86Ssoreninstallboot -e -o bootconf pxeboot_ia32.bin
247a9969a86Ssoren.Ed
248a9969a86Ssoren.Pp
249a9969a86SsorenTo enable modules loading support in the
250a9969a86Ssoren.Nm
251a9969a86Ssorenprogram:
252a9969a86Ssoren.Bd -literal -offset indent
253a9969a86Ssoreninstallboot -e -o modules pxeboot_ia32.bin
254a9969a86Ssoren.Ed
255a9969a86Ssoren.Pp
256a9969a86SsorenThe first
257a9969a86Ssoren.Pa /etc/dhcpd.conf
258a9969a86Ssorenexample shows a simple configuration which just loads
259a9969a86Ssoren.Dq boot.cfg
260a9969a86Ssorenand
261a9969a86Ssoren.Dq netbsd
262a9969a86Ssorenfrom the client's NFS root directory, using the defaults for
263a9969a86Ssorenprotocol and kernel filename.
264a9969a86SsorenSimilar setups should be possible with any BOOTP/DHCP server.
265a9969a86Ssoren.Pp
266a9969a86Ssoren.Bd -literal
267a9969a86Ssorenhost myhost {
268a9969a86Ssoren    hardware ethernet 00:00:00:00:00:00;
269a9969a86Ssoren    fixed-address myhost;
270a9969a86Ssoren    option host-name "myhost";
271a9969a86Ssoren    filename "pxeboot_ia32.bin";
272a9969a86Ssoren    option swap-server mynfsserver;
273a9969a86Ssoren    option root-path "/export/myhost";
274a9969a86Ssoren}
275a9969a86Ssoren.Ed
276a9969a86Ssoren.Pp
277a9969a86SsorenThe following
278a9969a86Ssoren.Pa /etc/dhcpd.conf
279a9969a86Ssorenentry sets loads the boot config and kernel over tftp.
280a9969a86SsorenThis can be used, for example, for installing machines by using
281a9969a86Ssorenan install kernel.
282a9969a86Ssoren.Pp
283a9969a86Ssoren.Bd -literal
284a9969a86Ssorenhost myhost {
285a9969a86Ssoren    hardware ethernet 00:00:00:00:00:00;
286a9969a86Ssoren    fixed-address myhost;
287a9969a86Ssoren    option host-name "myhost";
288a9969a86Ssoren    next-server mytftpserver;
289a9969a86Ssoren
290a9969a86Ssoren    # This section allows dhcpd to respond with different answers
291a9969a86Ssoren    # for the different tftp requests for the bootloader and kernel.
292a9969a86Ssoren    if substring (option vendor-class-identifier, 0, 20)
293a9969a86Ssoren      = "PXEClient:Arch:00000" {
294a9969a86Ssoren        filename "pxeboot_ia32.bin";
295a9969a86Ssoren    } elsif substring (option vendor-class-identifier, 0, 17)
296a9969a86Ssoren      = "NetBSD:i386:libsa" {
297a9969a86Ssoren        if filename = "boot.cfg" {
298a9969a86Ssoren            filename "tftp:boot.cfg";
299a9969a86Ssoren        } else if filename = "netbsd" {
300a9969a86Ssoren            filename "tftp:netbsd-INSTALL.gz";
301a9969a86Ssoren        }
302a9969a86Ssoren    }
303a9969a86Ssoren}
304a9969a86Ssoren.Ed
305a9969a86Ssoren.Pp
306a9969a86SsorenThe following
307a9969a86Ssoren.Pa /etc/dhcpd.conf
308a9969a86Ssorenentry shows how different system installations can be booted depending on
309a9969a86Ssorenthe user's input on the
310a9969a86Ssoren.Nm
311a9969a86Ssorencommand line.
312a9969a86Ssoren.Pp
313a9969a86Ssoren.Bd -literal
314a9969a86Ssorenhost myhost {
315a9969a86Ssoren    hardware ethernet 00:00:00:00:00:00;
316a9969a86Ssoren    fixed-address myhost;
317a9969a86Ssoren    option host-name "myhost";
318a9969a86Ssoren    next-server mytftpserver;
319a9969a86Ssoren    if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
320a9969a86Ssoren        filename "pxeboot_ia32.bin";
321a9969a86Ssoren    } elsif filename = "boot.cfg" {
322a9969a86Ssoren        filename "tftp:boot.cfg";
323a9969a86Ssoren    } elsif filename = "tftp" {
324a9969a86Ssoren        filename "tftp:netbsd.myhost";
325a9969a86Ssoren    } else {
326a9969a86Ssoren        option swap-server mynfsserver;
327a9969a86Ssoren        option root-path "/export/myhost";
328a9969a86Ssoren        if filename = "generic" {
329a9969a86Ssoren            filename "nfs:gennetbsd";
330a9969a86Ssoren        } else {
331a9969a86Ssoren            filename "nfs:netbsd";
332a9969a86Ssoren        }
333a9969a86Ssoren    }
334a9969a86Ssoren}
335a9969a86Ssoren.Ed
336a9969a86Ssoren.Pp
337a9969a86SsorenThe
338a9969a86Ssoren.Tn TFTP
339a9969a86Ssorenserver is supplied using the
340a9969a86Ssoren.Em next-server
341a9969a86Ssorendirective.
342a9969a86SsorenThe
343a9969a86Ssoren.Tn NFS
344a9969a86Ssorenserver for the root file system is
345a9969a86Ssoren.Em mynfsserver .
346a9969a86SsorenThe
347a9969a86Ssoren.Em swap-server:root-path
348a9969a86Ssorenis only used in the
349a9969a86Ssoren.Tn NFS
350a9969a86Ssorencase and by the
351a9969a86Ssoren.Nx
352a9969a86Ssorenkernel to mount the root file system.
353a9969a86Ssoren.Sh SEE ALSO
35499f13c16Swiz.Xr boot.cfg 5 ,
355a9969a86Ssoren.Xr dhcpd 8 ,
356a9969a86Ssoren.Xr diskless 8 ,
35799f13c16Swiz.Xr installboot 8 ,
35899f13c16Swiz.Xr x86/boot 8
359a9969a86Ssoren.Rs
360a9969a86Ssoren.%T Preboot Execution Environment (PXE) Specification
361a9969a86Ssoren.%N Version 2.1
362a9969a86Ssoren.%D September 20, 1999
363a9969a86Ssoren.%A Intel Corporation
364a9969a86Ssoren.Re
365a9969a86Ssoren.Sh HISTORY
366a9969a86SsorenThe
367a9969a86Ssoren.Nx Ns Tn /x86
368a9969a86Ssoren.Nm
369a9969a86Ssorencommand first appeared in
370a9969a86Ssoren.Nx 1.6 .
371a9969a86Ssoren.Sh BUGS
372a9969a86SsorenIf an error is encountered while reading the
373a9969a86Ssoren.Nx
374a9969a86Ssorenkernel file or if its file format wasn't recognized, it is
375a9969a86Ssorenimpossible to retry the operation because the
376a9969a86Ssoren.Tn PXE
377a9969a86Ssorennetwork stack is already removed from the system RAM.
378a9969a86Ssoren.Pp
379a9969a86SsorenYou need the
380a9969a86Ssoren.Nm
381a9969a86Ssorenfrom an i386 build to boot an i386 kernel,
382a9969a86Ssorenand that from an amd64 build to boot an amd64 kernel.
383a9969a86Ssoren.Pp
384a9969a86SsorenIn a
385a9969a86Ssoren.Tn Xen
386a9969a86Ssorensetup, the
387a9969a86Ssoren.Nx
388a9969a86SsorenDOM0 kernel is loaded as a module, and cannot know the device
389a9969a86Ssorenfrom which the
390a9969a86Ssoren.Tn Xen
391a9969a86Ssorenhypervisor was booted.
392a9969a86SsorenIn this case, the DOM0 kernel will fall back to the default boot
393a9969a86Ssorendevice (typically the first disk on the host).
394a9969a86SsorenIf the boot device is different from the default one, consider
395a9969a86Ssorenpassing additional arguments, like
396a9969a86Ssoren.Ar bootdev ,
397a9969a86Ssorento the DOM0 kernel as explained
398a9969a86Ssorenin the
399a9969a86Ssoren.Cm load
400a9969a86Ssorencommand subsection in
4013af2acdcSchristos.Xr x86/boot 8 .
402