PXE Server Setup – whitepaper

PXE Server Setup – whitepaper


This post was last updated on May 26th, 2020 at 09:37 pm

Linux PXE Server

This whitepaper will describe how to set up a pxe server.

Hardware Required: HP ProLiant Server, 1 or 2 Network ports, disk space on the network for ISO images.

The software components that make up a pxe server are the dhcp server and the tftp server. These components can be on separate servers, this method will place them on the same server.

For a pxe server to be useful, other server software is required such as nfs, ftp, http, and samba. These file sharing services can reside on the same pxe server or can exist as a separate server on the network. This method will place nfs and ftp on the same pxe server.

Overview of the pxelinux functionality:
The client machine boots to pxe which requests a dhcp address.
The dhcp server responds with an ip address for the client machine along with the address of a tftp server and a filename to load (pxelinux.0) from that server.
The client then downloads pxelinux.0 from the specified tftp server and executes it.
pxelinux.0 then searches the pxelinux.cfg directory on the server for a configuration file that matches the ip address of the machine, if no matches are found it will attempt to load a file called default.
This configuration file that is loaded by pxelinux.0 will have instructions on what to do next. Some of the choices include boot to local hard drive, boot to an image file (floppy image), or load a vmlinuz and initrd.img.

Here are the steps for setting up the pxe server:

1. Install Red Hat 8.0 on a suitable HP ProLiant server.
2. The following packages should also be installed:

dhcp-3.0pl1-9.i386.rpm (Required)
tftp-server-0.29-3.i386.rpm (Required)
tftp-0.29-3.i386.rpm (Optional)

3. The following development packages are required in addition to a default Red Hat 8.0 custom install so that you may build the syslinux software. Note: We require the use of Syslinux 2.00 or later – Syslinux 1.75 comes with Red Hat 8.0.


4. Set up date and time on the pxe server.

5. Set up the pxe server hostname.

Use this method for a static IP address when modifying /etc/hosts: localhost.localdomain localhost pxe1.pxe.net

If you have a second NIC in the server and its address is dynamic then its entry in /etc/hosts will appear as follows: pxe1.domain.net localhost.localdomain localhost pxe1

After updating /etc/hosts, run the hostname command to change the hostname:

hostname pxe1.pxe.net

Edit /etc/sysconfig/network:



6. Set up the dhcp service.
A sample /etc/dhcpd.conf configuration file is located at /usr/share/doc/dhcp-3.0pl1/dhcpd.conf.sample.
Remember that if you have more than 1 network card in the dhcp server you are required to have an entry for each NIC. For networks you will not be providing a dhcp address to, just place an empty subnet entry as follows:

