Not configured to listen on any interfaces!
No subnet declaration for restart (no IPv4 addresses).
** Ignoring requests on restart. If this is not what
you want, please write a subnet declaration
in your dhcpd.conf file for the network segment
to which interface restart is attached. **
DHCP 伺服器(dhcpd)啟動時掃描所有網路介面,發現沒有任何介面擁有 IPv4 位址且符合設定檔中的 subnet 宣告。錯誤訊息中的 restart 疑為介面名稱解析錯誤(實際介面名可能為 eth0、ens33 等),核心問題是伺服器網卡未設定靜態 IP。
ip addr show
# 或
ifconfig -a
確保目標介面(如 eth0)已配置 IPv4 位址與子網遮罩:
inet 192.168.1.100/24 brd 192.168.1.255 scope global eth0
編輯 /etc/sysconfig/network-scripts/ifcfg-eth0:
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT=yes
重啟網路服務:systemctl restart network
編輯 /etc/dhcp/dhcpd.conf,確保 subnet 區塊涵蓋伺服器 IP 所在網段:
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 8.8.8.8, 8.8.4.4;
# 重要:authoritative 宣告
authoritative;
}
編輯 /etc/sysconfig/dhcpd:
DHCPDARGS=eth0
限制 dhcpd 僅監聽指定介面。
firewall-cmd --add-service=dhcp --permanent
firewall-cmd --reload
# SELinux 通常預設允許,若有問題檢查 audit.log
systemctl enable dhcpd
systemctl start dhcpd
systemctl status dhcpd
journalctl -u dhcpd -f # 即時查看日誌
DHCPDARGS 導致監聽錯誤介面