Skip to content
This repository has been archived by the owner on Aug 24, 2020. It is now read-only.

Setting up network boot on a Linux Server

Michael Altobelli edited this page Jan 22, 2019 · 2 revisions

Install the base server OS

See any number of guides for this. I will be using Ubuntu 18.04.1 Server for the base below

Setup DNSMasq to server TFTP and DHCP-Proxy, install NGinx to serve the HTTP files

  1. Install and enable DNSMasq
sudo apt install dnsmasq nginx
sudo systemctl enable dnsmasq
sudo systemctl enable nginx
  1. Create a custom config for DNSMasq, remember to change both of the included IP's to the one your server has

sudo nano /etc/dnsmasq.d-available/ipxe

#Disable DNS
port=0

#Set the below to your IP range
dhcp-range=192.168.43.0,proxy,255.255.255.0

#Filter out iPXE
dhcp-match=ipxe,175
#Change the below IP to your servers IP
pxe-service=tag:ipxe,X86PC,'Wipe',http://192.168.43.209/wipe.ipxe
pxe-service=tag:!ipxe,x86PC,"Load iPXE",undionly.kpxe
log-queries

#Setup TFTP server
enable-tftp
tftp-root=/var/ftpd/

  1. Enable the config

ln -s /etc/dnsmasq.d-available/ipxe /etc/dnsmasq.d/ipxe

  1. Start dnsmasq and create it's ftp directory
sudo mkdir -p /var/ftpd
sudo systemctl restart dnsmasq
  1. Download the iPXE Binary into the tftp root
sudo wget http://boot.ipxe.org/undionly.kpxe -O /var/ftpd/undionly.kpxe
  1. Download the DiskSlaw.iso (0.3 or higher)
wget https://github.com/maltob/DiskSlaw/releases/download/v0.3-alpha/diskslaw_0.3.iso -O diskslaw.iso
  1. Mount the iso so we can copy the files off it
sudo mkdir /mnt/diskslaw
sudo mount -o loop diskslaw.iso /mnt/diskslaw
  1. Copy the kernel, initrd and filesystem.squashfs into the nginx server directory
sudo cp /mnt/diskslaw/casper/{filesystem.squashfs,vmlinuz,initrd.lz} /var/www/html/
  1. Unmount the ISO
umount /mnt/diskslaw
umount /mnt/debian
  1. Create the iPXE file, again remember to replace the HTTP portion with your IP nano /var/www/html/wipe.ipxe
#!ipxe
kernel http://192.168.43.209/vmlinuz
initrd http://192.168.43.209/initrd.lz
imgargs vmlinuz boot=live dhcp fetch=http://192.168.43.209/casper/filesystem.squashfs nouveau.modeset=0 nomodeset --
boot
  1. Start nginx
sudo systemctl start nginx
  1. Test your image works by booting a machine to network