Installation and Configuration
1. Install required Packages
sudo apt update -yy
sudo apt upgrade -yy
sudo apt install dhcpd isc-dhcp-server netplan.io
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;
# DHCP Options
option routers 172.16.128.254; # Router / Default Gateway
option domain-name-servers 172.16.128.254; # Nameservers / DNS Servers
}
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"
2.3 Configure Netplan
Netplan is used to configure the local Interfaces on the Device which hosts the DHCP/iPXE Server
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
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
Update Permissions for /etc/netplan/network.yaml
/etc/netplan/network.yamlsudo chmod 600 /etc/netplan/network.yaml
Apply Configuration
sudo netplan apply