我在 DHCP 类别与 MAC 地址匹配方面遇到了问题。
我们有很多同一类型的机器,我想将 IPMI 卡放在同一个池中。
我尝试过以下方法;
class "IPMI" {
match if (substring(hardware, 0, 3) = 0c:c4:7a);
}
subnet 10.0.0.0 netmask 255.255.0.0 {
option routers 10.0.0.1;
pool {
range 10.0.1.0 10.0.1.255;
allow members of "IPMI";
}
}
由于某种原因,没有任何信息得到匹配,机器也没有接收预订。
Oct 14 11:32:52 gotti dhcpd: DHCPDISCOVER from 0c:c4:7a:1c:d4:37 via em1: network LAN: no free leases
有任何想法吗?
答案1
从dhcp-eval(5)
:
hardware
The hardware operator returns a data string whose first element is
the type of network interface indicated in packet being considered,
and whose subsequent elements are client’s link-layer address. If
there is no packet, or if the RFC2131 hlen field is invalid, then
the result is null. Hardware types include ethernet (1), token-
因此您可能需要将网络类型添加到搜索中:
match if (substring(hardware, 0, 3) = 01:0c:c4:7a);
或者盲目假设以太网并且从第一个位置以外的地方开始搜索:
match if (substring(hardware, 1, 3) = 0c:c4:7a);
在测试中,“网络类型”作为主要选项1:
没有01:
成功,而以下内容成功了:
class "FOO" {
match if substring(hardware, 1, 3) = 08:00:27;
}
subnet 192.168.33.0 netmask 255.255.255.0 {
option routers 192.168.33.1;
pool {
range 192.168.33.110 192.168.33.120;
allow members of "FOO";
}
}