classes for hostnames
Glenn Satchell
glenn.satchell at uniq.com.au
Tue Oct 27 12:57:52 UTC 2015
On Tue, October 27, 2015 9:01 pm, Andreas Burger wrote:
> hi there,
>
> we define hosts with dedicated ip-adresses based on the mac.
>
> and we have pools where known-clients are allowed.
> to have them online, when tehy are in an other of our nets.
>
> what i would like to do, is define classes that are allowed/denyed for
> some pools. but not baesd on mac, but on a regex of the hostname (or a
> tag or so)
> has someone done such things or has a hint, how to make that?
>
> regards
> andreas
See the dhcp-eval man page:
data-expression-1 ~= data-expression-2
data-expression-1 ~~ data-expression-2
The ~= and ~~ operators (not available on all systems)
perform extended regex(7) matching of the values of two
data expressions, returning true if data-expression-1
matches against the regular expression evaluated by data-
expression-2, or false if it does not match or encounters
some error. If either the left-hand side or the right-
hand side are null or empty strings, the result is also
false. The ~~ operator differs from the ~= operator in
that it is case-insensitive.
So putting this with a class statement:
class "hostmatch" {
match if option host-name ~~ "foo.*";
....
}
Note that I haven't tested this, so the syntax might not be 100% but it
should be close. The hostname might be fully qualified, so allow for that
in the regex.
regards,
-glenn
More information about the dhcp-users
mailing list