I have lots of computers, and, as I grow older, ever decreasing amounts of patience. So, when I want to reinstall the operating system on something, I don't want to mess around with floppy disks, CD-ROMs or USB flash drives.

On most recent unix-ish systems you can install dnsmasq to provide a combined DNS, DHCP, PXE and TFTP server with very little configuration.

Here's the bare bones of a working DHCP, PXE + TFTP configuration:

# The range in which we offer IP addresses

# Set up three static hosts who will always get the same IP

# Set the gateway address assigned to DHCP clients

pxe-prompt="== PXE Netboot Server =="
pxe-service=x86PC, "Boot from local disk"
pxe-service=x86PC, "Install a new operating system", pxelinux


That's about as simple as it gets and will serve IP addresses in the range to any DHCP client on your network.

In addition, if a PC-based system boots up and has PXE enabled, it will get a menu prompting it to either Boot from local disk or Install a new operating system.

Selecting the latter option will chain load a TFTP pxelinux menu entry system from /export/tftp - which you'll need files from the syslinux package installing to create.

In order to have a complete PXE menu system you'll want syslinux installing and the following files:

  • pxelinux.0
  • menu.c32
  • mboot.c32

There are additional options, but using just the above 3 will give you a menu system that can cope with netbooting most operating systems.

My /export/tftp directory looks like this:

  • /export/tftp - directory
  • /export/tftp/pxelinux.0 - binary file from syslinux; loaded when the user chooses Install a new operating system from the dnsmasq menu entries
  • /export/tftp/pxelinux.cfg/ - directory
  • /export/tftp/pxelinux.cfg/default - a text file; my default boot menu
  • /export/tftp/syslinux/ - directory
  • /export/tftp/syslinux/menu.c32 - binary file from syslinux; code to generate the menu itself
  • /export/tftp/syslinux/mboot.c32 - binary file from syslinux; code to boot certain operating system bootloaders

I then have the following in the default menu file:

default syslinux/menu.c32
prompt 0

MENU TITLE Installer Menu
menu separator

LABEL LinuxMint
MENU LABEL Linux - Mint Menu
KERNEL menu.c32
APPEND pxelinux.cfg/linux-mint

LABEL LinuxUbuntu
MENU LABEL Linux - Ubuntu Menu
KERNEL menu.c32
APPEND pxelinux.cfg/linux-ubuntu

KERNEL menu.c32
APPEND pxelinux.cfg/netbsd

KERNEL menu.c32
APPEND pxelinux.cfg/dos

This serves as my root menu, with operating system flavours branching off. For example, the Linux - Ubuntu menu would then serve to actually boot and install Ubuntu, selecting MS-DOS/Windows would launch a DOS boot floppy, etc.

Currently I have the following entries:

  • Linux - Mint - Boots to a live Mint Linux installer (Mint 18 and 19)
  • Linux - Ubuntu - Boots to a text mode Ubuntu 16 or 18LTS installer
  • Unix - NetBSD - Boots to a NetBSD 7 or 8 installer
  • Unix - Solaris - Not using dnsmasq, but similar support for network booting a Solaris/Sparc machine
  • MS-DOS/Windows - Boots either a DOS 6 or Win98SE boot floppy image
  • blog/netboot.txt
  • Last modified: 2018/11/28 09:02
  • by john