0

I'm having issues with DHCP classes matching mac addresses.

We have a lot of one type of machine and I want to get the IPMI cards in the same pool.

I've tried the following;

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

For some reason nothing is getting matched and the machines aren't picking up reservations.

Oct 14 11:32:52 gotti dhcpd: DHCPDISCOVER from 0c:c4:7a:1c:d4:37 via em1: network LAN: no free leases

Any ideas?

1 Answers1

0

From 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-

So you likely either need to add the type of network to the search:

match if (substring(hardware, 0, 3) = 01:0c:c4:7a);

Or to blindly assume ethernet and start the search not at the first position:

match if (substring(hardware, 1, 3) = 0c:c4:7a);

In testing, the "type of network" as a leading 1: or 01: did not pan out, while the following did:

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";
  }
}
thrig
  • 1,626
  • 9
  • 9