Installation and initial Configuration
1. Install required Packages
sudo apt update -yy
sudo apt upgrade -yy
sudo apt install dhcpd isc-dhcp-server netplan.io tftpd-hpa
2. Configure DHCP Server
2.1 Configure DHCPd
Edit Configuration File /etc/dhcp/dhcpd.conf
# DNS Search Domain and Nameservers
# When e. g. a DHCP Client gets a IP, a example Search Domain would be <DeviceName>.searchdomain
option domain-name "pxe.example.local";
option domain-name-servers 172.16.1.254;
# Lease Times (how long the DHCP Client will hold the assigned IP Address)
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
# Subnet Ranges Configuration
# With Netmask 255.255.255.0 (/24), the Subnet is 172.16.128.0 - 172.16.128.255
subnet 172.16.128.0 netmask 255.255.255.0 {
# DHCP Client Range
range 172.16.128.100 172.16.128.199;
}
2.2 Configure isc-dhcp-server
Edit Configuration File /etc/default/isc-dhcp-server
# Path to Configuration File from Step 2.1
DHCPD4_CONF=/etc/dhcp/dhcpd.conf
# Space-delimited List of Interfaces where the DHCP Server should listen on
# Example for multible Interfaces: "eth0 eth1 wifi1"
INTERFACESv4="eth0"
3. Configure Netplan
Netplan is used to configure the local Interfaces on the Device which hosts the DHCP/iPXE Server
3.1 Disable Conflicting Services
The Default Network Configuration Services might interfere with Netplan
sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager
sudo systemctl stop dhcpcd
sudo systemctl disable dhcpcd
3.2 Enable networkd
sudo systemctl enable systemd-networkd
sudo systemctl start systemd-networkd
3.3 Edit Configuration File /etc/netplan/network.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- 172.16.128.254/24
nameservers:
addresses:
- 172.16.128.254
ignore-carrier: true
wifis:
wlan0:
dhcp4: true
access-points:
"your-wifi":
password: "your-wifi-password"
With this File, the Interface eth0 gets a static IP 172.16.128.254 and the Wifi interface wlan0 is set to dhcp with the specified Wifi your-wifi and Password your-wifi-password
3.4 Update Permissions for /etc/netplan/network.yaml
sudo chmod 600 /etc/netplan/network.yaml
3.5 Apply Configuration
sudo netplan generate
sudo netplan apply
3.6 Restart isc-dhcp-server
After configuring netplan, we need to restart isc-dhcp-server
sudo systemctl restart isc-dhcp-server
sudo systemctl status isc-dhcp-server
4. Configure TFTP Server
The TFTP Server will hold/provide the actual Boot Files
4.1 Ensure default Configuration File
Ensure the Default Configuration File looks like this
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="--secure --create"
4.2 Restart TFTP Server
sudo systemctl restart tftpd-hpa