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 -y
  2. Then, install the ISC DHCP server:

    sudo apt install isc-dhcp-server -y
  3. Confirm the installation with this command:

    dhcpd –version
  4. Next, open the DHCP configuration file for editing:

    sudo nano /etc/dhcp/dhcpd.conf
  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;
    }
  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-server

    Set:

    INTERFACESv4="eth0"
  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'
  9. Now, add the GPG key:

    wget -qO - http://www.webmin.com/jcameron-key.asc | sudo apt-key add -
  10. Run these commands to install Webmin:


    sudo apt update
    sudo apt install webmin -y
  11. 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

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

Submit a Comment

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

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!

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF