Assigning options within a class

Glenn Satchell Glenn.Satchell at uniq.com.au
Thu Apr 10 14:33:13 UTC 2008


>Date: Thu, 10 Apr 2008 09:52:38 -0400
>From: "Norman Elton" <normelton at gmail.com>
>To: dhcp-users at isc.org
>Subject: Assigning options within a class
>
>I'm trying assign specific options to MAC addresses from a given
>vendor. My first attempt has been unpredictable:
>
>http://pastie.caboo.se/178536
>
>I've got two subnets, each with two variations on the "controller"
>option. It appears that clients in one subnet are getting the values
>assigned in another subnet, if this makes any sense.
>
>Surely there is a "correct" way of doing this. Any ideas?
>
>Thanks,
>
>Norman Elton
>
A client can be a member of more than one class. When it gets its class
membership it also inherits from the scope of that class. Generally
classes are defined in the global scope to avoid this problem.

So a client with a mac address that matches 00:0b:85 will be a member
of treyburn-ap-1000 and pen-ap-1000. And it will inherit options from
the enclosing subnet definition. Asboth classes define the controller
option then there is a potential for either option to be set. It's
probably necessary to look at the source code to work out which value
is likely to be chosen in this case.

I think in your case a simpler solution might be to use if statements
within the subnet (see dhcp-eval man page) something like

subnet 10.90.24.0 netmask 255.255.255.128 {
        option subnet-mask              255.255.255.128;
        option routers                  10.90.24.1;
        default-lease-time              86400; # 1 day
        max-lease-time                  86400; # 1 day

        if substring (hardware, 1, 3) = 00:0b:85 {
                option controller = "10.70.0.151,10.70.0.152,10.70.0.153";
        } elsif substring (hardware, 1, 3) = 00:1d:a1 {
                option controller = f1:08:0a:46:00:97:0a:46:00:98;
        }

        range           10.90.24.11     10.90.24.20;
}

and similarly for the other subnet.

regards,
-glenn



More information about the dhcp-users mailing list