How-to: DHCP-Server - Administration of DHCP server entries

How to:

Every server that is supposed to offer the DHCP service requires a DHCP server entry in the LDAP directory.
Normally, the entry does not have to be created manually, but is created by the join script of the univention-dhcp package.

Documantation:
Administration of DHCP server entries

Default configuration

Step 1: Install the package

On the system you want to be the DHCP server, install the dhcp-server package.

univention-install univention-dhcp

Check if all needed packages are installed.
dpkg -l | grep dhcp

ii  isc-dhcp-client                                     4.4.1-2+deb10u3A~5.0.4.202303131602               amd64        DHCP client for automatically obtaining an IP address
ii  isc-dhcp-common                                     4.4.1-2+deb10u3A~5.0.4.202303131602               amd64        common manpages relevant to all of the isc-dhcp packages
ii  isc-dhcp-server                                     4.4.1-2+deb10u3A~5.0.4.202303131602               amd64        ISC DHCP server for automatic IP address assignment
ii  isc-dhcp-server-ldap                                4.4.1-2+deb10u3A~5.0.4.202303131602               amd64        DHCP server that uses LDAP as its backend
ii  univention-dhcp                                     14.0.7-1A~5.0.0.202302032008                      all          UCS - DHCP server

Step 2: Run the join-script

Execute the following join-script to automatically create the DHCP service and DHCP server.

univention-run-join-scripts --run-scripts --force 25univention-dhcp.inst


Custom configuration

Step 1: Install the package

On the system you want to be the DHCP server, install the dhcp-server package.

univention-install univention-dhcp

Check if all needed packages are installed.
dpkg -l | grep dhcp

ii  isc-dhcp-client                                     4.4.1-2+deb10u3A~5.0.4.202303131602               amd64        DHCP client for automatically obtaining an IP address
ii  isc-dhcp-common                                     4.4.1-2+deb10u3A~5.0.4.202303131602               amd64        common manpages relevant to all of the isc-dhcp packages
ii  isc-dhcp-server                                     4.4.1-2+deb10u3A~5.0.4.202303131602               amd64        ISC DHCP server for automatic IP address assignment
ii  isc-dhcp-server-ldap                                4.4.1-2+deb10u3A~5.0.4.202303131602               amd64        DHCP server that uses LDAP as its backend
ii  univention-dhcp                                     14.0.7-1A~5.0.0.202302032008                      all          UCS - DHCP server

Step 2: Create the DHCP service

Hint

Do not use spaces for the DHCP service name, otherwise parsing errors will occur. Please only use hyphens- or underscores_ to separate names.

Create the DHCP service
Erstellen_dhcp_dienst_1

Name the DHCP service
Erstellen_dhcp_dienst_2

Step 3: Create the DHCP server

For the DHCP service you have to create the DHCP server.
Erstellen_dhcp_server_1

You have to use the Host name as the DHCP server name.
Erstellen_dhcp_server_2

Step 4: Create a Subnet for DHCP

You have to create a Subnet, so that it can be used for DHCP.
Erstellen_dhcp_subnet_1

Define the Subnet with your network settings.
Erstellen_dhcp_subnet_2

Finished configuration in the UMC.
Erstellen_dhcp_subnet_3

Hint

If no subnet is defined, the DHCP service will not start correctly and you could get the following error message.

systemctl status isc-dhcp-server.service

● isc-dhcp-server.service - ISC DHCP Server for IPv4
   Loaded: loaded (/etc/init.d/isc-dhcp-server; generated)
  Drop-In: /usr/lib/systemd/system/isc-dhcp-server.service.d
           └─univention-dhcp.conf
   Active: activating (auto-restart) (Result: exit-code) since Mon 2024-04-15 11:06:28 CEST; 3s ago
     Docs: man:systemd-sysv-generator(8)
           man:dhcpd(8)
  Process: 9739 ExecStartPre=/bin/touch /var/lib/dhcp/dhcpd.leases (code=exited, status=0/SUCCESS)
  Process: 9740 ExecStartPre=/usr/sbin/dhcpd -t -4 -q -cf /etc/dhcp/dhcpd.conf (code=exited, status=0/SUCCESS)
  Process: 9741 ExecStart=/usr/sbin/dhcpd -f -4 -q -cf /etc/dhcp/dhcpd.conf $INTERFACESv4 (code=exited, status=1/FAILURE)
 Main PID: 9741 (code=exited, status=1/FAILURE)

Apr 15 11:06:28 ucs5replica systemd[1]: isc-dhcp-server.service: Main process exited, code=exited, status=1/FAILURE
Apr 15 11:06:28 ucs5replica systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.

/var/log/daemon.log

