[Junk released by Allow List] Re: Making use of classes
Gustaf Ankarloo
gustaf at nestil.se
Sat Jan 17 21:46:41 UTC 2009
Thanks all for explanations.
I sat down today with a friend. And apparently something were wrong in my initial conf.
I started out from scratch and got the different classes working.
I really like the potential of advanced configuration made possibly...
Still got much to learn and you will probably hear from me again.
cheers
> Gustaf Ankarloo
Systemtekniker
------------------------------------------------------------------------------------------------------------------------------
Tel. dir.: +46 31 26 04 80
Mob.: +46 708 14 70 95
Fax.:+46 31 26 41 40
www.nestil.se
------------------------------------------------------------------------------------------------------------------------------
This e-mail may contain confidential and/or legally privileged information.
If you are not the intended recipient (or have received this e-mail in error) please
notify the sender immediately and delete this e-mail.
Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
-----Original Message-----
From: dhcp-users-bounces at lists.isc.org [mailto:dhcp-users-bounces at lists.isc.org] On Behalf Of Jeffrey Hutzelman
Sent: den 17 januari 2009 08:59
To: Users of ISC DHCP
Subject: [Junk released by Allow List] Re: Making use of classes
--On Saturday, January 17, 2009 02:16:51 AM +0100 Gustaf Ankarloo
<gustaf at nestil.se> wrote:
> Im trying to figure out how the [match if substring (option
> dhcp-client-identifier, x, x) = "somevalue"] Works inside a class
> statement.
The statement is "match if <boolean expression>", and causes a client to be
added to the class if the expression is true. For more information on
expressions, see dhcp-eval(5).
In the example above, the expression is
'substring(opton dhcp-client-identifier,x,x) = "somevalue"'
"somevalue" is fairly self-explanatory; substring() returns a portion of
its first argument, with the other two determining which portion. This,
too, is documented in dhcp-eval(5); Jeff Haran quoted the relevant section
in his message.
> class "test1" {
> match if substring (option host-name, 12, 12) = "karins-lilla";
As Jeff Haran pointed, out, this doesn't work because the offset is wrong;
you're comparing "karins-lilla" to a string starting 12 characters into the
hostname, which is to say, just beyond its end.
And, these don't work because "option dhcp-client-identifier" refers to the
DHCP client identifier option, which in your example is
01:00:0f:b0:6e:9d:46, and that doesn't contain "karins-lilla" at any offset.
You could write something like
match if substring(option host-name, 0, 12) = "karins-lilla", and that
would work for that host, but it's not really what you want. For example,
that will also match a client with a hostname like "karins-lilla234234".
If what you want is to match by hostname, you should just write that:
match if option host-name = "karins-lilla";
-- Jeffrey T. Hutzelman (N3NHS) <jhutz+ at cmu.edu>
Carnegie Mellon University - Pittsburgh, PA
_______________________________________________
dhcp-users mailing list
dhcp-users at lists.isc.org
https://lists.isc.org/mailman/listinfo/dhcp-users
More information about the dhcp-users
mailing list