subnet netmask {

7. Turn on the dhcpd and tftp services

chkconfig –level 345 dhcpd on
vi /etc/xinetd.d/tftp, change the line disabled = yes to disabled = no
service xinetd restart

8. Add the next-server and filename options into the /etc/dhcpd.conf files:

In this example we will hand out fixed addresses to our client servers, and we will place the pxe specific code along with each clients fixed address. This will aid in controlling servers at a detailed level and will work well in an environment where other machines will not be pxe booting or must etherboot instead of performing pxe boots.. Here is a sample from dhcpd.conf on how to create a fixed address and specify to pxe boot:

host 00080246e75d {
hardware ethernet 00:08:02:46:e7:5d;
filename “pxelinux.0”;

In this example we have named the server according to its MAC address. Its MAC address is listed along with the fixed IP address we want associated with it. Next is the ip address of the tftp server followed by the filename to load from the tftp server.

The above 2 lines (next-server and filename) can be placed in the global section of the dhcpd.conf file; however, it will affect all machines that attempt to boot to pxe.

9. Build and install pxelinux.0 and memdisk into the tftp directory structure.

Download and unpack the latest syslinux package from http://www.kernel.org/pub/linux/utils/boot/syslinux/

Build the syslinux package:

cd syslinux-2.02
export LANG=C
make clean install

Install pxelinux.0 and memdisk into the tftp directory:

mkdir -p /tftpboot/pxelinux.cfg
cp -a /usr/lib/syslinux/pxelinux.0 /tftpboot/

10. Populate the pxe server with items to boot from. In this example we will perform a Red Hat 8.0 installation. With the Red Hat 8.0 cdrom and bootnet.img floppy inserted perform the following steps:

cp -a /mnt/cdrom/images/bootnet.img /tftpboot/rh80-bootnet.img

cd /mnt/floppy
Note: syslinux.cfg goes into the pxelinux.cfg directory:
cp -a syslinux.cfg /tftpboot/pxelinux.cfg/rh80-syslinux.cfg

Note: All other files are stored in the /tftpboot directory:
cp -a initrd.img /tftpboot/rh80-initrd.img
cp -a vmlinuz /tftpboot/rh80-vmlinuz
for X in *.msg; do cp -a $X /tftpboot/rh80-$X; done

Note: The initrd.img and vmlinuz can also be copied from the /images/pxeboot directory of Red Hat 8.0 CD #1.

11. Edit the /tftpboot/pxelinux.cfg/rh80-syslinux.cfg configuration file so that the filenames match those in the /tftpboot directory. The following commands used in vi are helpful to make these global changes in the rh80-syslinux.cfg file:

:%s, \(.*msg\), rh80-\1,g
:%s,kernel \(.*vmlinuz\),kernel rh80-\1,

Once the above steps are complete you will have the following directory structure:


12. Create a soft link to control what happens when the pxe client boots to pxe:

The pxelinux.0 software works with the ip addresses as hex, so the ip address must be converted to hex. Our sample client translated to hex is AC3001FD.

To perform a kickstart install, we would do the following:

cd /tftpboot/pxelinux.cfg
ln -s rh80-kickstart-install-syslinux.cfg AC3001FD

13. Also set up on this server so that the kickstart installation can operate correctly is kickstart file has been placed on the nfs server, along with Red Hat 8.0 CD’s 1, 2, and 3. A kickstart file is generated after installation, or the redhat-config-kickstart program may be run, older versions of Red Hat use ksconfig.

mkdir /var/ftp/pub/kickstart
cp ks.cfg /var/ftp/pub/kickstart/rh80-ks.cfg

The following tar command will pull in the data from the first 3 CD’s so you can perform a Red Hat network installation:
Insert the Red Hat CD-Rom and mount it, then run the following commands

mkdir -p /var/ftp/pub/rh80/i386

(cd /mnt/cdrom && tar -cf – .)|(cd /var/ftp/pub/rh80/i386 && tar -xvf -); eject

14. A sample configuration of NFS is as follows:

/var/ftp/pub *(ro,insecure,sync,all_squash)

And is enabled as follows:

chkconfig –level 345 nfs on
chkconfig –level 345 nfslock on
chkconfig –level 345 portmap on

service nfs start
service nfslock start
service portmap start

Sample syslinux.cfg files:

# Install Red Hat 8.0
default linux
prompt 1
timeout 600
display rh80-boot.msg
F1 rh80-boot.msg
F2 rh80-options.msg
F3 rh80-general.msg
F4 rh80-param.msg
F5 rh80-rescue.msg
F7 rh80-snake.msg
label linux
kernel rh80-vmlinuz
append initrd=rh80-initrd.img lang= devfs=nomount ramdisk_size=9216

# Install Red Hat 8.0 via kickstart file
default ks
prompt 1
timeout 20
display rh80-boot.msg

label ks
kernel rh80-vmlinuz
append ks=nfs: initrd=rh80-initrd.img lang= devfs=nomount ramdisk_size=9216 ksdevice=eth0

# Boot to a disk image (bootnet.img)
default rh80-bootnet.img
prompt 1
timeout 600

label rh80-bootnet.img
kernel memdisk
append initrd=rh80-bootnet.img

# Perform a local boot
default localboot
prompt 1
timeout 20

label localboot
localboot 0

Previous Automated Installation of Red Hat Linux 7, 8 and AS 2.1 via PXE
Next How To Add a User During Kickstart

About author

Sibananda Sahu
Sibananda Sahu 186 posts

A Linux Kernel Developer and a Firmware Developer by profession. Have worked with few big companies: BROADCOM Corporation, Cypress Semiconductor, LSI Corporation, TOSHIBA Corporation, Western Digital; on various cutting edge technologies and product lines, such as: RAID storage Driver, SSD Firmware, WLAN Firmware etc. Having more than 9 years of experience in Software Engineering domain. Now, took a pledge to educate all aspirant students to teach about Linux Kernel Development.

View all posts by this author →

You might also like

FreeBSD Topics 0 Comments

FreeBSD: Install And Use Fish Shell

This post was last updated on August 1st, 2020 at 09:04 amIn FreeBSD, a shell is a program that interprets the command, executes, takes input(s), and prints output(s) on the

Installation 0 Comments

Proliant 1500 and RedHat 6.2

This post was last updated on May 27th, 2020 at 05:13 pmHW: PL1500 / dual 166MHz E12 8/17/98, 96MB mem, cdrom at id=6 Compaq Original Smart (EISA – SP181132-001) in

Installation 0 Comments

Clearing NVRAM through Advanced mode of SCU (System Configuration Utility)

This post was last updated on June 1st, 2020 at 12:24 pmNote: The Maintenance switch (usually switch 6) does not clear corruption in NVRAM. The maintenance switch will cause the


No Comments Yet!

You can be first to comment this post!

Leave a Reply