The PXE Page

1.  What is PXE?
PXE is an acronym for Pre-Boot Execution Environment.
The PXE vision is to "Make the network interface a standard, industry-accepted PC boot device",  adding the NIC to the traditional list of standard boot devices.
This allows the client PC to "network boot.", opening up a vast array of management and support features.
Rather than booting from Floppy, CDROM Hard Disk ...you can boot over the network
It really cool and really fast

2.  What can PXE mean to me?
In our lab, we use Ghost a lot for our x86 servers and workstations
Making a Dos boot disk with networking, TCP/IP and SMB for this Ghosting is more pain than a trip to the dentist
PXE offers a much easier way  to boot x86 based PC's giving us access to network shares
From there, Ghosting is a snap

3.  Why did you create this page?
I had to move our PXE server from an older Fedora Core release 1 box to a newer PC.
I wanted to do it all under FreeBSD of course.
The old PXE server was originally implemented by people who often blindly stumbled through things without any regard to common sence, manuals or even man pages (eek)
The final product worked but what a god awfull mess they left behind.
I like to understand what I do so I learned it from the ground up.
This page is thus a collection of notes from my PXE on FreeBSD experience
I hope you find it helpfull

4.  Where can I get more PXE information?
You can find the Intel PXE SDK here
The PXE Daemon I used under FreeBSD is here
I used PXELinux for booting from here

5.  Our PXE implementation (the old way)
Fedora Core Release 1 (2.4.22-1) with Intel PXE daemon, PXE-2.0 Beta-1 (build 001)
With this PXE implementation, the PXE Daemon could act as a proxyDHCP
The DHCPD could be on another box with its configuration file tailored to see the PXE server
Our old PXE.conf is in the fc1 directory here
This old method used the Intel PXE SDK disk images that were modified for our needs
I didnt create it so I don't know much more about it.
I do know that it often puked during our aggressive Ghosting methods with silly Dos errors.

6.  Our PXE implementation (the new way)
FreeBSD 4.11 (I like the 4.x branch, so shoot me)
PXE 1.4.2  (It's a port)
PXELINUX (http://syslinux.zytor.com/pxe.php)
tftp-hpa (It's a port, also PXELINUX currently requires that the boot server has a TFTP server which supports the "tsize" TFTP option
isc-dhcp3-server (It's a port)
From what I have infered, this implementation of PXE daemon requires the DHCPD to be on the same machine

Now, for this machine I wanted two choices.
1.  Use some Bart Boot disk images I created.  This method does not require a PXE daemon to work
2.  Continue to use the Intel PXE SDK disk images for our older gear.  This method disk requires a PXE daemon to work

The Barts boot disks had the advantages of supporting more hardware and no silly Dos errors.
Lets cover the Barts boot disk method first


7.  Using a PXE enabled client PC to boot a Barts network boot disk floppy image using FreeBSD with DHCPD, TFTPD and PXELINUX
Here, I'm going to explain how I setup a FreeBSD server to provide a Bart's boot disk floppy image to PXE enabled clients
Please note that a PXE Daemon is not required since we are only sending the boot disk image to the client.
I'm using Bart's Network floppy boot disk in this case.  Whatever floppy disk you choose, make sure it's functioning before trying to boot it using the PXE client

1.  Install FreeBSD 4.11 minimal install with ports source and docs
2.  Install the cvsup-whithout-gui package
3.  cvsup the ports and source tree
4.  Install  isc-dhcp3-server

5.  Edit /usr/local/etc/dhcpd.conf accordingly
Here's mine

allow booting;
allow bootp;
ddns-update-style none;
option broadcast-address 192.168.10.255;
option domain-name "your.domain";
option subnet-mask 255.255.255.0;
server-name "pxe-gw";
server-identifier 192.168.10.15;
next-server 192.168.10.15;
default-lease-time 6000;
max-lease-time 72000;
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.132 192.168.10.252;
option root-path "/tftpboot";
filename "/tftpboot/pxelinux.0";
}

6.  Obtain pxelinux.0 and memdisk from http://syslinux.zytor.com/pxe.php
7.  Create /tftpboot
8.  Put pxelinux.0 and memdisk in /tftpboot
9.  Create /tftpboot/pxelinux.cfg/default
Here's mine

PROMPT 1
DEFAULT ghost
DISPLAY messages
TIMEOUT 100
label local
        LOCALBOOT 0

label ghost
        KERNEL memdisk keeppxe
        APPEND initrd=bart.img

10.  Create a image of your network book floppy you want to boot from
I had already created a boot disk so all I needed to do was create a boot disk image using this on my FreeBSD box
#dd if=/dev/fd0 of=/tftpboot/bart.img

11.  Create /tftpboot/messages to show a message on the screen at boot time

12..  Start your dhcpd and start a pxe enabled client

Hopefully your clients will get an IP,  get and boot pxelinux.0, show messages, boot the default or selected image

8.  Using a PXE enabled client PC to boot a Intel PXE network boot disk floppy image using FreeBSD with PXED DHCPD, TFTPD and PXELINUX
Same as above but also install the following ports
PXE
tftp-hpa

You'll need to adjust a few files

/usr/local/etc/pxe.conf
/usr/local/etc/dhcpd.conf
/etc/inetd.conf
/etc/services
/tftpboot

Feel free to have a look at my files under the FreeBSD directory here


9.  It appears that the PXE daemon wont start.  PXE -d results in "PXE daemon already running"
ps -auxw | grep pxe shows no running daemon
Man I had this happen a few times.
I never found any helpful documentation and twice now I resorted to a reinstall
Eek, that's something you do in Windows, not Unix
It hapenned again recently and this time I dug enough to fix it
I ran the strings command on the PXE daemon /usr/local/sbin/pxe and saw a reference to /tmp/pxe.pid
I suppose some non graceful shutdowns resulted in /tmp/pxe.pid not being cleaned out on the way down
I simply renamed /tmp/pxe.pid and the daemon started without a hitch

I wanted to fix this issue permanetely so I did two things
First, I learned a bit about rc.d scripts and wrote one to start and stop the pxe daemon
I added the following to a file called usr/local/etc/rc.d/pxed (Dont forget to make it executable chmod 555)
Also don't forget to add pxe_enable="YES" to your rc.conf

#!/bin/sh
#
# PROVIDE: pxe
# REQUIRE: DAEMON
# KEYWORD: shutdown

#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
# SET THEM IN THE /etc/rc.conf FILE
#
pxe_enable=${pxe_enable-"NO"}
pxe_flags=${pxe_flags-""}
pxe_pidfile=${pxe_pidfile-"/tmp/pxe.pid"}

. /etc/rc.subr

name="pxe"
rcvar=`set_rcvar`
command="/usr/local/sbin/pxe"

load_rc_config $name

pidfile="${pxe_pidfile}"

/usr/local/bin/stalepid /tmp/pxe.pid pxe
start_cmd="echo \"Starting ${name}.\"; /usr/bin/nice -5 ${command} ${utility_flags} ${command_args}"

run_rc_command "$1"


I struggled with writing into this script the ability of deleting an existing /tmp/pxe.pid if a non gracefull shutdown failed to clean it up
In this process, I discovered the FreeBSD port of stalepid (http://devel.ringlet.net/sysutils/stalepid/)
Why reinvent the wheel?
The above script assumes this port is installed