5

Is there any way to define more matches with OR?

I would like to create a class with a mac address check, like

class "fixVms" {
match if substring (hardware, 1, 4) = 00:15:5d:aa;
}

but I would like to add another macs to it, like

subclass "fixVms" 1:00:15:5d:bb:00:00;

I tried to add

match pick-first-value (option dhcp-client-identifier, hardware);

to the class body but it did not work. The 2 things separetly does work.

ADIX
  • 53
  • 1
  • 4

2 Answers2

3

I haven't been able to test it myself, and the DHCPD.conf man page isn't that great, but you could try something like the following:

match if ( substring(hardware,1,3) = 00:01:e6 ) or
         ( substring(hardware,1,3) = 00:60:b0 ) or
         ( substring(hardware,1,3) = 00:10:83 );

This came from the following mailing list message

http://marc.info/?l=dhcp-server&m=102521117221954&w=2

USD Matt
  • 5,321
  • 14
  • 23
2

In class declaration, "match if" and "match" statements will joined as AND (intersection), so class may be rewrited as:

class "fixVms" {
  match if substring(hardware, 1, 4) = 00:15:5d:aa or substring(hardware, 1, 6) = 00:15:5d:bb:00:00;
}

if needed static macs list for mac prefixes 00:15:5d:aa and 00:15:5d:bb :

class "fixVms" {
  match if substring(hardware, 1, 4) = 00:15:5d:aa or substring(hardware, 1, 4) = 00:15:5d:bb;
  match hardware;
}

subclass "fixVms" 1:00:15:5d:aa:00:00;
subclass "fixVms" 1:00:15:5d:aa:01:01;
subclass "fixVms" 1:00:15:5d:bb:00:00;
subclass "fixVms" 1:00:15:5d:bb:0a:0a;
 .  .  .

In this case, client belongs to class if mac matching with prefixes and if declared subclass with this mac.

sadnix
  • 21
  • 2