我在 Raspbian 上运行 ISC DHCPd。我想设置我的服务器,以便所有地址192.168.0.0/24
都是静态租约,所有地址192.168.1.0/24
都是动态租约。我希望两者共享 192.168.0.0/23 子网。
澄清:基本上,我想要一个 DHCP 服务器来处理整个192.168.0.0/23
子网的 DHCP。如果请求 IP 的设备host
在 中定义了条目dhcpd.conf
,则会为其分配指定的 IP 地址。如果没有,它将分配一个范围内的地址192.168.1.2 - 192.168.1.254
。为简单起见,我将所有静态租约限制在该范围内192.168.0.2 - 192.168.0.254
。
我的服务器配置如下:
option domain-name "home";
option domain-name-servers 192.168.0.3;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
host mightyturing{ hardware ethernet 10:bf:48:87:74:a2; fixed-address 192.168.0.64; }
host beastnugget{ hardware ethernet 34:e6:d7:52:1e:e4; fixed-address 192.168.0.65; }
host ... (about 50 more static leases)
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
option broadcast-address 192.168.1.255;
option domain-name-servers 192.168.0.3, 1.1.1.1;
option domain-name "home";
option subnet-mask 255.255.254.0;
ddns-updates off;
}
当我尝试启动该服务时,它发出呜呜声:
Nov 17 17:45:26 raspberrypi dhcpd[681]: DHCPREQUEST for 192.168.0.64 from 10:bf:48:87:74:a2 via eth0
Nov 17 17:45:26 raspberrypi dhcpd[681]: DHCPACK on 192.168.0.64 to 10:bf:48:87:74:a2 via eth0
Nov 17 17:45:59 raspberrypi dhcpd[681]: Dynamic and static leases present for 192.168.0.64.
Nov 17 17:45:59 raspberrypi dhcpd[681]: Remove host declaration mightyturing or remove 192.168.0.64
Nov 17 17:45:59 raspberrypi dhcpd[681]: from the dynamic address pool for 192.168.0.0/23
...而且由于我的租赁池是192.168.1.0/24
...我很确定这意味着它192.168.0.64
不在池中。那么为什么 ISC 不承认这一点呢?为什么它抱怨我没有指示它为其颁发动态 IP 的范围?
还:
当我更改范围以在该10.0.0.0/24
范围上发布动态 IP(以测试 ISC 的健全性),但保留静态租约时192.168.0.0/24
,它仍然会抱怨192.168.0.0/23
发生了什么事?准确地说,我在哪里要求它分发 192.168.0.0/23 地址?
option domain-name "home";
option domain-name-servers 192.168.0.3;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
host mightyturing{ hardware ethernet 10:bf:48:87:74:a2; fixed-address 192.168.0.64; }
host beastnugget{ hardware ethernet 34:e6:d7:52:1e:e4; fixed-address 192.168.0.65; }
subnet 10.0.0.0 netmask 255.255.255.254 {
option routers 10.0.0.1;
option broadcast-address 10.0.0.255;
option domain-name-servers 1.1.1.1;
option domain-name "home";
option subnet-mask 255.255.255.0;
ddns-updates off;
}