This guide will show you how to setup a PXE boot server to provision a cluster of machines. For the sake of this guide, we will be using system agnostic docker containers to simulate the DHCP and the PXE boot server.
Featured technologies:
Generally speaking, PXE boot is a way to boot a machine over the network. This is useful when you have a large number of machines to provision and you don't want to manually install the OS on each machine. The PXE boot server will provide the necessary files to boot the machine and install the OS.
Steps:
- The machine boots up and sends a DHCP request.
- The DHCP server responds with the
IP address
of the PXE boot server andnext_file
- the file to boot from. - The machine downloads the necessary files from the PXE boot server.
- The machine boots from the downloaded files and installs the OS.
- The machine reboots and boots from the local disk.
- The machine is provisioned.
Netbootxyz will provide the necessary files to boot the machine and the DHCP server will provide the IP address of the PXE boot server and the next_file
to boot from.
Use the first part of the docker-compose file to setup the PXE boot server:
version: '3.7'
services:
netbootxyz:
image: lscr.io/linuxserver/netbootxyz:latest
container_name: netbootxyz
network_mode: "host"
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Warsaw
- MENU_VERSION=2.0.78
- PORT_RANGE=30000:30010
- SUBFOLDER=/
volumes:
- ./config:/config
- ./assets:/assets
ports:
- 3000:3000
- 69:69/udp
- 8080:80
restart: unless-stopped
Use the second part of the docker-compose file to setup the DHCP server:
version: '3.7'
services:
dhcp-server:
image: networkboot/dhcpd
container_name: dhcp-server
network_mode: "host"
restart: always
volumes:
- ./data/:/data/
ports:
- "67:67/udp"
- "67:67/tcp"
privileged: true
cap_add:
- NET_ADMIN
Remember to create the necessary /data/dhcpd.conf
file with the following content:
subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.100 192.168.100.200;
option routers 192.168.100.1;
option domain-name-servers 192.168.100.1;
next-server 192.168.100.184;
filename "netboot.xyz-undionly.kpxe";
}
Where:
subnet
- the subnet of the network. Make sure it matches your network configuration.range
- the range of IP addresses to assign to the machines.option routers
- the IP address of the router.option domain-name-servers
- the IP address of the DNS server.next-server
- the IP address of the PXE boot server.filename
- the file to boot from. This file is provided by the PXE boot server.