SV: Assign subnets to multiple classes with substring match expressions

Lars Jacobsen lj at sydfynsel.dk
Tue May 15 12:03:53 UTC 2007


> Michele Vetturi wrote
> >
> > 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? 

 [Lars Jacobsen] 
Yes, if you segment your Internal machines that way, then client
can/will be part of one of the classes.
But if you still have the overall "Internal" classs, then the client can
be a member of both class and witch the client will be billed to seems
uncertain to me. Can be a problem if you use spawning classes and
limiting the leases. Because the client can be billed to either one of
the two and screw up your planning ;-) 

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

[Lars Jacobsen] No won't work, as the server does not support classing
based on other classes.

> > }
> >
> > 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?

[Lars Jacobsen] 
Take a look at the man pages. 
Substring ( option to look in, start counting from caracter, caracters
to count) = "match"  

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



More information about the dhcp-users mailing list