[Unit] Description=ISC DHCP IPv4 server Documentation=man:dhcpd(8) Wants=network-online.target After=network-online.target After=time-sync.target ConditionPathExists=/etc/default/isc-dhcp-server ConditionPathExists=|/etc/ltsp/dhcpd.conf ConditionPathExists=|/etc/dhcp/dhcpd.conf [Service] EnvironmentFile=/etc/default/isc-dhcp-server RuntimeDirectory=dhcp-server # Allow dhcp server to write lease and pid file as 'dhcpd' user ExecStartPre=/bin/sh -ec '\ DHCPD_PID_DIR=`/usr/bin/dirname $DHCPD_PID`; \ /bin/chown dhcpd:dhcpd $DHCPD_PID_DIR' # The leases files need to be root:root even when dropping privileges ExecStart=/bin/sh -ec '\ CONFIG_FILE=/etc/dhcp/dhcpd.conf; \ if [ -f /etc/ltsp/dhcpd.conf ]; then CONFIG_FILE=/etc/ltsp/dhcpd.conf; fi; \ [ -e /var/lib/dhcp/dhcpd.leases ] || touch /var/lib/dhcp/dhcpd.leases; \ chown root:root /var/lib/dhcp /var/lib/dhcp/dhcpd.leases*; \ exec dhcpd -user dhcpd -group dhcpd -f -4 -pf $DHCPD_PID -cf $CONFIG_FILE $INTERFACES' [Install] WantedBy=multi-user.target