isc-dhcp-server status failed: Failed with result 'exit code'
Asked Answered
P

3

6

I setup a simple dhcp-server with isc-dhcp-server, but when I start the service, the status is in failed with the message "failed with result 'exit code' ".

enter image description here

And yes, I did configure the files /etc/dhcp/dhcp.conf and /etc/default/dhcpd.conf

enter image description here enter image description here enter image description here

I checked more information with the command journalctl -ex the show the next input. But I dont know what the input said, because I configured the interface and dhcp server.

enter image description here

I dont know what doing to solve this issue. Somebody know what doing in this case.

Parts answered 10/6, 2021 at 20:36 Comment(0)
R
9

This gave me the solution:

$ sudo su
$ systemctl restart isc-dhcp-server.service
$ systemctl status isc-dhcp-server.service

It it still fails like here

root@wd-Latitude-E6530:/home/wd# systemctl status isc-dhcp-server.service
● isc-dhcp-server.service - ISC DHCP IPv4 server
     Loaded: loaded (/lib/systemd/system/isc-dhcp-server.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2021-06-17 11:29:47 CEST; 56s ago
       Docs: man:dhcpd(8)
    Process: 2167 ExecStart=/bin/sh -ec      CONFIG_FILE=/etc/dhcp/dhcpd.conf;      if [ -f /etc/ltsp/dhcpd.conf ]; then CONFIG_FILE=/etc/ltsp/dhcpd.conf; fi;      [ ->
   Main PID: 2167 (code=exited, status=1/FAILURE)

jun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: 
jun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: If you think you have received this message due to a bug rather
jun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: than a configuration issue please read the section on submitting
jun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: bugs on either our web page at www.isc.org or in the README file
jun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: before submitting a bug.  These pages explain the proper
jun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: process and the information we find helpful for debugging.
jun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: 
jun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: exiting.
jun 17 11:29:47 wd-Latitude-E6530 systemd[1]: isc-dhcp-server.service: Main process exited, code=exited, status=1/FAILURE
jun 17 11:29:47 wd-Latitude-E6530 systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.

Check the process ID; like 2167 and command:

$ journalctl _PID=2167 {your PID should be different}

For me it gave back:

jun 17 11:30:52 wd-Latitude-E6530 sh[2193]: /etc/dhcp/dhcpd.conf line 57: subnet 10.10.10.1 netmask 255.255.255.0: bad subnet number/mask combination.
jun 17 11:30:52 wd-Latitude-E6530 sh[2193]: subnet 10.10.10.1 netmask 255.255.255.0

In /etc/dhcp/dhcpd.conf I needed to change

subnet 10.10.10.1 netmask 255.255.255.0

into

subnet 10.10.10.0 netmask 255.255.255.0

So 10.10.10.1 into 10.10.10.0

$ systemctl restart isc-dhcp-server.service
$ systemctl status isc-dhcp-server.service

And now I get it working:

Active: active (running) since Thu 2021-06-17 11:50:51 CEST; 2s ago

Your issue might be different, but journalctl _PID=#### will give you some feedback and from there you can troubleshoot.

It looks like you're missing a subnet. I am using this

[...]
subnet 10.10.10.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 10.10.10.255;
option routers 10.10.10.1;
option domain-name-servers 10.10.10.1;
range 10.10.10.3 10.10.10.250;
if exists user-class and option user-class = "iPXE" {
      filename "boot.ipxe";
  } else {
      filename "undionly.kpxe";

This is part of my iPXE server.

Retrorse answered 17/6, 2021 at 9:56 Comment(1)
Thanks, I failed to get more insight with journalctl -fa -u iscp-dhcp-server, yet _PID=12345 did the trick and error was range declaration not allowed here in my case.Whitefaced
O
1

I was following some tech blog for setting up isc-dhcp-server, and I just ended up using the same configuration file (with the same ips, ranges etc).

After 2 days long googling changing machines, and everything, I got nothing, and I figured out that I need to configure the dhcpd.conf file based on my own network interface's (i.e. 'eth0' in my case) ip. And it worked!

Obstructionist answered 5/9, 2022 at 8:4 Comment(0)
O
0

I am in the exactly same problem. As you showed the result of command journalctl -ex, you can see the error message No subnet declaration for.... Then I tried configure the net interface with ifconfig as followssudo ifconfig enp0s3 192.168.1.1 netmask 255.255.255.0. Then restart the dhcp server, finally it works.

Osteo answered 28/12, 2023 at 4:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.