Imported Upstream version 3.6
[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) AA[BB[CC]][-ia32|ia64].conf 
130            As of version 3.5, elilo will also look for IPv4 class A,B,C
131            subnet-specific versions of the config file.  This is useful when you
132            want to have a common config file for all machines connected to a
133            particular subnet.
134            
135            For example, if your IP address is 10.0.0.1 (0A000001 in hex), elilo
136            will look first for 0A000001.conf, then 0A0000.conf, then 0A00.conf,
137            and finally 0A.conf.
138
139            Elilo will also try architecture-specific versions of subnet-specific
140            config files first (So for example, on an Itanium system,
141            "0A0000-ia64.conf" will be tried before "0A0000.conf")
142
143         3) elilo-ia32.config or elilo-ia64.conf
144            
145            Depending on the machine (client side) architecture elilo will try the IA-32 or
146            IA-64 file.
147
148            This filename is an opportunity to specify a architecture specific configuration file.
149            This distinction between the architectures is useful when the same TFTP server services
150            the two types of clients : IA32- and IA-64 machines.
151
152          4) elilo.conf
153
154   All files use the same format. Elilo will stop at the first match. In case no file is found,
155   it will try to download a default kernel file name (vmlinux).
156
157   c/ Getting the kernel
158
159      The second request from elilo is typically the kernel image. The filename is based on what
160      is in the elilo config file. The path name depends on how the TFTP server is configured. 
161      For security reasons it is customary to have the server do a change root in /tftpboot.
162      Hence filenames are relative to /tftpboot and therefore you don't need to specify it.
163
164      For instance if elilo.conf contains:
165         image=vmlinuz.249
166         label=linux-up
167         root=/dev/sdb2
168
169     and the user selects linux-up, then elilo will request a filename of 'vmlinux.249' 
170     which must therefore be in /tftpboot. Check the configuration of your TFTP server for
171     more on this.
172   
173   d/ Getting the initial ramdisk
174
175      This step is optional. It follows exactly the same naming rules explained for the kernel image.
176      The initial ramdisk file must therefore be somewhere under /tftpboot. 
177
178       For instance if elilo.conf contains:
179         image=vmlinuz.249
180         label=linux-up
181         root=/dev/sdb2
182         initrd=ramdisk/initrd.249
183
184     and the user selects linux-up, then elilo will request a filename of 'ramdisk/initrd.249' 
185     which must therefore be under /tftpboot. 
186   
187
188   e/ Getting IP address information
189
190      When elilo is netbooted, the network filesystem module initializes some elilo variables
191      with the information it received from the DHCP server. At a minimum, it received the 
192      IP address.
193
194      The following information is stored in the elilo variables indicated below:
195         - assigned IP address -> %I
196         - assigned netmask    -> %M
197         - assigned domainname -> %D
198         - assigned gateway    -> %G
199
200       These variables can be used to dynamically adjust the command line arguments passed to the kernel.
201       See section 5/ below for an example.
202
203 3/ Netbooting using PXE
204
205    EFI has builtin support for PXE. In fact it first tries PXE and then default to DHCP
206    when it does not find a valid PXE server.
207
208    There is a PXE server package available from Linux/ia32 however this package does not
209    have the necessary extensions to talk to the EFI side, at least on IA-64 platforms.
210
211    There is no need for special options or compile time flags to get elilo to work
212    with PXE instead of standard DHCP. When netbooted, elilo will automatically detect
213    if it has been downloaded via PXE or DHCP and it will adujst how subsequent files
214    are requested.
215
216    You need a special version of the DHCPD server developed by the Internet Software Consortium
217    (http://www.isc.org) with a special patch to add the PXE extensions. Unfortunately as of 
218    version 3.0xx, the patch has not yet made it into the official tree. It is supposed to show
219    up in version 3.1 of the dhcpd server.
220
221    In any case, the elilo package contains a simple example of how you can configure the
222    /etc/dhcpd.conf file for a PXE-aware DHCP server using the extensions provided in the
223    patch. You can look in examples/dhcpd-pxe.conf. The syntax is very different from
224    a standard dhcpd server. 
225
226    The key elements to keep in mind are the PXE layers used by elilo to request the different
227    files:
228
229         Layer 0 : to get the name of the boot loader (elilo.efi)
230         Layer 1 : to get the name of the elilo config file
231         Layer 2 : to get the name of the kernel image
232
233   There is an IMPORTANT distinction between those layers.  The first two (0,1) and requested
234   systematically whereas the last one is used only when the configuration file is not found, i.e.,
235   what is the default kernel to boot. The actual files are STILL downloaded via TFTP. Therefore
236   the TFTP server must also be configured (see previous section for more on this).
237
238
239   a/ Getting the config file
240
241   In this mode, elilo use the PXE layer 1 to get the config file to use. Therefore this must
242   be set on the server side. Elilo will use the following sequence when
243   looking for a config file:
244
245         - use the name provide by the PXE server Layer 1 or
246
247         - elilo-ia64.conf/elilo-ia32.conf or
248
249         - elilo.conf
250
251   Elilo stops at the first match. With PXE, elilo does not try to download a config file named after 
252   the assigned IP address as it does for DHCP because there is enough flexibility in the PXE server 
253   configuration to do this.
254
255   b/ Getting the kernel image
256
257   When there is no config file, elilo will use the kernel name returned by 
258   PXE layer 2. If it is not specified there, then it default to 'vmlinux'.
259
260   c/ Getting the initial ramdisk
261
262   The filename for the ramdisk MUST come from the config file. Elilo does not use a PXE layer
263   to ask for a default name.
264
265   d/ Getting IP address information
266
267   When elilo is netbooted, the network filesystem module initializes some elilo variables
268   with the information it received from the DHCP server. At a minimum, it received the 
269   IP address.
270
271   The following information is stored in the variables indicated below:
272         - assigned IP address -> %I
273         - assigned netmask    -> %M
274         - assigned domainname -> %D
275         - assigned gateway    -> %G
276
277   These variables can be used to dynamically adjust the command line arguments passed to the kernel.
278   See section 5/ below for an example of how to use the variable.
279
280
281 4/ Netbooting and using a local root filesystem
282
283         This is the simplest configuration where the boot loader, its config file, the kernel
284         and its optional initial ramdisk are downloaded from the network BUT the kernel uses
285         the local disk for its root filesystem.
286
287         For such configuration there is no special option necessary in the elilo config file.
288         You simply need to specify which partition is the root partition.  A typical elilo.conf
289         would look as follows:
290
291         image=vmlinuz.249
292         label=linux-up
293         root=/dev/sdb2
294         initrd=ramdisk/initrd.249
295
296 5/ Netbooting a diskless machine
297
298    In this configuration we do not use the local machine's disks but instead rely on
299    a remote server to provide the root filesystem via NFS.
300
301    a/ Prerequisites
302
303    By default most kernels shipped by distributors do not have the support
304    compiled in for such configuration. This means that you need to recompile
305    your own kernel. For instance, vmlinuz-2.4.9 as shipped in Redhat7.2 on
306    both ia32 and ia64 platforms does not have the support builtin. 
307         
308    To get this configuration to work, you need to have a kernel compiled
309    such that it accepts a root filesystem over NFS (CONFIG_ROOT_NFS). This
310    necessitates that the network stack be configured with the, so called,
311    IP plug-and-play support (CONFIG_IP_PNP).
312
313    b/ On the server side
314
315    You need to have:
316         - a NFS file server  to provide the root filesystem.
317         - a DHCP/PXE server to get the IP address and download the boot loader.
318
319    Note that both do not need to be on the same machine. There is no special 
320    DHCP/PXE configuration option required to get this working. All you need
321    is a kernel compiled with the options mentioned in a/. You also need to
322    make sure that the permission on the NFS server are set appropriately
323    to allow root access from the client machine (no_root_squash), see 
324    man 'exports' for more on this.
325
326    c/ The elilo configuration file
327
328    To boot successfully, the kernel needs to:
329         - get an IP address and related networking parameters
330         - contact the NFS server to get its root filesystem
331         
332    The 2.4.x kernel series provides several options to get the IP address:
333         - it can do an internal DHCP request (CONFIG_IP_PNP_DHCP)
334         - it can do an internal RARP request (CONFIG_IP_PNP_RARP)
335         - it can do an internal BOOTP request (CONFIG_IP_PNP_BOOTP)
336         - it can get the IP address from the command line
337
338    The choice is up to you but it is a little bit stupid to go through a
339    DHCP/BOOTP/RARP phase again when this is already done by the EFI firmware.
340    So in this document, we describe how you can pass the information provided
341    by EFI on the command line of the kernel.
342
343    The syntax used to pass IP information on the command line is described in
344    the kernel source tree in Documentation/nfsroot.txt. The option is called
345    "ip=" and has the following syntax:
346
347    ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
348
349    To designate the NFS server, you must use the "nfsroot=" option. It has the
350    following syntax:
351         nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
352
353    Depending on how you want your system configured you can hardcode the
354    values of the parameters in the elilo configuration file. For instance:
355
356    image=/vmlinuz
357         label=nfsroot
358         description="kernel with NFS root"
359         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"
360
361   Note the root=/dev/nfs indicates that the root filesystem is over NFS. 
362
363   This example works fine however, it is not very flexible because the IP
364   address, the gateway, netmask and hostname are fixed and do not used the
365   values EFI used to download the boot loader and the kernel.
366
367   Elilo provides a way to dynamically customize the parameters passed on the
368   command line using substitution variables. We describe those variables in
369   elilovar.txt. The basic idea is to allow the parameters to use the dynamic
370   information obtained by the DHCP/PXE phase.
371
372   The network support in elilo defines several variables which contained
373   network related information produced by the DHCP/PXE phase. The set of 
374   variable is:
375         %I -> the IP address obtained by DHCP/PXE
376         %M -> the netmask obtained by DHCP/PXE
377         %G -> the gateway obtained by DHCP/PXE
378         %H -> the hostname obtained by DHCP/PXE
379         %D -> the domain name obtained by DHCP/PXE
380
381  So, the configuration file can then be customized as follows:
382    image=/vmlinuz
383         label=nfsroot
384         description="kernel with NFS root"
385         append="root=/dev/nfs nfsroot=192.168.2.22:/ia64_rootfs ip=%I::%G:%M:%H:eth0:on"
386
387  Not all parameters are necessary or even used by the kernel or the user level
388  configuration scripts. There is no variable to substitute the NFS server or
389  the mount point on that server.
390
391
392  In the case of a DHCP boot, this type of customization makes sense only for
393  the shared configuration file, elilo-ia64.conf/elilo-ia32.conf or elilo.conf.
394  The configuration file based on the IP address (such as C0A80205.conf in this
395  case) would provide another way of customizing parameters for a specific
396  client (IP address). The same thing holds if the name of the config file 
397  returned by the PXE server is specific to a client.
398
399
400 6/ References
401
402    More information on the PXE protocol can be found at the following web site:
403
404                 http://developer.intel.com/ial/wfm/
405
406    The source code for the standard and (possibly) PXE-enhanced DHCPD can be
407     downloaded from:
408
409                 http://www.isc.org/     
410