我正在尝试在 debian 12 和 上安装和配置 ISC DHCP 服务器。但我在 syslog 中不断收到以下错误。
Jul 26 13:42:38 3ecc1b69 dhcpd[774]: No subnet declaration for enp2s0 (no IPv4 addresses).
Jul 26 13:42:38 3ecc1b69 dhcpd[774]: ** Ignoring requests on enp2s0. If this is not what
Jul 26 13:42:38 3ecc1b69 dhcpd[774]: you want, please write a subnet declaration
Jul 26 13:42:38 3ecc1b69 dhcpd[774]: in your dhcpd.conf file for the network segment
Jul 26 13:42:38 3ecc1b69 dhcpd[774]: to which interface enp2s0 is attached. **
Jul 26 13:42:38 3ecc1b69 dhcpd[774]:
Jul 26 13:42:38 3ecc1b69 dhcpd[774]:
Jul 26 13:42:38 3ecc1b69 dhcpd[774]: Not configured to listen on any interface
以下是配置文件
dhcpd配置文件
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
option domain-name-servers 192.168.1.1;
option subnet-mask 255.255.255.0;
}
接口
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
allow-hotplug enp2s0
iface enp2s0 static
address 192.168.1.1
netmask 255.255.255.0
isc-dhcp 服务器
INTERFACESv4="enp2s0"
INTERFACESv6="enp2s0"
尝试启动服务器会产生以下输出
Job for isc-dhcp-server.service failed because the control process exited with error code.
See "systemctl status isc-dhcp-server.service" and "journalctl -xeu isc-dhcp-server.service" for details.
systemctl status isc-dhcp-server.service provides this output
isc-dhcp-server.service - LSB: DHCP server
Loaded: loaded (/etc/init.d/isc-dhcp-server; generated)
Active: failed (Result: exit-code) since Fri 2024-07-26 16:11:23 EEST; 57s ago
Docs: man:systemd-sysv-generator(8)
Process: 1290 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)
CPU: 39ms
Jul 26 16:11:21 3ecc1b69 systemd[1]: Starting isc-dhcp-server.service - LSB: DHCP server...
Jul 26 16:11:21 3ecc1b69 isc-dhcp-server[1290]: Launching IPv4 server only.
Jul 26 16:11:23 3ecc1b69 isc-dhcp-server[1290]: Starting ISC DHCPv4 server: dhcpdcheck syslog for diagnostics. ... failed!
Jul 26 16:11:23 3ecc1b69 isc-dhcp-server[1290]: failed!
Jul 26 16:11:23 3ecc1b69 systemd[1]: isc-dhcp-server.service: Control process exited, code=exited, status=1/FAILURE
Jul 26 16:11:23 3ecc1b69 systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Jul 26 16:11:23 3ecc1b69 systemd[1]: Failed to start isc-dhcp-server.service - LSB: DHCP server.