OpenSUSE PXE Boot
Desktop - OpenSUSE

 

What we will look at

 

  1. What is PXELinux
  2. DHCP Configuration
  3. Confirm the Installation Server Source
  4. Installing PXE and TFTP
  5. Populate the TFTP Directory
  6. Configure and Test PXE

 

 

What is PXELinux

PXE Linux provides us with a mini boot system to allow the NIC to attach to a network server to download an Operating System. It comes from the SYSLINUX package that consists of three siblings programs:-

 

  1. SYSLINUX: provides the binaries required to boot from USB
  2. ISOLINUX: provides the binaries required to boot from DVD / CD
  3. PXELINUX: provides the binaries required to boot from the network

PXE, Preboot eXecution Environment, is the process of the network boot, this requires not only the PXE Server but network cards and a BIOS that support PXE. PXELinux is the bootstrap file that is delivered via the PXE process to the host machine.

 

DHCP Configuration

In a previous article, BeginLinux took you through the configuration of the DHCP Server, so now may be time for you to review that article. Essentially there are two configuration files that are edited to maintain the DHCP Server; /etc/sysconfig/dhcpd. This will instruct the server to listen for DHCP requests on the required interface. The main configuration is /etc/dhcpd.conf. In addition to the normal subnet definition in this file we will add to the subnet options next-server and filename. The next-server tells PXE Client the TFTP Server to connect to and the filename option will let the client know which file to retrieve from the TFTP server. In the graphic we illustrate the example configuration we are using in our lab.

 

As with any change to a service it is normal to restart or, if you can get away with it, reload the service, after a change to the configuration. So is you have not already done so, prepare you DHCP server for action with: service dhcpd restart or rcdhcpd restart

 

Confirm the Installation Server Source

We should have already have copied the openSUSE installation DVD onto our server, /install/11-4 or a similar path. We have chosen to use a HTTP installation server so we also need to make sure that this directory is available to Apache. BeginLinux has taken you through this in the second article of this series. We should have a configuration file (install.conf) or similar that reads as the graphic. Adjust the directory path needing to match your requirements. If you recall the install.conf should be created in the /etc/apache2/conf.d/ directory.



A restart of the web server, or reload should then effect this change: service apache2 reload and then we can test the directory alias is working by using the command line browser:

w3m http://localhost/opensuse11-4/

 

Installing PXE and TFTP

PXE, as I mentioned before comes from the package SYSLINUX; so we will need to install this. Additionally, we need a TFTP server to host the boot files and configuration. Using SUSE we can install the packages with zypper: zypper in tftp syslinux

 

The tftp server (Trivial File Transfer Protocol) is managed by the so called super-daemon, xinetd. So if we look in the /etc/xinetd.d directory after the install we should see a file, tftp, the xinetd configuration to run the tftp service. The contents are shown below:

 

We need to remove the disable line, thus enabling the service and we need to create the directory /srv/tftpboot. This is the root of the tftp server. To start the xinetd we can use the command: service xinetd start or rcxinetd start. This will start the tftp server and we should be able to see it running with: netstat –aup | grep xinetd. Use the command: chkconfig –a xinetd to auto-start the service at boot time. See the graphic for the sequence of commands. Netstat shows that the tftp port is open but is running with the process ID 9141 created by the xinetd.

 

 

Populate the TFTP Directory

In our case the root of the tftp server is /srv/tftpboot. You will need to create this directory if you have not already done so. This directory will contain the boot files for the PXE Clients. Both the initial bootstrap file, pxelinux.0, (remember the filename parameter in the dhcpd.conf points to this), and the linux kernel and ramdisk to start the install. In addition to these files we will add the configuration files for pxelinux and a menu binary to present a simple interface to the user sat at the PC. Note: in the copy command don not overlook the trailing dot that represents the target as the current directory.

1. cd /srv/tftpboot : move to the tftpboot directory

2. cp /usr/share/syslinux/pxlinux.0 . : copy the PXE Linux bootstrap file to current location

3. cp /usr/share/syslinux/menu.c32 . : copy the menu file to the current location

4. cp /install/11-4/boot/i386/loader/linux . : copy the boot kernel to the current location

5. cp /install/11-4/boot/i386/loader/initrd . : copy the boot ramdisk to the current location

 

 

The graphic shows the sequence of commands all issued from the /srv/tftpboot directory as you can see. The listing of the directory becomes your final check. If you recall the /install/11-4 directory was originally created by copying the contents of the install DVD to your file-system. The Apache web server points to this directory though an alias.

 

Configure and Test PXE

So we have installed and configured DHCP, we have installed and tested our Apache Installation Source, we have populated the TFTP share, the final part now is to configure and test PXELinux. The boot files that we copied from the installation source, the kernel and the initialization ramdisk all come from the DVD; this would boot via ISOLINUX. As we mentioned earlier PXELINUX, ISOLINUX and SYSLINUX are all from the same family and installed via the syslinux package. They all need a similar configuration file to specify how they should boot, with PXELINUX though we have a configuration directory, pxelinux.cfg. This way we can specify different boot patterns for different PXE Clients. Yes, pxelinux.cfg is the name of the directory. In this directory we can create files named after MAC addresses of clients or HEX versions of the client’s IP Address. If we want a unified configuration for all PXE Clients then we create a file called default within the pxelinux.cfg directory.

So first, in the root of the TFTP directory we create the pxelinux.cfg directory:

mkdir /srv/tftpboot/pxelinux.cfg

Now we will create the default file, so it will affect all PXE Clients:

vi /srv/tftpboot/pxelinux.cfg/default

The default configuration file should look something like this once finished:

 

Let’s take a look in a little more detail at the file, remember that the configuration is for a bootstrap file, in our case, pxelinux.0 but could equally be for syslinux and isolinux. As you then might expect, it is not dissimilar to the GRUB bootloader configuration file, menu.lst. The file specifies the kernel to boot from and any kernel options.

default menu.c32 : loads the menu as default

prompt 0 : loads menu without prompting

menu title openSUSE Installation : title

timeout 600 : if no selection made in 60 seconds (600 tenths)

ontimeout harddisk : then boot from hard disk (label harddisk )

# hard disk

label harddisk : defines the harddisk settings

menu label BootHardDrive : name in menu

localboot 0x80 : this denotes to boot from the disk 0

# install

label openSUSE : another label and option definition

menu label openSUSE 11-4 : name in menu

menu default : the default selection in the menu but you have to enter on this for it to be effective otherwise the ontimeout action applies

kernel linux : loads the kernel named linux from root of tftp directory

append initrd=initrd splash=silent showopts install=http://172.17.1.1/opensuse11-4/ : other kernel options including the install path

 

We are using a menu here but you do not have to, I think it makes it a lot easier otherwise the user would need to type in a label for it to be effective. Selection from a menu does seem an efficient way to go. Having the ontimeout option set to boot from hard disk means that even if PXE boot is the default option in the client’s BIOS it will install just the once. Subsequent reboots will boot from the disk without any selection being chosen.

With the file saved we just need to test from a PXE enabled host now to see if we see the menu and can start the install.

 

Great, this is some achievement. If you have problems double check your services are started and if you cannot access the install server try from a browser, make sure you can access your host on the URL http://<yourserver> /opensuse11-4/ .