我有这个 DHCP 配置文件:
authoritative;
option domain-name "XXX.XXX.XX";
allow bootp;
ddns-update-style ad-hoc;
class "karpuz-kabugu"
{
match if (substring (option user-class, 0, 6) = "karpuz");
log (info, "karpuz-kabugu");
}
subnet 10.6.1.0 netmask 255.255.255.0 {
pool {
range 10.6.1.10 10.6.1.99;
allow members of "karpuz-kabugu";
}
pool {
range 10.6.1.100 10.6.1.250;
allow unknown-clients;
}
option broadcast-address 10.6.1.255;
option routers 10.6.1.1;
}
我想要做的是根据用户类别(选项 77)租用 IP 地址。我已使用以下命令在 Windows DHCP 客户端上设置了用户类别 IDipconfig /setclassid
我还karpuz
使用 wireshark 查看了 DHCP 选项 77 中的设置。
dhcp日志内容如下:
May 27 17:09:18 2013 dhcpd: karpuz-kabugu
May 27 17:09:18 2013 dhcpd: DHCPDISCOVER from 00:1c:23:b5:da:71 via eth4
May 27 17:09:19 2013 dhcpd: DHCPOFFER on 10.6.1.250 to 00:1c:23:b5:da:71 (DELL1-DESTEK) via eth4
May 27 17:09:19 2013 dhcpd: karpuz-kabugu
May 27 17:09:19 2013 dhcpd: if DELL1-DESTEK.meb.gov.tr IN A rrset doesn\'t exist add DELL1-DESTEK.meb.gov.tr 21600 IN A 10.6.1.250: timed out.
May 27 17:09:19 2013 dhcpd: DHCPREQUEST for 10.6.1.250 (10.6.1.1) from 00:1c:23:b5:da:71 (DELL1-DESTEK) via eth4
May 27 17:09:19 2013 dhcpd: DHCPACK on 10.6.1.250 to 00:1c:23:b5:da:71 (DELL1-DESTEK) via eth4
May 27 17:09:22 2013 dhcpd: karpuz-kabugu
May 27 17:09:22 2013 dhcpd: DHCPINFORM from 10.6.1.250 via eth4
May 27 17:09:22 2013 dhcpd: DHCPACK to 10.6.1.250 (00:1c:23:b5:da:71) via eth4
如您所见,我的客户端被分配了 IP10.6.1.250
地址,但我期望的 IP 地址10.6.1.10
介于10.6.1.99
我究竟做错了什么?
答案1
Dhcp 语句,如手册页中所述,仅允许从配置中allow unknow-clients
没有声明的客户端获取 IP 地址。这是默认的。所以,我猜首先要从池声明中删除这样的语句。其次,尝试将语句添加到该池中。您的池配置应该是这样的:host
deny
pool {
range 10.6.1.10 10.6.1.99;
allow members of "karpuz-kabugu";
}
pool {
range 10.6.1.100 10.6.1.250;
deny members of "karpuz-kabugu";
}