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

Darren Ankney darren.ankney at gmail.com
Tue Dec 6 12:06:48 UTC 2022


I have a working config that assigns classes not based on any vendor
data but rather on DUID.  I don't have debug logs for it as it is a
production system (line breaks in the CLASS1 test were added by me for
purposes of this mail) but they do work perfectly fine (anonymized the
config snippets also).  Not sure why this couldn't also work using
vendor class.

......

        "client-classes": [
            {
                "name": "CLASS1",
                "test": "(substring(option[1].hex,0,all) ==
0x000203090505149182b5fb4c)
                or (substring(option[1].hex,0,all) ==
0x0001000126ffbc3f001c42bdc36c)
                or (substring(option[1].hex,0,all) == 0x0001000116c3c001)
                or (substring(option[1].hex,0,all) ==
0x0004879cc5cccd04eaeb8d88a075d5167c61)
                or (substring(option[1].hex,0,all) ==
0x000100012b095f5c001c42c61174)"
            },
            {
                "name": "CLASS2",
                "test": "(not(member('CLASS1')))"
            },
            {
                "name": "CLASS3",
                "test": "(substring(option[1].hex,0,all) ==
0x000000000000000001ff)"
            }
        ],

.....

                "name": "XXXXX",
                "subnet6": [
                    {
                        "valid-lifetime": 28800,
                        "preferred-lifetime": 25920,
                        "subnet": "2001:0:12:11::/64",
                        "pools": [
                            {
                                "pool":
"2001:0:12:11::1-2001:0:12:11:ffff:ffff:ffff:fffe",
                                "client-class": "CLASS1"
                            }
                        ],
                        "pd-pools": [
                            {
                                "prefix": "2001:0:58::",
                                "prefix-len": 46,
                                "delegated-len": 64,
                                "client-class": "CLASS1"
                            }
                        ],

.......

                    {
                        "valid-lifetime": 28800,
                        "preferred-lifetime": 25920,
                        "subnet": "2001:0:3bf1:c30b::/64",
                        "pools": [
                            {
                                "pool":
"2001:0:3bf1:c30b::1-2001:0:3bf1:c30b:ffff:ffff:ffff:fffe",
                                "client-class": "CLASS2",
                            }
                        ],
                        "pd-pools": [
                            {
                                "prefix": "2001:0:3bf2::",
                                "prefix-len": 48,
                                "delegated-len": 64,
                                "client-class": "CLASS2",
                            }
                        ],

.....

            {
                "name": "XXXXX",
                "subnet6": [
                    {
                        "valid-lifetime": 28800,
                        "preferred-lifetime": 25920,
                        "subnet": "2001:0:1:1::/64",
                        "pools": [
                            {
                                "pool":
"2001:0:1:1::1-2001:0:1:1:ffff:ffff:ffff:fffe",
                                "client-class": "CLASS3"
                            }
                        ],
                        "pd-pools": [
                            {
                                "prefix": "2001:0:2::",
                                "prefix-len": 48,
                                "delegated-len": 64,
                                "client-class": "CLASS3"
                            },
                        ],

.....

On Tue, Dec 6, 2022 at 2:33 AM Xuo Guoto via Kea-users
<kea-users at lists.isc.org> wrote:
>
> 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 <darren.ankney at gmail.com> 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 0x000096D70009646876365F706F6F6C
> 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 0x000096D70009646876365F706F6F6C 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:
>
> <quote>
> 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.
> </quote>
>
> 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 at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users


More information about the Kea-users mailing list