对于网络接口,我为 DHCP 定义了一个地址范围。
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 08:00:27:5a:3e:be brd ff:ff:ff:ff:ff:ff
inet 10.0.2.1/24 brd 10.0.2.255 scope global eth1
并且 dhcpd.conf 文件包含
subnet 10.0.2.1 netmask 255.255.255.240 {
range 10.0.2.2 10.0.2.10;
allow booting;
allow bootp;
class "pxeclients" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 10.0.2.3;
filename "pxelinux.0";
}
}
但是,当我启动 dhcpd 时,出现此错误
/etc/dhcp/dhcpd.conf line 1: subnet 10.0.2.1 netmask 255.255.255.240: bad subnet number/mask combination.
subnet 10.0.2.1 netmask 255.255.255.240
^
Configuration file errors encountered -- exiting
问题是什么?
您提供了子网内部的 IP 地址,而不是子网本身的地址。替换
subnet 10.0.2.1
为subnet 10.0.2.0
,它应该可以工作。