Linux

不正確的子網/遮罩組合

  • August 2, 2014

對於網路介面,我為 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.1subnet 10.0.2.0,它應該可以工作。

引用自:https://serverfault.com/questions/617414