Re: [Kea-users] DHCPv6 option 16 and built in client class

2022-12-05 Thread Xuo Guoto via Kea-users
Thanks for your reply, Darren.

I have been trying different approaches to get client class working with DHCPv6.


Sent with Proton Mail secure email.

--- Original Message ---
On Friday, December 2nd, 2022 at 5:57 AM, Darren Ankney 
 wrote:


> I don't presently have DHCPv6 setup in my home network, but my kea
> server for DHCPv4 seems to be assigning the clients to the vendor
> classes:

Yes, I also have DHCPv4 working correctly.

I attempted to define a client-class to manually match the packet and assign a 
class:

"client-classes": [
  { 
"name": "dhv6_pool_class",
"test": "substring(option[16].hex,6,15) == 'dhv6_pool'"
  }

Logs indicate that this is getting matched

2022-12-06 12:37:33.051 EVAL_DEBUG_OPTION Pushing option 16 with value 
0x96D70009646876365F706F6F6C
2022-12-06 12:37:33.051 EVAL_DEBUG_STRING Pushing text string '6'
2022-12-06 12:37:33.051 EVAL_DEBUG_STRING Pushing text string '15'
2022-12-06 12:37:33.051 VAL_DEBUG_SUBSTRING Popping length 15, start 6, string 
0x96D70009646876365F706F6F6C pushing result 0x646876365F706F6F6C
2022-12-06 12:37:33.051 EVAL_DEBUG_STRING Pushing text string 'dhv6_pool'
2022-12-06 12:37:33.051 EVAL_DEBUG_EQUAL Popping 0x646876365F706F6F6C and 
0x646876365F706F6F6C pushing result '
true'
2022-12-06 12:37:33.051 EVAL_RESULT Expression dhv6_pool_class evaluated to 1

In 
https://kea.readthedocs.io/en/kea-2.2.0/arm/classify.html#classification-steps 
item 3 states that:


Classes with matching expressions and not marked for later evaluation (“on 
request” or depending on the KNOWN/UNKNOWN built-in classes) are processed in 
the order they are defined in the configuration; the boolean expression is 
evaluated and, if it returns true (a match), the incoming packet is associated 
with the class.


Here the expression matches and is true.

2022-12-06 12:37:33.052 DHCP6_CLASS_ASSIGNED 
duid=[00:03:00:01:02:00:00:00:00:01], tid=0x147866: client packet has been 
assigned to the following class(es): UNKNOWN

but packet is not assigned to that class.

I have been pulling out my hair for past couple of days on this, anyone with a 
working config to get this done would be very helpful

X.



-- 
ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.

To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.

Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


Re: [Kea-users] Example of how to combine host reservations and class tests?

2022-12-05 Thread Darren Ankney
Nathan,

Something like the below would work.

However, the test for being a member of office-printers or
public-printers would need to be changed.  I didn't know what
parameter would cause that to be the case so I just used an example.
Also, you shouldn't need member KNOWN in your test unless you are
performing some reservations and only want clients in the
office-printers / public-printers classes that you have given a
reservation to.  If so, you can assign special options during the
reservation process. That might satisfy the JetDirect requirements in
a simpler way.  Have a look at:
https://kea.readthedocs.io/en/kea-2.2.0/arm/dhcp4-srv.html?highlight=reservation#including-specific-dhcpv4-options-in-reservations
avoiding the need for these other more complex classes.

"client-classes": [
{
"name": "office-printers",
"test": "(substring(option[60].hex,0,9) == 'JetDirect')",
"only-if-required": true
},
{
"name": "public-printers",
"test": "(substring(option[60].hex,0,9) == 'JetDirect')",
"only-if-required": true
},
{
"name": "jetdirect-office",
"test": "(member('KNOWN')) and
(member('office-printers')) and (substring(option[60].hex,0,9) ==
'JetDirect')",
"only-if-required": true
},
{
"name": "jetdirect-public",
"test": "(member('KNOWN')) and
(member('public-printers')) and (substring(option[60].hex,0,9) ==
'JetDirect')",
"only-if-required": true
}
],
"subnet4": [
{
"subnet": "192.168.10.0/24",
"id": 10,
"option-data": [
{
"name": "routers",
"data": "192.168.10.1"
}
],
"pools": [
{
"pool": "192.168.10.10 - 192.168.10.20"
}
],
"client-class": "jetdirect-office"
},
{
"subnet": "192.168.20.0/24",
"id": 20,
"option-data": [
{
"name": "routers",
"data": "192.168.20.1"
}
],
"pools": [
{
"pool": "192.168.20.10 - 192.168.20.50"
}
],
"client-class": "jetdirect-office"
},

On Sun, Dec 4, 2022 at 4:35 PM Nathan Neulinger  wrote:
>
> I see this example in the docs:
>
> 
> https://kea.readthedocs.io/en/kea-2.2.0/arm/dhcp4-srv.html#reserving-client-classes-in-dhcpv4
>
> Where it's assigning 'reserved-class1' and 'reserved-class2' to to a 
> reservation in the subnet. Is there some way to do this in conjunction with a 
> 'test'?
>
> i.e. I'd like to say:
>
> For a host with class "reserved-class1" _AND_ VendorClassIdentifier "X" 
> -> these options
> For a host with class "reserved-class2" _AND_ VendorClassIdentifier "X" 
> -> these other options
>
> If you need a more specific example (come up on the fly, so there may 
> certainly be better ways to do this, but I'm specifically wanting to do 
> something like the above):
>
> JetDirect printer devices with label "office printers" -> use boot server 
> A, filename X
> JetDirect printer devices with label "public printers" -> use boot server 
> B, filename Y
>
>
> Would it be something like (VCI likely wrong, just for example purposes:
>
> {
> "client-classes": [
> {
> "name": "jetdirect-office",
> "test": "member('KNOWN') and member('office-printers') and 
> substring(option[60].hex,0,9) == 'JetDirect'",
> "only-if-required": true
> }
> ]
> }
>
> combined with setting in a host reservation?
>
> "client-class" : "office-printers"
>
>
> -- Nathan
> 
> Nathan Neulinger   nn...@neulinger.org
> Neulinger Consulting   (573) 612-1412
>
> --
> ISC funds the development of this software with paid support subscriptions. 
> Contact us at https://www.isc.org/contact/ for more information.
>
> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
>
> Kea-users mailing list
> Kea-users@lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users
-- 
ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.

To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.

Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users