![用户类别选项的 DHCP 范围](https://linux22.com/image/612028/%E7%94%A8%E6%88%B7%E7%B1%BB%E5%88%AB%E9%80%89%E9%A1%B9%E7%9A%84%20DHCP%20%E8%8C%83%E5%9B%B4.png)
在 Linux 中,如何设置 DHCP 服务器配置,以便从根据用户类别定义的范围中租用 IP 地址。例如,以下配置根据 mac 地址的前三个八位字节租用 IP 地址:
# MODIFY TO MATCH YOUR ENVIRONMENT
class "phones" { match if substring (hardware,1,3) = 00:11:22; }
class "handhelds" { match if substring (hardware,1,3) = 00:33:44; }
# Common configuration
option domain-name "your.domain.name.here";
option domain-name-servers 192.168.2.2;
shared-network lan {
# phones
subnet 192.168.0.0 netmask 255.255.255.0 {
pool {
range 192.168.0.10 192.168.0.254;
allow members of "phones";
}
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
}
# handheld devices
subnet 192.168.1.0 netmask 255.255.255.0 {
pool {
range 192.168.1.10 192.168.1.254;
allow members of "handhelds";
}
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
}
# Everything else
subnet 192.168.2.0 netmask 255.255.255.0 {
pool {
range 192.168.2.10 192.168.2.254;
allow unknown-clients;
}
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
}
我想要一个类似的功能,但不是针对 MAC 地址的前三个八位字节,而是针对 DHCP 请求的用户选项类 (77)。