IPFire to allow PXE boot of any host of the netwok

Setting up IPFire and TFTPD as PXE boot environment

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

  1. From IPFire’s web interface, go to the “Services” menu, then “DHCP Server”.
  2. Set the start and end IP addresses for the DHCP server to hand out.
  3. Set the lease time as needed.
  4. 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

  1. Open a terminal window or SSH into your IPFire box.
  2. Install a TFTP server: pakfire install tftp
  3. Install an NFS server: pakfire install nfs-utils

Step 3: Download Syslinux and Extract pxelinux.0 and memdisk

  1. From a terminal window on any machine, download the latest Syslinux archive from the Syslinux website.
  2. Extract the archive.
  3. Find pxelinux.0 in the bios/com32/elflink/ldlinux/ directory and memdisk in the bios/memdisk/ directory.

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 legacyos.img.

Step 4: Configure TFTP Server

  1. Transfer pxelinux.0 and memdisk files to the TFTP root directory on your IPFire box (usually /srv/tftp).
  2. Create a pxelinux.cfg directory inside the TFTP root directory.
  3. Inside pxelinux.cfg, create a file named default containing the boot menu and paths to your kernel and initrd images.

The 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.

  1. On your IPFire box, create an export for your root filesystem. This will involve adding a line to the /etc/exports file that looks something like this:

    /path/to/nfsroot *(rw,sync,no_subtree_check)
    
  2. Replace /path/to/nfsroot with the actual directory you want to export.

  3. Restart the NFS service or the entire IPFire box to apply the changes.

Step 6: Testing

  1. 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.
  2. 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.

Relevant Wiki Documentation

6 Likes