DHCPD classes - How to put unknown devices in a separate class?
Glenn Satchell
glenn.satchell at uniq.com.au
Tue Mar 23 13:03:14 UTC 2010
On 03/23/10 19:25, Jessica Meyer wrote:
> Hi list
>
> I'm stuck with DHCPD classes. I need to classify all requests
> according to the vendor-class-identifier. I have two classes and it
> works fine. Now what I need (and haven't found yet) is to put all
> _other_ devices in a third class. So, if a device doesn't belong to
> class A or B, put it in C. I have played with "match if" statements
> but haven't had any success.
>
> My classes are:
>
> class "Devices_A" {
> match if ( substring ( option vendor-class-identifier, 0, 6 ) = "vendor1" );
> log ( info, "Got a packet from a vendor1 device" );
> }
>
> class "Devices_B" {
> match if ( substring ( option vendor-class-identifier, 0, 6 ) = "vendor2" );
> log ( info, "Got a packet from a vendor2 device" );
> }
>
> Can i somehow test if a request doesn't belong to Devices_A or
> Devices_B? Any help is highly appreciated!
> Jess
Hi Jess
Depends what you want to do with the class. If it is only to assign
pools then you can use deny in the pool, eg:
subnet ... {
pool {
allow members of "Devices_A";
...
}
pool {
allow members of "Devices_B";
...
}
pool {
deny members of "Devices_A";
deny members of "Devices_B";
...
}
}
Or perhaps you want to put particular settings in the class? You could
make those global settings and then override in the other classes, eg
option domain-name "default.example.com";
class "Devices_A" {
match if ( substring ( option vendor-class-identifier, 0, 6 ) =
"vendor1" );
log ( info, "Got a packet from a vendor1 device" );
option domain-name "devicea.example.com";
}
class "Devices_B" {
match if ( substring ( option vendor-class-identifier, 0, 6 ) =
"vendor2" );
log ( info, "Got a packet from a vendor2 device" );
option domain-name "deviceb.example.com";
}
And a final thought is to match if the string in not equal, eg
class "Devices_C" {
match if ( substring ( option vendor-class-identifier, 0, 6 ) !=
"vendor1"
and substring (option vendor-class-identifier, 0, 6 ) != "vendor2" );
log ( info, "Got a packet not from a vendor1 or vendor2 device" );
option domain-name "devicec.example.com";
}
HTH,
regards,
-glenn
More information about the dhcp-users
mailing list