PXE (Preboot eXecution Environment) is a standard created by Intel that allows a computer to load an operating system over a network before or instead of booting its own local operating system.
This is a comprehensive guide to set up a PXE boot environment on a functional IPFire firewall. However, this is NOT a tutorial on how to boot IPFire installation disk using PXE, which is already documented in the WIKI.
This tutorial will include setting up DHCP, TFTP, and NFS services on IPFire, and downloading the necessary files from the Syslinux project.
Step 1: Configure DHCP on IPFire
- From IPFire’s web interface, go to the “Services” menu, then “DHCP Server”.
- Set the start and end IP addresses for the DHCP server to hand out.
- Set the lease time as needed.
- Under “PXE Boot”, put the filename of your PXE boot file (
pxelinux.0) and the IP address of your TFTP server (it can be the IPFire box if you’re running the TFTP server there).
Step 2: Install TFTP, NFS Servers, and necessary utilities on IPFire
- Open a terminal window or SSH into your IPFire box.
- Install a TFTP server:
pakfire install tftp
- Install an NFS server:
pakfire install nfs-utils
Step 3: Download Syslinux and Extract pxelinux.0 and memdisk
- From a terminal window on any machine, download the latest Syslinux archive from the Syslinux website.
- Extract the archive.
The memdisk file is also a part of the SYSLINUX project, and it’s used to boot legacy operating systems which require a floppy or CD-ROM drive. The memdisk file, along with an image file of the floppy or CD-ROM, can emulate these drives during the boot process. In this case, you also need an image file (.img for a floppy disk, .iso for a CD-ROM) of the legacy operating system or utility you wish to boot. This file should also be placed in the TFTP server’s directory. For the purpose of this tutorial, we’ll refer to this image file as
Step 4: Configure TFTP Server
memdiskfiles to the TFTP root directory on your IPFire box (usually /srv/tftp).
- Create a
pxelinux.cfgdirectory inside the TFTP root directory.
pxelinux.cfg, create a file named
defaultcontaining the boot menu and paths to your kernel and initrd images.
default file may look like this:
default menu.c32 prompt 0 timeout 300 ONTIMEOUT local MENU TITLE PXE Menu LABEL linux MENU LABEL Linux KERNEL vmlinuz APPEND initrd=initrd.img root=/dev/nfs nfsroot=192.168.1.1:/path/to/nfsroot ip=dhcp rw LABEL legacyos MENU LABEL Legacy OS KERNEL memdisk APPEND initrd=legacyos.img
In this case,
vmlinuz is the kernel,
initrd.img is the initial RAM disk, and
legacyos.img is the disk image for the legacy OS. Replace these filenames and the nfsroot path with the correct ones for your setup.
Step 5: Configure NFS Server
This step will provide a network mount for the root file system. If you are booting from an img file of a live distribution using the legacy OS option, the root directory will be already present in the image file.
On your IPFire box, create an export for your root filesystem. This will involve adding a line to the
/etc/exportsfile that looks something like this:
/path/to/nfsrootwith the actual directory you want to export.
Restart the NFS service or the entire IPFire box to apply the changes.
Step 6: Testing
- On a PXE-capable client, set the boot order to network first. When it boots up, it should get an IP address from the IPFire DHCP server, then load the boot file from the TFTP server.
- The boot menu should allow you to boot either Linux with a network filesystem, or a legacy OS from an image file.
Remember to replace IP addresses, file paths, and other specific values with those that correspond to your particular setup.