Table of Contents
Introduction
For years I have been walking around with a “multiboot rescue USB drive” with YUMI on it so that I can easily boot Linux or GParted in case of an emergency. The software on it is usually outdated or no longer works or I just need something that is not on it. So it was time to come up with something else for this.
I came across netboot.xyz and this seems like a nice replacement for my USB drive.
Netboot.xyz is a way to PXE boot various operating system installers or utilities from one place within the BIOS without the need of having to go retrieve the media to run the tool. iPXE is used to provide a user friendly menu from within the BIOS that lets you easily choose the operating system you want along with any specific types of versions or bootable flags.
You can remote attach the ISO to servers, set it up as a rescue option in Grub, or even set up your home network to boot to it by default so that it’s always available.
Prerequisites
- A server with Docker installed
- A TFTP server hosting the latest iPXE kernel builds from netboot.xyz
- An existing DHCP server where you can set this TFTP server as your DHCP boot destination
- A PXE-enabled client
I will be using my Synology NAS (DS716+) as the TFTP server (including netboot.xyz) and a Synology router (RT1900ac) as the DHCP server. But this will work on other hardware as well.
LinuxServer.io has created a Docker image that contains the TFTP server and netboot.xyz. This image can be found here and will be installed on the Synology NAS.
On the Synology router we will configure the DHCP server so it can locate the TFTP server and netboot.xyz files.
For testing I will be using my laptop. Nowadays, most clients are PXE-enabled and can boot from the network. Chances are you can enable this in the BIOS.
In addition to physical hardware, we will also see if it works on a virtual machine using Hyper-V.
Installation
Synology NAS
Install Docker if you haven’t already. Have a look at Using Docker on Synology NAS if you don’t know how.
Based on the documentation, we create the following docker-compose.yaml
file.
---
version: "2.1"
services:
netbootxyz:
image: ghcr.io/linuxserver/netbootxyz
container_name: netbootxyz
environment:
- PUID=1027
- PGID=100
volumes:
- /volume1/docker/netbootxyz/config:/config
- /volume1/docker/netbootxyz/assets:/assets
ports:
- 3000:3000
- 69:69/udp
- 8080:80
restart: unless-stopped
networks:
netbootxyz_network:
ipv4_address: 192.168.0.250
networks:
netbootxyz_network:
driver: macvlan
driver_opts:
parent: ovs_bond0
ipam:
config:
- subnet: 192.168.0.0/24
gateway: 192.168.0.1
ip_range: 192.168.0.250/32
Code language: YAML (yaml)
A possible location for the docker-compose.yaml
file can be /volume1/docker/netbootxyz
.
Make sure you enter the correct PUID
and PGID
. More information can be found here.
Don’t forget to create the volume directories on the host before you start the container.
mkdir -p /volume1/docker/netbootxyz/config
mkdir -p /volume1/docker/netbootxyz/assets
Code language: Markdown (markdown)
Because of possible port conflicts, I could not get it to work on the same IP-address as the Synology NAS. That is why I have created the macvlan
network so the server has a different IP-address. This may well not be necessary if hardware other than Synology is used.
If you do use the macvlan
network, change the IP-addresses appropriately.
Also check the network parent. If you are not using a bond like I do, this will probably be ovs_eth0
instead of ovs_bond0
.
$ ifconfig | grep ovs
ovs_bond0 Link encap:Ethernet HWaddr 00:11:32:55:92:F9
$
Code language: Markdown (markdown)
After saving the docker-compose file, you can start the container.
docker compose up -d
Code language: Markdown (markdown)
Detailed information on docker-compose
can be found here.
Synology router
Unfortunately the Synology router cannot be configured from the router management interface. This applies to the RT1900ac but probably also to other models such as the RT2600ac.
Fortunately, because the router also uses dnsmasq
, we can configure this via the command line.
First we have to enable the SSH service. Check out this Synology knowledge base article how this can be enabled.
Log in to the Synology router as root and create the following two files.
/etc/dhcpd/dhcpd-lbr0-pxe.info
enable=yes
Code language: Markdown (markdown)
/etc/dhcpd/dhcpd-lbr0-pxe.conf
interface=lbr0
dhcp-match=set:bios,60,PXEClient:Arch:00000
dhcp-boot=tag:bios,netboot.xyz.kpxe,,192.168.0.250
dhcp-match=set:efi32,60,PXEClient:Arch:00002
dhcp-boot=tag:efi32,netboot.xyz.efi,,192.168.0.250
dhcp-match=set:efi32-1,60,PXEClient:Arch:00006
dhcp-boot=tag:efi32-1,netboot.xyz.efi,,192.168.0.250
dhcp-match=set:efi64,60,PXEClient:Arch:00007
dhcp-boot=tag:efi64,netboot.xyz.efi,,192.168.0.250
dhcp-match=set:efi64-1,60,PXEClient:Arch:00008
dhcp-boot=tag:efi64-1,netboot.xyz.efi,,192.168.0.250
dhcp-match=set:efi64-2,60,PXEClient:Arch:00009
dhcp-boot=tag:efi64-2,netboot.xyz.efi,,192.168.0.250
Code language: Markdown (markdown)
Make sure you change the IP-address to the one that you are using and double check that the dhcp rules are the same as for the DD-WRT section in this document.
Reboot the Synology router.
reboot
Code language: Markdown (markdown)
Time to test it!
Computer
First make sure you have enabled “PXE internal NIC boot” (or “PXE boot” or “network boot”) in the BIOS.
By pressing the Escape key shortly after starting your computer, you will call up the Startup Menu.
The Startup Menu will look similar to the one below. Depending on the hardware you use.
F1 System Information
F2 System Disgnostics
F9 Boot Device Options
F10 BIOS Setup
F12 Network Boot
Restart your computer and choose F12 Network Boot. If you don’t see the F12 option, it probably means you still need to enable it in the BIOS.
After a while the computer will boot from the network and you can select the software you would like to try from the netboot.xyz menu similar to the one below.
Virtual Machine
In Hyper-V create a new Virtual Machine with the following properties.
- Generation 2
- Make sure the Virtual Machine is connected to the network
- Select “Install an Operating System from a network-based installation server” from the Installation Options.
- Disable “Secure Boot” after the Virtual Machine is created
Start the Virtual Machine and after a while you will see the netboot.xyz menu just like you did earlier.