Apr 15 10:10:05 ucs5replica dhcpd[6079]: No subnet declaration for eth0 (10.200.30.102).
Apr 15 10:10:05 ucs5replica dhcpd[6079]: ** Ignoring requests on eth0.  If this is not what
Apr 15 10:10:05 ucs5replica dhcpd[6079]:    you want, please write a subnet declaration
Apr 15 10:10:05 ucs5replica dhcpd[6079]:    in your dhcpd.conf file for the network segment
Apr 15 10:10:05 ucs5replica dhcpd[6079]:    to which interface eth0 is attached. **
Apr 15 10:10:05 ucs5replica dhcpd[6079]: 
Apr 15 10:10:05 ucs5replica dhcpd[6079]: 
Apr 15 10:10:05 ucs5replica dhcpd[6079]: Not configured to listen on any interfaces!
Apr 15 10:10:05 ucs5replica dhcpd[6079]: 
Apr 15 10:10:05 ucs5replica dhcpd[6079]: If you think you have received this message due to a bug rather
Apr 15 10:10:05 ucs5replica dhcpd[6079]: than a configuration issue please read the section on submitting
Apr 15 10:10:05 ucs5replica dhcpd[6079]: bugs on either our web page at www.isc.org or in the README file
Apr 15 10:10:05 ucs5replica dhcpd[6079]: before submitting a bug.  These pages explain the proper
Apr 15 10:10:05 ucs5replica dhcpd[6079]: process and the information we find helpful for debugging.
Apr 15 10:10:05 ucs5replica dhcpd[6079]: 
Apr 15 10:10:05 ucs5replica dhcpd[6079]: exiting.
Apr 15 10:10:05 ucs5replica systemd[1]: isc-dhcp-server.service: Main process exited, code=exited, status=1/FAILURE
Apr 15 10:10:05 ucs5replica systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.

Step 5: Run the join-script

Execute the univention-dhcp installation script on the System, you want to use as DHCP server and use your Administrator credentials.

univention-run-join-scripts --run-scripts --force 25univention-dhcp.inst

univention-run-join-scripts: runs all join scripts existing on local computer.
copyright (c) 2001-2023 Univention GmbH, Germany

Enter Primary Directory Node Account : Administrator
Enter Primary Directory Node Password: 

Search LDAP binddn:                                        done
Running pre-joinscripts hook(s):                           done
Running 25univention-dhcp.inst                             done
Running post-joinscripts hook(s):                          done

Step 6: Restart the service

Restart the service for DHCP and check that all is working correctly.

  1. systemctl restart isc-dhcp-server.service
  2. systemctl status isc-dhcp-server.service
● isc-dhcp-server.service - ISC DHCP Server for IPv4
   Loaded: loaded (/etc/init.d/isc-dhcp-server; generated)
  Drop-In: /usr/lib/systemd/system/isc-dhcp-server.service.d
           └─univention-dhcp.conf
   Active: active (running) since Mon 2024-04-15 13:06:59 CEST; 15min ago
     Docs: man:systemd-sysv-generator(8)
           man:dhcpd(8)
  Process: 16140 ExecStartPre=/bin/touch /var/lib/dhcp/dhcpd.leases (code=exited, status=0/SUCCESS)
  Process: 16141 ExecStartPre=/usr/sbin/dhcpd -t -4 -q -cf /etc/dhcp/dhcpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 16142 (dhcpd)
    Tasks: 1 (limit: 2345)
   Memory: 7.0M
   CGroup: /system.slice/isc-dhcp-server.service
           └─16142 /usr/sbin/dhcpd -f -4 -q -cf /etc/dhcp/dhcpd.conf

Apr 15 13:22:32 ucs5replica dhcpd[16142]: DHCPDISCOVER from 52:54:00:41:56:e9 via eth0
Apr 15 13:22:32 ucs5replica dhcpd[16142]: DHCPOFFER on 10.200.30.22 to 52:54:00:41:56:e9 via eth0
Apr 15 13:22:38 ucs5replica dhcpd[16142]: DHCPDISCOVER from 52:54:00:ad:9f:ca via eth0
Apr 15 13:22:38 ucs5replica dhcpd[16142]: DHCPOFFER on 10.200.30.20 to 52:54:00:ad:9f:ca via eth0
Apr 15 13:22:38 ucs5replica dhcpd[16142]: DHCPDISCOVER from 52:54:00:41:56:e9 via eth0
Apr 15 13:22:38 ucs5replica dhcpd[16142]: DHCPOFFER on 10.200.30.22 to 52:54:00:41:56:e9 via eth0
Apr 15 13:22:48 ucs5replica dhcpd[16142]: DHCPDISCOVER from 52:54:00:8d:f6:b5 via eth0
Apr 15 13:22:48 ucs5replica dhcpd[16142]: DHCPOFFER on 10.200.30.28 to 52:54:00:8d:f6:b5 via eth0
Apr 15 13:22:51 ucs5replica dhcpd[16142]: DHCPDISCOVER from 52:54:00:8d:f6:b5 via eth0
Apr 15 13:22:51 ucs5replica dhcpd[16142]: DHCPOFFER on 10.200.30.28 to 52:54:00:8d:f6:b5 via eth0
Mastodon