Learn how to set up a DHCP Server with a GUI on a Raspberry Pi. Our Server Management Support team is here to answer queries and concerns.
How to Set Up a DHCP Server with a GUI on a Raspberry Pi
Did you know that a Raspberry Pi can be transformed into a fully functional DHCP server with a graphical interface?
While typically used as a network client that receives its IP address from a router, the Pi can just as easily manage IP assignments for our home, lab, or IoT network.
Today, we will walk through the process of setting up a DHCP server on a Raspberry Pi using the user-friendly Webmin GUI.
An Overview:
Why Use a DHCP Server on a Raspberry Pi?
Setting up our own DHCP server gives us more control over our network. Let’s look at some of the reasons:
- It is perfect for home labs, IoT projects, or educational setups.
- The Pi’s small footprint makes it great for temporary or mobile networks.
- It is budget-friendly and does not require investing in dedicated hardware.
- It lets us manage IP ranges, lease times, DNS, and gateway settings.
If you’re planning to switch your Pi back to DHCP from a static IP setup after testing, check out our guide on how to change from static to DHCP on Raspberry Pi.
Prerequisites
- Raspberry Pi (any model, though Pi 3 or 4 is recommended)
- SD Card with Raspberry Pi OS installed
- Network connection (Ethernet or Wi-Fi)
- ISC DHCP Server- it handles the IP assignment
- Webmin
Step-by-Step Setup Guide
- First, update the Raspberry Pi:
sudo apt update && sudo apt upgrade -y
- Then, install the ISC DHCP server:
sudo apt install isc-dhcp-server -y
- Confirm the installation with this command:
dhcpd –version
- Next, open the DHCP configuration file for editing:
sudo nano /etc/dhcp/dhcpd.conf
- Then, add a basic subnet configuration (adjust according to the network):
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
option domain-name-servers 8.8.8.8, 8.8.4.4;
default-lease-time 600;
max-lease-time 7200;
}
- Now, save and exit.
- At this point, assign the DHCP server to a specific interface (e.g., `eth0`):
sudo nano /etc/default/isc-dhcp-server
Set:
INTERFACESv4="eth0"
- Then, add the Webmin repository:
sudo sh -c 'echo "deb http://download.webmin.com/download/repository sarge contrib" < /etc/apt/sources.list.d/webmin.list'
- Now, add the GPG key:
wget -qO - http://www.webmin.com/jcameron-key.asc | sudo apt-key add -
- Run these commands to install Webmin:
sudo apt update
sudo apt install webmin -y
- We can now access Webmin in a browser:
https://<your_pi_ip>:10000
Log in using the Pi’s username and password.
If you encounter permission issues while accessing web services on the Pi, our guide on fixing the Apache 403 Forbidden error can help troubleshoot common problems.
How to Configure DHCP via Webmin
- In the Webmin dashboard, go to Servers > DHCP Server.
- Click on Add a new subnet.
- Then, enter the same subnet settings we added to the config file.
- Save and apply the changes.
Webmin lets us visually edit lease times, DNS settings, IP ranges, and more without touching the terminal again.
How to Enable and Start the DHCP Server
Enable the DHCP server to start at boot:
sudo systemctl enable isc-dhcp-server
Start the server:
sudo systemctl start isc-dhcp-server
Check the status:
sudo systemctl status isc-dhcp-server
Testing the DHCP Server
- Connect a device to the same network as the Raspberry Pi.
- The device should receive an IP from the defined range (e.g., 192.168.1.100–200).
- Use Webmin to monitor active leases under Servers > DHCP Server.
For more advanced monitoring, you can also use Wireshark on a Raspberry Pi to analyze DHCP traffic and troubleshoot network issues.
Troubleshooting Tips
- If the DHCP Service does not start, check the logs with:
sudo journalctl -u isc-dhcp-server
Also, verify the correct interface is set in `/etc/default/isc-dhcp-server`.
- If you have conflicting DHCP Servers, disable the router’s DHCP server to avoid conflicts.
- If the firewall is blocking DHCP, open the necessary ports:
sudo ufw allow 67/udp
sudo ufw allow 68/udp
Benefits of Using a GUI Like Webmin
- Simplifies configuration and ongoing management.
- Visual interface for editing subnets, ranges, and settings.
- No need to edit config files after initial setup.
For users who manage multiple partitions or storage devices on their Pi while setting up servers, tools like GParted on Raspberry Pi can help simplify disk management during the setup.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
With just a few commands and the help of Webmin, Raspberry Pi can become a reliable, low-cost DHCP server, complete with a user-friendly graphical user interface (GUI).
In brief, our Support Experts demonstrated how to set up a DHCP Server with a GUI on a Raspberry Pi.
0 Comments