Bobcares

How to Set Up a DHCP Server with a GUI on a Raspberry Pi

PDF Header PDF Footer

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

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.

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

  1. First, update the Raspberry Pi:
    sudo apt update && sudo apt upgrade -yCopy Code
  2. Then, install the ISC DHCP server:
    sudo apt install isc-dhcp-server -yCopy Code
  3. Confirm the installation with this command:
    dhcpd –versionCopy Code
  4. Next, open the DHCP configuration file for editing:
    sudo nano /etc/dhcp/dhcpd.confCopy Code
  5. 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;
    }
    Copy Code
  6. Now, save and exit.
  7. At this point, assign the DHCP server to a specific interface (e.g., `eth0`):
    sudo nano /etc/default/isc-dhcp-serverCopy Code

    Set:

    INTERFACESv4="eth0"Copy Code
  8. 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'
    Copy Code
  9. Now, add the GPG key:
    wget -qO - http://www.webmin.com/jcameron-key.asc | sudo apt-key add -Copy Code
  10. Run these commands to install Webmin:
    
    sudo apt update
    sudo apt install webmin -y
    Copy Code
  11. We can now access Webmin in a browser:
    https://<your_pi_ip>:10000Copy Code

    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

  1. In the Webmin dashboard, go to Servers > DHCP Server.
  2. Click on Add a new subnet.
  3. Then, enter the same subnet settings we added to the config file.
  4. 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-serverCopy Code

Start the server:

sudo systemctl start isc-dhcp-serverCopy Code

Check the status:

sudo systemctl status isc-dhcp-serverCopy Code

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-serverCopy Code

    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/udpCopy Code

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

Submit a Comment

Your email address will not be published. Required fields are marked *

Get featured on the Bobcares blog and share your expertise with a global tech audience.

WRITE FOR US
server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!