Next Previous Contents

6. Bootloader

PXE can load a program into the client's memory and start it. I found it the easiest to manage, if I first load a bootloader into the clients. The bootloader then loads its configuration file via TFTP from the next-server (tftpsrv in the dhcpd.conf file example above).

Get H. Peter Anvin's pxelinux part from his syslinux package ( http://syslinux.zytor.com/). Compile it and copy the file pxelinux.0 in your /tftp/ directory on your TFTP server.

The bootloader configuration file determines whether a client boots from its local hard disk or over the network.

Here are example configuration files for both cases:

Red Hat 6.2 network boot (filename default.netboot-6.2):

default linux
serial 0,38400n8
label linux
  kernel vmlinuz-6.2
  append console=console=tty0 ttyS0,38400 load_ramdisk=1 \
         initrd=initrd-6.2.img network \
         ks=nfs:nfssrv:/data/Kickstart/ks-6.2.cfg

Red Hat 7.2 network boot (filename default.netboot-7.2):

default linux
serial 0,38400n8
label linux
  kernel vmlinuz-7.2
  append ksdevice=eth1 console=tty0 console=ttyS0,38400 load_ramdisk=1 \
         initrd=initrd-7.2.img network \
         ks=nfs:nfssrv:/data/Kickstart/ks-72.cfg

Watch out for the line breaks in the "append" line. They are here for readability only - the kernel cannot handle them!

(Side note: With the above console definitions appended to the linux kernel you are able to follow the Kickstart installation on a serial console.)

You might encounter problems with DHCP if your clients have multiple ethernet adapters (NICs). The effect is, that PXE itself receives a DHCP offer but the booted kernel attempting a kickstart installation does not. A remedy for this problem is to add ip=dhcp to the list of kernel parameters in the append line in the default.netboot-XYZ file.

Boot from local hard disk (filename default):

default linux
label linux
  localboot 0

pxelinux.0 tries to read several configuration files. It uses the first one it finds. The filenames it looks for are determined by the IP address of the client it is running on. It converts the four decimal number parts of an IP address (they are devided by dots) into hexadecimal numbers and concatenates them. Example: IP address 192.168.0.11 gets converted into C0 A8 00 0B (without the spaces).

The search for files starts at C0A8000B and proceeds by removing one digit from the right (leaving C0A8000) and so forth. When all digits are removed it will try as last resort the filename default.

On your TFTP server, this algorithm can be used to tell each single machine how to boot:

/tftp/pxelinux.cfg/
                   C0A8000B -> default.netboot-7.2     # install Red Hat 7.2 on 192.168.0.11
                   C0A8000C -> default.netboot-6.2     # install Red Hat 6.2 on 192.168.0.12
                   default.netboot-6.2
                   default.netboot-7.2
                   default

This is important if you install a lot of machines at the same time. You can watch the syslog file on your TFTP server and whenever a client got its initial RAM disk transmitted, you can remove the symlink for that machine from the pxelinux.cfg directory. This forces the client to load the default configuration which says: "Boot from local disk!" when it reboots after Kickstart is done.

Technically, it is not necessary to use a bootloader. PXE can load a Linux kernel directly if told so by DHCP. I did not try this because of the reasons mentioned in the previous paragraph I find it less convenient: You would have to change the dhcpd.conf file to tell a machine not to do a network boot any more but a boot from the local hard disk. Editing this file on the fly is more hassle than changing one symlink.


Next Previous Contents