Created
July 15, 2020 23:05
-
-
Save parthpower/bca5a423bf197508692964acec624243 to your computer and use it in GitHub Desktop.
PXE Boot Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -x | |
# Just for note. shell scripts are easier than README.md | |
apt install dnsmasq | |
# don't need to run it forever | |
systemctl disable dnsmasq.service | |
# most systems has systemd running on port 53 which can be an issue. | |
# maybe disable dns server on dnsmasq? | |
systemctl stop systemd-resolved | |
# setup tftp root | |
mkdir -p /var/lib/tftpboot | |
# get netboot files, maybe get latest from http://cdimage.ubuntu.com/netboot/ | |
curl -Lfs http://archive.ubuntu.com/ubuntu/dists/eoan/main/installer-amd64/current/images/netboot/netboot.tar.gz | tar -xzvC /var/lib/tftpboot | |
# configure dnsmasq | |
cat > dnsmasq.conf <<EOF | |
interface=enp7s1,lo | |
#bind-interfaces | |
domain=my.lan | |
# DHCP range-leases | |
dhcp-range= enp7s1,192.168.0.1,192.168.0.253,255.255.255.0,1h | |
# PXE | |
dhcp-boot=pxelinux.0,pxeserver,192.168.0.20 | |
# Gateway | |
dhcp-option=3,192.168.0.1 | |
# DNS | |
dhcp-option=6,1.1.1.1, 8.8.8.8 | |
server=1.1.1.1 | |
# Broadcast Address | |
# dhcp-option=28,10.0.0.255 | |
# NTP Server | |
#dhcp-option=42,0.0.0.0 | |
pxe-prompt="Press F8 for menu.", 60 | |
pxe-service=x86PC, "PXE boot from network server 192.168.0.20", pxelinux | |
enable-tftp | |
tftp-root=/var/lib/tftpboot | |
log-dhcp | |
log-queries | |
log-facility=/tmp/dnsmasq.log | |
EOF | |
dnsmasq -C dnsmasq.conf | |
tail -f /tmp/dnsmasq.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment