Dhcp

DHCP 類有問題

  • October 17, 2016

我遇到了與 MAC 地址匹配的 DHCP 類的問題。

我們有很多一種類型的機器,我想在同一個池中獲得 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

有任何想法嗎?

來自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";
 }
}

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