Network boot server for substruct
Install SYSLINUX and PXELINUX:
sudo apt-get install syslinux pxelinux
Create a directory to store iPXE files and download them from the web:
mkdir ~/ipxe
curl http://boot.ipxe.org/undionly.kpxe --output ~/ipxe/undionly.kpxe
curl http://boot.ipxe.org/ipxe.efi --output ~/ipxe/ipxe.efi
Or build iPXE from source for any additional features (such as graphical backgrounds):
Install the TFTP server:
sudo apt-get install tftpd-hpa
Configure TFTPD via /etc/default/tftpd-hpa
:
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="--secure"
Make a /tftpboot
directory with full permissions:
sudo mkdir /tftpboot
sudo chmod 777 /tftpboot
Copy SYSLINUX, PXELINUX, and iPXE files into it:
sudo cp /usr/lib/syslinux/modules/bios/ldlinux.c32 /tftpboot
sudo cp /usr/lib/syslinux/modules/efi64/ldlinux.e64 /tftpboot
sudo cp /usr/lib/syslinux/modules/efi64/libutil.c32 /tftpboot
sudo cp /usr/lib/syslinux/modules/efi64/menu.c32 /tftpboot
sudo cp /usr/lib/SYSLINUX.EFI/efi64/syslinux.efi /tftpboot
sudo cp /usr/lib/PXELINUX/pxelinux.0 /tftpboot
sudo cp /usr/lib/PXELINUX/lpxelinux.0 /tftpboot
cp ~/ipxe/ipxe.efi /tftpboot
cp ~/ipxe/undionly.kpxe /tftpboot
Make the /tftpboot/pxelinux.cfg
directory to store boot menus:
sudo mkdir /tftpboot/pxelinux.cfg
sudo touch /tftpboot/pxelinux.cfg/default
Start and enable TFTPD:
sudo systemctl enable tftpd-hpa
sudo systemctl restart tftpd-hpa
Install the DHCP server:
sudo apt-get install isc-dhcp-server
Edit the /etc/dhcp/dhcpd.conf
file to include PXE booting options:
NOTE: Replace the IP address 192.168.1.3
with your server's IP address
# PXE BOOTING
option client-arch code 93 = unsigned integer 16;
# if iPXE is loaded, access main bootstrap iPXE script
if exists user-class and option user-class = "iPXE" {
filename "http://192.168.1.3/tftpboot/ipxe/scripts/bootstrap.ipxe";
} else {
if exists client-arch {
if option client-arch = 00:00 { # prevent bootloop on chain loading
filename "ipxe/undionly.kpxe";
} elsif option client-arch = 00:06 { # i386
filename "ipxe/bin-i386-efi/ipxe.efi";
} elsif option client-arch = 00:07 { # x86_64
filename "ipxe/bin-x86_64-efi/ipxe.efi";
} elsif option client-arch = 00:09 { # x86_64
filename "ipxe/bin-x86_64-efi/ipxe.efi";
} elsif option client-arch = 00:0a { # arm32
filename "ipxe/bin-arm32-efi/ipxe.efi";
} elsif option client-arch = 00:0b { # arm64 / aarch64
filename "ipxe/bin-arm64-efi/ipxe.efi"; #<-- custom compiled iPXE arm64
#filename "ipxe/netboot.xyz-rpi4-snp.efi"; #<-- works to load netboot with working iPXE
#filename "efi/boot/bootaa64.efi"; #<-- also works, same issues as above
#filename "ipxe/tests/arm64/ipxe.efi"; #<-- custom compiled arm64 iPXE
#filename "ipxe/arm64-efi/ipxe.efi"; #<-- boots but fails after iPXE init devices
}
}
}
next-server 192.168.1.3;
Start and enable the DHCP server:
sudo systemctl enable isc-dhcp-server
sudo systemctl restart isc-dhcp-server
Install the web server:
sudo apt-get install nginx
Delete the default website:
sudo rm /etc/nginx/sites-available/default
Create a new website file:
sudo vim /etc/nginx/sites-available/substruct
Place this content inside of the file to define an HTTP server:
# HTTP - PORT 80
server {
listen 80;
listen [::]:80;
server_name substruct;
server_tokens off;
root /var/www/substruct;
index index.html;
# redirect to HTTPS
#return 301 https://$server_name$request_uri;
location / {
autoindex on;
try_files $uri $uri/ =404;
}
access_log /var/log/nginx/substruct.log;
error_log /var/log/nginx/substruct.error.log;
}
Create the root web directory:
sudo mkdir -p /var/www/substruct
Start and enable the HTTP server:
sudo systemctl enable nginx
sudo systemctl restart nginx
sudo mkdir /mnt/rhel8-install/
sudo mount -o loop,ro -t iso9660 ~/Downloads/rhel8/rhel-8.4-x86_64-dvd.iso /mnt/rhel8-install/
The Raspberry Pi 4 uses eeprom to network boot.
To enable network booting:
- Copy the official Raspberry Pi OS (formerly "Raspbian") to an SD card.
- Boot the RPi4 and open a terminal.
- Update all packages:
sudo apt-get update && sudo apt-get dist-upgrade -y
. - Install the eeprom updater:
sudo apt-get install rpi-eeprom
. - Update eeprom:
sudo rpi-eeprom-update
. - Reboot:
sudo sync && sudo reboot
. - Set
BOOT_ORDER=0xf421
andTFTP_PREFIX=2
with:sudo -E rpi-eeprom-config --edit
.
NOTE: The TFTP_PREFIX=2
option makes it so that the /tftpboot
directory uses RPi MAC address values instead of serial numbers.
See the official documentation located here for further details:
To network boot an entire Raspberry Pi OS, see the official tutorial here: