Assign subnets to multiple classes with substring match expressions

Michele Vetturi mvetturi at yahoo.it
Tue May 8 10:38:52 UTC 2007


Good day all.

I am a newbie of advanced DHCP configuration. So don't chastise me, please... :D

I want to match clients using a standardization of the
dhcp-client-identifier and classes.

Ex:    "Internal;Prod_;BuildA;"
         "Internal;QAEnv;BuildB;"

So, I wish to distinguish internal systems assigning them to a class "Internal"

class "Internal" {
   match if (
      ( substring ( option dhcp-client-identifier, 0, 9) = "Internal;" )
   );

   option ip-forwarding off;
}

Notebooks of customers will be so assigned to a different pool
associated with a Guest VLAN.

My idea, then, was categorize Internal machines differentiating them
by the second field of the option dhcp-client-identifier, so...

class "Production" {
   match if (
      ( substring ( option dhcp-client-identifier, 0, 9) = "Internal;" ) and
      ( substring ( option dhcp-client-identifier, 10, 6) = "Prod_;" )
   );
}

class "QA-Environment" {
   match if (
      ( substring ( option dhcp-client-identifier, 0, 9) = "Internal;" ) and
      ( substring ( option dhcp-client-identifier, 10, 6) = "QAEnv;" )
   );
}

May this work, in your opinion? Will the system be part of both
classes? Could I write the following instead (or something similar)?

class "QA-Environment" {
   match if (
      ( member of = "Internal;" ) and
      ( substring ( option dhcp-client-identifier, 10, 6) = "QAEnv;" )
   );
}

Last stupid question (sorry :) ... Is the syntax of my second
substring expression correct? What does the last parameter mean - the
length of the resulting string or the last char to include?

Thank you very much for your response and sorry for my broken english.
Great list!

-- 
Michele Vetturi


More information about the dhcp-users mailing list