DHCP Server on Raspberry Pi

Since V2.9.3.1 DHCP Server is also available for Raspberry Pi OS. It haas been tested with

  • Raspberry Pi 3 Model B Plus Rev 1.3
  • Raspberry Pi 3 Model B Rev 1.2
  • Raspberry Pi Zero W Rev 1.1
  • Raspberry Pi 4 Model B Rev 1.1 (4 GB)

You will find in your download area the deb package for installing on your Raspberry. The package file is called i.e. dhcpsrv-armhf-V2.9.3.1.deb.

How to install

After downloading the deb file onto your Raspberry please execute the following command:

sudo dpkg -i dhcpsrv-armhf-V2.9.3.1.deb

This will install the DHCP server in the following directories:

  • /
    • lib
      • systemd
        • system
          • dhcpsrv.service
    • usr
      • local
        • bin
          • dhcpsrv
        • etc
          • dhcpsrv
            • dhcpsrv.ini
            • licence
            • wwwroot
              • Banner_3_1260_140.jpg
              • dhcppkgstyle.xsl
              • dhcpstyle.xsl
              • favicon.ico
              • index.html
              • pxelinux.0
              • RJ45_52.JPG
              • RJ45_5.JPG
              • tabstyle.css

In order to automatically start the DHCP server at boot you need to enter the following commands:

sudo systemctl --system daemon-reload
sudo systemctl enable dhcpsrv.service

How to run

It is necessary to configure the INI file with your network specific settings. The INI file that is already installed in /usr/local/etc/dhcpsrv/dhcpsrv.ini has the following content and requires adaptation in the bold parts:

PORT_80=80                                   ; change to avoid conflicts with existing http server
;IPBIND_0=                                   ; IP address for the DHCP server to use
;IPPOOL_0=                                   ; IP Pool to serve





I’m suggesting to change the http port and enter the IPPOOL and IPBIND parameters. After that you are ready to start the DHCP Server either by rebooting or with the following command:

sudo systemctl start dhcpsrv.service

How to stop

You can stop the DHCP Server with the following command:

sudo systemctl stop dhcpsrv.service

How to uninstall

You can uninstall DHCP Server with one single command. This will automatically also stop and disable the service.

sudo dpkg -r dhcpsrv