4

We are looking for a way to do something along these lines in the dhcpd.conf file:

subnet ... {
    #couple of options for the subnet here
    pool {
        allow members of "class-name1";
        allow members of "class-name2";

        range ip1 ip2;
    }

    if is member of class "class-name1" {
        option ...;
    }
}

The part in question is if is member of class "class-name" - no idea how to verify this condition.

Here is how the class itself is defined:

class "class name" {
    match if some_condition_here;
}

Of course an obvious solution would be just repeating the same condition in the subnet section, but would be a repetition - not a very good way to go. I also believe this goes somewhat against the essence of a class.

Another idea we had was to use separate pool for this without specifying the range. Like this:

pool {
    allow members of "class-name1";
    option ...;
}

That did not work though - config is not accepted as invalid. Apparently pool section requires a range inside, although I am not able to find this requirement in the spec.

We had one more guess - specify two identical pools, one for other classes and one for "class-name1". However that means that the same range appears twice, which is again an invalid config.

So, is there a good way to verify if a device was classified as a member of particular class?

Andrei
  • 91
  • 3

1 Answers1

0

Options may be defined in particulary class declaration, so not needed difining options in subnet block:

class "class1" {
    match if substring (option vendor-class-identifier,0,8) = "qwerty12";
    log(info, concat("Vendor Class = ", substring (option vendor-class-identifier,0,8)));
    vendor-option-space TBoot;
    option TBoot.SrvType "tboot";
    option TBoot.Srv 192.168.1.50;
    option TBoot.Version "0.5.4";
    filename "http://192.168.1.50/tboot.pxe";
}
sadnix
  • 21
  • 2