Skip to content

Instantly share code, notes, and snippets.

@wapiflapi
Created October 31, 2018 20:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wapiflapi/942acab07874ca83bbf03941a7f92818 to your computer and use it in GitHub Desktop.
Save wapiflapi/942acab07874ca83bbf03941a7f92818 to your computer and use it in GitHub Desktop.
Quick and dirty PXE boot server.
#!/bin/bash
mkdir -p /tmp/tftp
wget https://boot.netboot.xyz/ipxe/netboot.xyz.efi -O /tmp/tftp/netboot.xyz.efi
# /!\ Make sure the router is OK.
ROUTER=$(ip r | grep default | cut -d ' ' -f3)
# Make sure interface is the right one,
# and dhcp-range should be a subset of the real range.
cat > /tmp/dnsmasq.conf <<EOF
interface=enp0s31f6
bind-interfaces
dhcp-option=option:router,$ROUTER
dhcp-range=192.168.1.120,192.168.1.140
dhcp-boot=netboot.xyz.efi
enable-tftp
tftp-root=/tmp/tftp/
EOF
dnsmasq --conf-file=/tmp/dnsmasq.conf --no-daemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment