Booting ISO images from the network

"Today was good. Today was fun. Tomorrow is another one." - Dr. Seuss

Here is a simple and somewhat elegant setup to boot ISO images off a server. If you want to have ISO images available for use or installation on your network, this might be the most painless way to do it.

1. TFTP server

Any TFTP service should do the trick. Most distros have tftp-hpa in their repositories and a default setup will do just fine. Just start the service and find out which directory it serves. Default is usually /srv/tftp/.

If you are going to use dnsmasq for DHCP, you can use it for TFTP as well. Create the directory you want to serve the from and add/uncomment these lines in your dnsmasq.conf:

2. IPXE image

We need to build a custom IPXE image, but once it's built there should be no need for further rebuilds except to update it to a newer version of IPXE.

First we prepare things:
$ mkdir ipxe-build
$ cd ipxe-build
$ git clone git://

Create file called myscript.ipxe in the current directory using this as a template and change the server address:

ifopen ||
chain http://##web-server-name-or-IP##/ipxe/ || shell

Now that we are ready, we can build the image:
$ cd ipxe/src/
$ make bin/ipxe.pxe EMBED=~/ipxe-build/myscript.ipxe

If the build breaks, you are probably missing some dependancies, check the IPXE site for a list. Your built image is in ~/ipxe-build/ipxe/src/bin/ipxe.pxe, copy it to your TFTP directory, that will be the only file going there.

3. web server

For this step you will either need any web server, but anything that runs PHP will make the whole setup simpler. I used apache, but it really doesn't matter.

Again, we prepare things:
$ cd ##vhost-directory##
$ mkdir -p ipxe/images
$ cd ipxe
$ wget ""

And we create the index.php file with these contents:

header("Content-Type: text/plain");

echo "#!ipxe\n";
echo "\n";
echo "menu Choose operating system to boot\n";

if ($handle = opendir('images/'))
	while (false !== ($entry = readdir($handle)))
		if (substr($entry, -4) === '.iso')
			echo "item " . $entry . " " . $entry . "\n";

echo "choose target && imgfetch images/\${target} && chain memdisk iso raw || shell\n";


That small PHP script will generate a menu with all the iso files that we have in the images directory, so that we never have to update our list.

Alternatively, you can have a plain text file instead of the script, but you will have to update it every time you add a new image. The script generates something like this:

menu Choose operating system to boot
item archlinux-2014.04.01-dual.iso archlinux-2014.04.01-dual.iso
item TinyCore-current.iso TinyCore-current.iso
choose target && imgfetch images/${target} && chain memdisk iso raw || shell

4. DHCP server

Configure your DHCP server to point to the IPXE image on your TFTP server.

If you are running dnsmasq, all it takes is adding/uncommenting this in your config:

how to use the setup

Just add images to the ipxe/images/ directory on your vhost and they will appear in the boot menu automatically, just make sure the file names end with ".iso". Good luck.