By thomas, Tue, 05/12/2009 - 10:46
After restarting our dhcp server, we can boot the client machine using PXE. The details of this vary from machine to machine, but on most of the machines I have you press F12 during the BIOS splash screen to enter a boot menu. From the boot menu you can select boot from network. Some machines are PXE capable but have the PXE option turned off. To turn it on you'll need to enter the bios setup (usually F1 or F2) and enable PXE on the network interface.

Here is result of an attempt to boot PXE on our client at this point.

CLIENT IP: 192.168.0.31 MASK: 255.255.255.0 DHCP IP: 192.168.0.1 GATEWAY IP: 192.168.0.1 PXELINUX 3.10 2005-08-24 Copyright (C) 1994-2005 H. Peter Anvin UNDI data segment at: 00097680 UNDI data segment size: 3980 UNDI code segment at: 0009B000 UNDI code segment size: 4950 PXE entry point found (we hope) at 9B00:00D6 My IP address seems to be C0A8001F 192.168.0.31 ip=192.168.0.31:0.0.0.0:192.168.0.1:255.255.255.0 TFTP prefix: linux-install/ Trying to load: pxelinux.cfg/01-00-11-22-33-44-5a Trying to load: pxelinux.cfg/C0A8001F Trying to load: pxelinux.cfg/C0A8001 Trying to load: pxelinux.cfg/C0A800 Trying to load: pxelinux.cfg/C0A80 Trying to load: pxelinux.cfg/C0A8 Trying to load: pxelinux.cfg/C0A Trying to load: pxelinux.cfg/C0 Trying to load: pxelinux.cfg/C Trying to load: pxelinux.cfg/default Could not find kernel image: linux boot:
Why does PXE search for all these files? The idea here is that you could create a configuration that applies to a specific MAC address or a specific ip address or even a range of ip addresses. If you wanted to have the same configuration on machines in the range 192.168.0.16 to 192.168.0.32, you would create a file named C0A8001. Since 16 is 10 in hexadecimal and 32 is 20 in hexadecimal, machines with ip addresses 192.168.0.16 through and including 192.168.0.31 would use this file.
What has happened here is that our client broadcast on the network for a dhcp address and received the address 192.168.0.31 (CLIENT IP) from our dhcp server 192.168.0.1 (DHCP ID). The client then loaded pxelinux.0 and executed it. Once executed, pxelinux.0 printed out the banner starting at PXELINUX 3.10 and it then began looking for a pxelinux.cfg file to load. It started with a representation of the client MAC address. The MAC address is a hardware address for the ethernet card in our client, in our case it is 00:11:22:33:44:5a. PXELinux attempts to load the configuration 01-00-11-22-33-44-5a from the pxelinux.cfg directory. Since we don't have any files in pxelinux.cfg, this file is not found, so it begins looking for other possible configuration files starting next with the hexadecimal representation of the client IP address. The client ip address is 192.168.0.31, using hexadecimal notation for each octet (remember that IP addresses are in the range 0 - 255 for each octet or number between periods) we translate 192 into C0, 168 into A8, 0 into 00, and finally 31 into 1F arriving at C0A8001F. This file is not found, so PXELinux starts stripping off the last character and trying again. It repeats the process all the way down to C and then looks for the file called default.

To allow our machine to boot, we will create a default configuration file in /tftpboot/linux-install/pxelinux.cfg

default linux

label linux
	kernel vmlinuz
	append initrd=initrd.img ramdisk_size=10000
This file specifies that our client should by default load the configuration that has label linux. Our definition of linux instructs pxelinux.0 to load the file vmlinuz as our kernel and append initrd=initrd.img ramdisk_size=10000 to the kernel command line. These files do not exist yet, so we will copy them from the install media to /tftpboot/linux-install. All paths in this configuration file are relative to /tftpboot/linux-install, pxelinux.0 informed us of this with the TFTP prefix: line in the screenshot above.
[root@server1 ~]# cd /tftpboot/linux-install     
[root@server1 linux-install]# cp /var/www/html/install/images/pxeboot/vmlinuz .
[root@server1 linux-install]# cp /var/www/html/install/images/pxeboot/initrd.img .
With all the files in place, we can restart out client and allow it to pxeboot. Your client should load the default file and begin loading the kernel we specified (vmlinuz).
PXELINUX 3.10 2005-08-24 Copyright (C) 1994-2005 H. Peter Anvin UNDI data segment at: -00095DB0 UNDI data segment size: 0000 UNDI code segment at: 0009C020 UNDI code segment size: 0000 PXE entry point found (we hope) at29C02:01060 My IP address seems to be C0A8001E 192.168.0.30 ip=192.168.0.30:192.168.0.1:192.168.0.1:255.255.255.016 TFTP prefix: linux-install/ Trying to load: pxelinux.cfg/01-00-11-43-e7-7d-32 Trying to load: pxelinux.cfg/C0A8001E Trying to load: pxelinux.cfg/C0A8001 Trying to load: pxelinux.cfg/C0A800 Trying to load: pxelinux.cfg/C0A80 Trying to load:8pxelinux.cfg/C0A8 Trying to road: pxelinux.cfg/C0A Trying to load:2pxelinux.cfg/C0 Trying to l ad: pxelinux.cfg/C Trying to load: pxelinux.cfg/default Loading vmlinuz................................ Loading initrd.img.............................................................. ................... Ready.

The client will boot into an install environment called anaconda. You could follow the installation wizard through the various options to configure your new client at this point. We are more interested in automating the process. Automatically choosing installation options is handled by a kickstart configuration file. We'll build a kickstart file in the next section.