This is an all-in-one solution for self-hosting and managing PXE ROMs, Linux
kernels and kernel preseeds. Use the provided Makefile
to build
custom PXE ROMs which point to a self-hosted TFTP and HTTP server.
-
Build the PXE ROMS,
-
Build on native host simply by calling
make
. -
Or, build use the provided
Dockerfile
:$ make container $ docker run -it --rm \ -v $(pwd)/out:/pxe-roms/out:rw \ nderjung.net/pxe-roms:latest \ make
You can also specify specific roms, e.g.
make ubuntu/xenial64
or create your own by adding them into theconfig/custom
directory. -
(Optional) You can embed a preseed url for the rom you are building by providing an environmental variable
PRESEED_URL
during make:$ make PRESEED_URL=... ubuntu/xenial64
-
-
Set up a TFTP server to host the PXE ROMs,
-
Set the hostname, e.g.
tftp
. -
Expose port
udp/69
. -
Install and run the TFTP server:
-
You can use the built in TFTP server:
$ DOCKER_TARGET=serve make container $ docker run -it --rm -p 69:69/udp nderjung.net/pxe-roms:latest
-
Or, install one via package manager, e.g:
# apt install -y tftpd-hpa tftp-hpa xinetd
Then copy the contents from
out/
to the TFTP server:$ scp -r out/ 10.1.0.69:/srv/tftp
-
-
-
(Optional) Set up a HTTP server to host preseeds and kernels. A pre-built server is included in the
docker-compose.yml
file as an example. In the rest of this tutorial, I will be referring tohttps://pub.nderjung.net
as the self-hosted HTTP server. -
Set up a DHCP server to indicate to the network bootable server a ROM is available,
-
Set the hostname, e.g.
router
. -
Edit
/etc/dnsmasq.conf
:# Define PXE ROMs as seperate tags (from `out/`) dhcp-boot=tag:ubuntu-trusty64-serial, pxelinux.ubuntu-trusty64-serial, <router_ipaddr>, <tftp_ipaddr> dhcp-boot=tag:ubuntu-trusty64-preseed, pxelinux.ubuntu-trusty64-preseed, <router_ipaddr>, <tftp_ipaddr> dhcp-boot=tag:ubuntu-xenial64-serial, pxelinux.ubuntu-xenial64-serial, <router_ipaddr>, <tftp_ipaddr> dhcp-boot=tag:ubuntu-xenial64-preseed, pxelinux.ubuntu-xenial64-preseed, <router_ipaddr>, <tftp_ipaddr> dhcp-boot=tag:ubuntu-bionic64-serial, pxelinux.ubuntu-bionic64-serial, <router_ipaddr>, <tftp_ipaddr> dhcp-boot=tag:ubuntu-bionic64-preseed, pxelinux.ubuntu-bionic64-preseed, <router_ipaddr>, <tftp_ipaddr> # (Optional from 3.) Define a new DHCP option for retrieving the preseed URL, # and define the specific preseed URLs for the relevant tags. # ${preseed-url} will be replaced in relevant PXE config files dhcp-option=244,preseed-url dhcp-option=tag:ubuntu-trusty64-preseed,244,"https://pub.nderjung.net/preseeds/ubuntu.trusty64.cfg" dhcp-option=tag:ubuntu-xenial64-preseed,244,"https://pub.nderjung.net/preseeds/ubuntu.xenial64.cfg" dhcp-option=tag:ubuntu-bionic64-preseed,244,"https://pub.nderjung.net/preseeds/ubuntu.bionic64.cfg" # Set device-specific ROMs (adjust accordingly) dhcp-host=<hwaddr>, set:ubuntu-trusty64-serial, <ipaddr>, <hostname> dhcp-host=<hwaddr>, set:ubuntu-xenial64-preseed, <ipaddr>, <hostname>
-
(Optional) To acknowledge the new DHCP option for the preseed URL, you must define it.
-
In a BSD-like environment, you can edit
/etc/config/dhcp
and add the following: -
In Linux-like environment, you can edit
/etc/dhcpd.conf
and add the following:option preseed-url code 244 = string;
-
-
Restart the service:
# /etc/init.d/dnsmasq restart
-
-
Reboot and viola!