Udpcast Cloning: Preparing the DHCP Server for PXE Booting

From Debian Clusters
Jump to: navigation, search

This is the third page of a five part tutorial on cloning worker nodes with Udpcast. The full tutorial includes

Bootloader and TFTP

By now, the DHCP Server should be set to serve up IP addresses to all of the nodes. We need to set it up so that it not only serves out DHCP leases (which includes the IP address), but also sends out an image for all of the worker nodes to boot up from. (Specifically, we'll send out an image that includes udpcast - more about that later.) This requires two new packages. First, we need a boot loader. The boot loader allows DHCP to send out an image to the nodes. The nodes will store this image in their NIC ROM and then boot from it. (This is called PXE (Preboot eXecution Environment) booting. To install the Syslinux boot loader,

apt-get install syslinux

When the nodes connect to the dhcp server to obtain a bootable image, they'll use the trivial file transfer protocol (tftp) to transfer the image. This means the DHCP server also needs to be running a TFTP server to answer these requests and send the bootable image over TFTP. tftpd-hpa is one of these servers, so next,

apt-get install tftpd-hpa

The configuration file for tftpd-hpa is stored at /etc/default/tftpd-hpa. If you open the file, you should see this:

#Defaults for tftpd-hpa
RUN_DAEMON="no"
OPTIONS="-l -s /var/lib/tftpboot"

First, to turn the server on, RUN_DAEMON's value needs to be changed to yes. Under the OPTIONS field, the default directory for TFTP is shown (/var/lib/tftpboot). This is the directory that the TFTP server will serve up files from, so this is where the bootable images need to be placed.

Configuring DHCP for PXE Booting

Now DHCP needs to be set up to send out a PXE image. These changes need to be made in /etc/dhcp3/dhcpd.conf. First, the lines

allow booting;
allow bootp;

need to be added near the top of the file. These can be put before any of the "option definitions common to all supported networks" bit. Next, we'll move all the worker nodes within a group in the field. Before the start of the worker nodes, add

group {
        next-server 192.168.1.254;
        filename "pxelinux.0";

next-server should be the IP address of your DHCP server (mine is 192.168.1.254). We'll move the pxelinux.0 file to its proper place shortly. Add a closing bracket (one of these: } ) after the last worker node entry. My dhcpd.conf file now looks like this. For a more detailed explanation, see the PXELINUX - SYSLINUX for network boot page on the Syslinux site.

After making changes to the dhcpd.conf, the DHCP server needs to be restarted. Do this with

/etc/init.d/dhcp3-server restart

Setting up the Udpcast Image

Since we're trying to send out the file pxelinux.0 (specified in /etc/dhcp3/dhcpd.conf, it had better be in the location the TFTP server will look for it in (specified in /etc/default/tftpd-hpa). When installing Syslinux, it automatically puts the file in /usr/lib/syslinux/pxelinux.0. Copy it to the proper place:

cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/

Next, we need to get the configuration file, the kernel, and the ram image from the udpcast site (specifically, from http://udpcast.linux.lu/bootloader.html#pxe). From the /var/lib/tftpboot/ directory, use

wget http://udpcast.linux.lu/20070602/linux

and

wget http://udpcast.linux.lu/20070602/initrd

The first one is the kernel (the operating system), and the second is the image that will be loaded. The image contains almost nothing except udpcast, which will be used to send out and receive the image that's being cloned.

Next, create the directory /var/lib/tftpboot/pxelinux.cfg and move into it. The configuration file for this image needs to be placed here. Do this with

wget http://udpcast.linux.lu/default

This file specifies where the kernel and the image are (right where we already put them), as well as some additional parameters.

Personal tools
Namespaces

Variants
Actions
About
services
node images
clustering
web monitoring
Tools