Imported Upstream version 3.4
[debian/elilo] / docs / netbooting.txt
1 How to netboot using ELILO
2 --------------------------
3
4 Copyright (C) 2002-2003 Hewlett-Packard Co.
5 Contributed by Stephane Eranian <eranian@hpl.hp.com>
6
7 Last updated: 03/08/11
8
9 EFI has full support for the PXE and DHCP protocol. As such 
10 it is relatively easy to boot a machine from the network using EFI.
11 The elilo loader has full support for both PXE and DHCP, therefore
12 it is possible to download the elilo config file, the Linux kernel image 
13 and the initial ramdisk from a remote server. There are many ways
14 netbooting can be configured but in this document we focus 
15 only on two very common cases:
16
17                 - netboot but use local root filesystem.
18                 - booting a diskless machine, i.e., use a NFS root filesystem.
19
20 1/ How to get EFI to netboot?
21
22    You do not need any additional software to get EFI to start a netboot session.
23    Any EFI machine can be configured to start a PXE/DHCP session IF it has a network
24    adapter that has support for the UNDI/PXE protocol. Most modern cards do have such
25    support. 
26
27    To enable netbooting, you need to go into the EFI boot manager maintenance menu
28    and 'Add a boot option'. On the screen you see the list of devices to boot from.
29    At least one of them should be of the form:
30
31         Load File [Acpi(PNP0A03,0)/Pci(5|0)/Mac(00D0B7A6FC25)]
32
33    which represent Ethernet card (Mac address). If you don't have such option, it means that
34    you either do not have a network adapter in your machine or it does not have the
35    UNDI/PXE support in its option ROM.
36
37    You need to select this option and give it a logical name such as 'netboot', for instance.
38    Next, you leave the maintenance menu and go back to the main menu. You now have a new
39    boot menu option. If you select 'netboot' then EFI will start the PXE/DCHP discovery
40    request and look for a server to get an IP address. 
41
42    On the server side, you can use a standard DHCP server, such as the one shipped on
43    Redhat7.2 (dhcpd) or a PXE server (not yet available for Linux, probably available for Windows).
44    In this document we show both options. You also need a TFTP server somewhere on the network, 
45    it will be used to download the actual files.
46
47
48 2/ Netbooting using DHCP
49
50    There is nothing specific to EFI that needs to be set in the /etc/dhcpd.conf file. 
51    Clearly the filename option must contains the path to the elilo.efi binary.
52
53    Elilo will auto-detect whether it was downloaded via PXE or DHCP and it will adapt
54    the kind of requests it makes to download the other files that it needs, such as
55    its config file.
56
57    A simple dhcpd.conf file which uses fixed IP addresses could be as follows:
58
59    subnet 192.168.2.0 netmask 255.255.255.0 {
60         host test_machine {
61                 hardware ethernet       00:D0:B7:A6:FC:25;
62                 fixed-address           192.168.2.10;
63                 filename                "elilo.efi";
64                 option domain-name      "mydomain.com";
65                 option host-name        "test_machine";
66                 option routers          192.168.2.1;
67                 option subnet-mask      255.255.255.0;
68
69         }
70     }
71
72    For the tftp server, you need to make sure that it is ACTIVATED by inetd or xinetd depending
73    on your distribution. In most distributions, it is disabled by default for security reasons.
74    On distributions using xinetd, you need to check /etc/xinet.d/tftp. For inetd you need to 
75    check /etc/inetd.conf. It is typical to have the root directory for tftp be /tftpboot but it
76    can be anything. In this document we will use /tftpboot as the root directory. The files
77    that we need are as follows:
78         - elilo.efi
79         - the elilo config file
80         - the kernel image
81         - the initial ramdisk (optional)
82   
83
84    a/ Location of the files in the tftp directory tree
85
86    For elilo version 3.3b or higher, it is possible to place the files listed above
87    in any subdirectory below the tftp root. Of course the dhcpd.conf file must
88    point to the location of elilo.efi and provide the path from the tftp root
89    directory.
90
91    Elilo will look for its config file, the kernel image, the initial ramdisk (optional)
92    only from the directory it was loaded from. This is useful when the same tftp server
93    is used to services many different kind of clients. 
94
95    Here is a simple example, suppose the dhcpd.conf file contains the following definition:
96
97    subnet 192.168.2.0 netmask 255.255.255.0 {
98         host test_machine {
99                 hardware ethernet       00:D0:B7:A6:FC:25;
100                 fixed-address           192.168.2.10;
101
102                 filename                "/rx6000/elilo.efi";
103
104                 option domain-name      "mydomain.com";
105                 option host-name        "test_machine";
106                 option routers          192.168.2.1;
107                 option subnet-mask      255.255.255.0;
108
109         }
110     }
111
112     Elilo will be downloaded from /tftpboot/rx6000. Then elilo will look
113     for all the other files it needs in /tftpboot/rx6000. This rule is 
114     applied to all files, including the all the variation of the config
115     file.
116
117    b/ Getting the config file
118
119       With DHCP, elilo will first try to download its configuration file. It will try
120       several file names and they are as follows:
121
122         1) AABBCCDD.conf 
123            where AABBCCDD is the hexadecimal representation of the IP address assigned to
124            the machine by DHCP. The hexadecimal string (AABBCCDD) MUST use upper case
125            characters.
126
127            This filename is an opportunity to specify a machine specific configuration file.
128
129         2) elilo-ia32.config or elilo-ia64.conf
130            
131            Depending on the machine (client side) architecture elilo will try the IA-32 or
132            IA-64 file.
133
134            This filename is an opportunity to specify a architecture specific configuration file.
135            This distinction between the architectures is useful when the same TFTP server services
136            the two types of clients : IA32- and IA-64 machines.
137
138          3) elilo.conf
139
140   All files use the same format. Elilo will stop at the first match. In case no file is found,
141   it will try to download a default kernel file name (vmlinux).
142
143   c/ Getting the kernel
144
145      The second request from elilo is typically the kernel image. The filename is based on what
146      is in the elilo config file. The path name depends on how the TFTP server is configured. 
147      For security reasons it is customary to have the server do a change root in /tftpboot.
148      Hence filenames are relative to /tftpboot and therefore you don't need to specify it.
149
150      For instance if elilo.conf contains:
151         image=vmlinuz.249
152         label=linux-up
153         root=/dev/sdb2
154
155     and the user selects linux-up, then elilo will request a filename of 'vmlinux.249' 
156     which must therefore be in /tftpboot. Check the configuration of your TFTP server for
157     more on this.
158   
159   d/ Getting the initial ramdisk
160
161      This step is optional. It follows exactly the same naming rules explained for the kernel image.
162      The initial ramdisk file must therefore be somewhere under /tftpboot. 
163
164       For instance if elilo.conf contains:
165         image=vmlinuz.249
166         label=linux-up
167         root=/dev/sdb2
168         initrd=ramdisk/initrd.249
169
170     and the user selects linux-up, then elilo will request a filename of 'ramdisk/initrd.249' 
171     which must therefore be under /tftpboot. 
172   
173
174   e/ Getting IP address information
175
176      When elilo is netbooted, the network filesystem module initializes some elilo variables
177      with the information it received from the DHCP server. At a minimum, it received the 
178      IP address.
179
180      The following information is stored in the elilo variables indicated below:
181         - assigned IP address -> %I
182         - assigned netmask    -> %M
183         - assigned domainname -> %D
184         - assigned gateway    -> %G
185
186       These variables can be used to dynamically adjust the command line arguments passed to the kernel.
187       See section 5/ below for an example.
188
189 3/ Netbooting using PXE
190
191    EFI has builtin support for PXE. In fact it first tries PXE and then default to DHCP
192    when it does not find a valid PXE server.
193
194    There is a PXE server package available from Linux/ia32 however this package does not
195    have the necessary extensions to talk to the EFI side, at least on IA-64 platforms.
196
197    There is no need for special options or compile time flags to get elilo to work
198    with PXE instead of standard DHCP. When netbooted, elilo will automatically detect
199    if it has been downloaded via PXE or DHCP and it will adujst how subsequent files
200    are requested.
201
202    You need a special version of the DHCPD server developed by the Internet Software Consortium
203    (http://www.isc.org) with a special patch to add the PXE extensions. Unfortunately as of 
204    version 3.0xx, the patch has not yet made it into the official tree. It is supposed to show
205    up in version 3.1 of the dhcpd server.
206
207    In any case, the elilo package contains a simple example of how you can configure the
208    /etc/dhcpd.conf file for a PXE-aware DHCP server using the extensions provided in the
209    patch. You can look in examples/dhcpd-pxe.conf. The syntax is very different from
210    a standard dhcpd server. 
211
212    The key elements to keep in mind are the PXE layers used by elilo to request the different
213    files:
214
215         Layer 0 : to get the name of the boot loader (elilo.efi)
216         Layer 1 : to get the name of the elilo config file
217         Layer 2 : to get the name of the kernel image
218
219   There is an IMPORTANT distinction between those layers.  The first two (0,1) and requested
220   systematically whereas the last one is used only when the configuration file is not found, i.e.,
221   what is the default kernel to boot. The actual files are STILL downloaded via TFTP. Therefore
222   the TFTP server must also be configured (see previous section for more on this).
223
224
225   a/ Getting the config file
226
227   In this mode, elilo use the PXE layer 1 to get the config file to use. Therefore this must
228   be set on the server side. Elilo will use the following sequence when
229   looking for a config file:
230
231         - use the name provide by the PXE server Layer 1 or
232
233         - elilo-ia64.conf/elilo-ia32.conf or
234
235         - elilo.conf
236
237   Elilo stops at the first match. With PXE, elilo does not try to download a config file named after 
238   the assigned IP address as it does for DHCP because there is enough flexibility in the PXE server 
239   configuration to do this.
240
241   b/ Getting the kernel image
242
243   When there is no config file, elilo will use the kernel name returned by 
244   PXE layer 2. If it is not specified there, then it default to 'vmlinux'.
245
246   c/ Getting the initial ramdisk
247
248   The filename for the ramdisk MUST come from the config file. Elilo does not use a PXE layer
249   to ask for a default name.
250
251   d/ Getting IP address information
252
253   When elilo is netbooted, the network filesystem module initializes some elilo variables
254   with the information it received from the DHCP server. At a minimum, it received the 
255   IP address.
256
257   The following information is stored in the variables indicated below:
258         - assigned IP address -> %I
259         - assigned netmask    -> %M
260         - assigned domainname -> %D
261         - assigned gateway    -> %G
262
263   These variables can be used to dynamically adjust the command line arguments passed to the kernel.
264   See section 5/ below for an example of how to use the variable.
265
266
267 4/ Netbooting and using a local root filesystem
268
269         This is the simplest configuration where the boot loader, its config file, the kernel
270         and its optional initial ramdisk are downloaded from the network BUT the kernel uses
271         the local disk for its root filesystem.
272
273         For such configuration there is no special option necessary in the elilo config file.
274         You simply need to specify which partition is the root partition.  A typical elilo.conf
275         would look as follows:
276
277         image=vmlinuz.249
278         label=linux-up
279         root=/dev/sdb2
280         initrd=ramdisk/initrd.249
281
282 5/ Netbooting a diskless machine
283
284    In this configuration we do not use the local machine's disks but instead rely on
285    a remote server to provide the root filesystem via NFS.
286
287    a/ Prerequisites
288
289    By default most kernels shipped by distributors do not have the support
290    compiled in for such configuration. This means that you need to recompile
291    your own kernel. For instance, vmlinuz-2.4.9 as shipped in Redhat7.2 on
292    both ia32 and ia64 platforms does not have the support builtin. 
293         
294    To get this configuration to work, you need to have a kernel compiled
295    such that it accepts a root filesystem over NFS (CONFIG_ROOT_NFS). This
296    necessitates that the network stack be configured with the, so called,
297    IP plug-and-play support (CONFIG_IP_PNP).
298
299    b/ On the server side
300
301    You need to have:
302         - a NFS file server  to provide the root filesystem.
303         - a DHCP/PXE server to get the IP address and download the boot loader.
304
305    Note that both do not need to be on the same machine. There is no special 
306    DHCP/PXE configuration option required to get this working. All you need
307    is a kernel compiled with the options mentioned in a/. You also need to
308    make sure that the permission on the NFS server are set appropriately
309    to allow root access from the client machine (no_root_squash), see 
310    man 'exports' for more on this.
311
312    c/ The elilo configuration file
313
314    To boot successfully, the kernel needs to:
315         - get an IP address and related networking parameters
316         - contact the NFS server to get its root filesystem
317         
318    The 2.4.x kernel series provides several options to get the IP address:
319         - it can do an internal DHCP request (CONFIG_IP_PNP_DHCP)
320         - it can do an internal RARP request (CONFIG_IP_PNP_RARP)
321         - it can do an internal BOOTP request (CONFIG_IP_PNP_BOOTP)
322         - it can get the IP address from the command line
323
324    The choice is up to you but it is a little bit stupid to go through a
325    DHCP/BOOTP/RARP phase again when this is already done by the EFI firmware.
326    So in this document, we describe how you can pass the information provided
327    by EFI on the command line of the kernel.
328
329    The syntax used to pass IP information on the command line is described in
330    the kernel source tree in Documentation/nfsroot.txt. The option is called
331    "ip=" and has the following syntax:
332
333    ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
334
335    To designate the NFS server, you must use the "nfsroot=" option. It has the
336    following syntax:
337         nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
338
339    Depending on how you want your system configured you can hardcode the
340    values of the parameters in the elilo configuration file. For instance:
341
342    image=/vmlinuz
343         label=nfsroot
344         description="kernel with NFS root"
345         append="root=/dev/nfs nfsroot=192.168.2.22:/ia64_rootfs ip=192.168.2.5::192.168.2.1:255.255.255.0:test_machine:eth0:on"
346
347   Note the root=/dev/nfs indicates that the root filesystem is over NFS. 
348
349   This example works fine however, it is not very flexible because the IP
350   address, the gateway, netmask and hostname are fixed and do not used the
351   values EFI used to download the boot loader and the kernel.
352
353   Elilo provides a way to dynamically customize the parameters passed on the
354   command line using substitution variables. We describe those variables in
355   elilovar.txt. The basic idea is to allow the parameters to use the dynamic
356   information obtained by the DHCP/PXE phase.
357
358   The network support in elilo defines several variables which contained
359   network related information produced by the DHCP/PXE phase. The set of 
360   variable is:
361         %I -> the IP address obtained by DHCP/PXE
362         %M -> the netmask obtained by DHCP/PXE
363         %G -> the gateway obtained by DHCP/PXE
364         %H -> the hostname obtained by DHCP/PXE
365         %D -> the domain name obtained by DHCP/PXE
366
367  So, the configuration file can then be customized as follows:
368    image=/vmlinuz
369         label=nfsroot
370         description="kernel with NFS root"
371         append="root=/dev/nfs nfsroot=192.168.2.22:/ia64_rootfs ip=%I::%G:%M:%H:eth0:on"
372
373  Not all parameters are necessary or even used by the kernel or the user level
374  configuration scripts. There is no variable to substitute the NFS server or
375  the mount point on that server.
376
377
378  In the case of a DHCP boot, this type of customization makes sense only for
379  the shared configuration file, elilo-ia64.conf/elilo-ia32.conf or elilo.conf.
380  The configuration file based on the IP address (such as C0A80205.conf in this
381  case) would provide another way of customizing parameters for a specific
382  client (IP address). The same thing holds if the name of the config file 
383  returned by the PXE server is specific to a client.
384
385
386 6/ References
387
388    More information on the PXE protocol can be found at the following web site:
389
390                 http://developer.intel.com/ial/wfm/
391
392    The source code for the standard and (possibly) PXE-enhanced DHCPD can be
393     downloaded from:
394
395                 http://www.isc.org/     
396