对于网络接口,我已经为 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
问题是什么?
答案1
您给出的是子网内的 IP 地址,而不是子网本身的地址。将其替换subnet 10.0.2.1
为subnet 10.0.2.0
,它应该可以正常工作。