isc-dhcp-服务器状态失败:失败,结果为“退出代码”

art*_*aag 5 dhcp ubuntu-server

我使用 isc-dhcp-server 设置了一个简单的 dhcp-server,但是当我启动该服务时,状态为失败,并显示消息“失败,结果为‘退出代码’”。

在此输入图像描述

是的,我确实配置了文件 /etc/dhcp/dhcp.conf 和 /etc/default/dhcpd.conf

在此输入图像描述 在此输入图像描述 在此输入图像描述

journalctl -ex我使用显示下一个输入的命令检查了更多信息。但我不知道输入的内容是什么,因为我配置了接口和 dhcp 服务器。

在此输入图像描述

我不知道要做什么来解决这个问题。有人知道在这种情况下做什么。

小智 8

这给了我解决方案:

\n
$ sudo su\n$ systemctl restart isc-dhcp-server.service\n$ systemctl status isc-dhcp-server.service\n
Run Code Online (Sandbox Code Playgroud)\n

它仍然像这里一样失败

\n
root@wd-Latitude-E6530:/home/wd# systemctl status isc-dhcp-server.service\n\xe2\x97\x8f isc-dhcp-server.service - ISC DHCP IPv4 server\n     Loaded: loaded (/lib/systemd/system/isc-dhcp-server.service; enabled; vendor preset: enabled)\n     Active: failed (Result: exit-code) since Thu 2021-06-17 11:29:47 CEST; 56s ago\n       Docs: man:dhcpd(8)\n    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;      [ ->\n   Main PID: 2167 (code=exited, status=1/FAILURE)\n\njun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: \njun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: If you think you have received this message due to a bug rather\njun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: than a configuration issue please read the section on submitting\njun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: bugs on either our web page at www.isc.org or in the README file\njun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: before submitting a bug.  These pages explain the proper\njun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: process and the information we find helpful for debugging.\njun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: \njun 17 11:29:47 wd-Latitude-E6530 dhcpd[2167]: exiting.\njun 17 11:29:47 wd-Latitude-E6530 systemd[1]: isc-dhcp-server.service: Main process exited, code=exited, status=1/FAILURE\njun 17 11:29:47 wd-Latitude-E6530 systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.\n
Run Code Online (Sandbox Code Playgroud)\n

检查进程ID;像 2167 和命令:

\n

$ journalctl _PID=2167 {你的PID应该不同}

\n

对我来说它回馈了:

\n
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.\njun 17 11:30:52 wd-Latitude-E6530 sh[2193]: subnet 10.10.10.1 netmask 255.255.255.0\n
Run Code Online (Sandbox Code Playgroud)\n

在 /etc/dhcp/dhcpd.conf 我需要更改

\n
subnet 10.10.10.1 netmask 255.255.255.0\n
Run Code Online (Sandbox Code Playgroud)\n

进入

\n
subnet 10.10.10.0 netmask 255.255.255.0\n
Run Code Online (Sandbox Code Playgroud)\n

所以 10.10.10.1 变成 10.10.10.0

\n
$ systemctl restart isc-dhcp-server.service\n$ systemctl status isc-dhcp-server.service\n
Run Code Online (Sandbox Code Playgroud)\n

现在我开始工作了:

\n
Active: active (running) since Thu 2021-06-17 11:50:51 CEST; 2s ago\n
Run Code Online (Sandbox Code Playgroud)\n

您的问题可能有所不同,但 Journalctl _PID=#### 会给您一些反馈,您可以从那里进行故障排除。

\n

您似乎缺少子网。我正在用这个

\n
[...]\nsubnet 10.10.10.0 netmask 255.255.255.0 {\noption subnet-mask 255.255.255.0;\noption broadcast-address 10.10.10.255;\noption routers 10.10.10.1;\noption domain-name-servers 10.10.10.1;\nrange 10.10.10.3 10.10.10.250;\nif exists user-class and option user-class = "iPXE" {\n      filename "boot.ipxe";\n  } else {\n      filename "undionly.kpxe";\n
Run Code Online (Sandbox Code Playgroud)\n

这是我的 iPXE 服务器的一部分。

\n