[Kea-users] Client Class from MySQL

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Kea-users] Client Class from MySQL

Nitzan Tzelniker
Hi,

I am trying to assign client-class from hosts table in MySQL and then use it select a pool from a subnet.
In the first line of logs bellow you can see that the class Internet is assigned in the database 
But in line four EVAL_DEBUG_MEMBER doesn’t find membership of Internet and the result expression is wrong

Should I add something in the configuration to include client-class from the database in the expression ?
Any other idea to achieve this other then the Radius hook ?


2018-12-28 00:00:53.363 DEBUG [kea-dhcp4.hosts/10767] HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_IDENTIFIER_HOST using subnet id 1 and identifier hwaddr=000C29745643, found in mysql host: hwaddr=000C29745643 ipv4_subnet_id=1 hostname=myhost.example.org ipv4_reservation=(no) siaddr=(no) sname=server-name.example.org file=(empty) key=(empty) ipv6_reservations=(none) dhcp4_class0=Internet
2018-12-28 00:00:53.363 DEBUG [kea-dhcp4.dhcp4/10767] DHCP4_CLASS_ASSIGNED [hwtype=1 00:0c:29:74:56:43], cid=[ff:2d:1a:a1:33:00:02:00:00:ab:11:9a:d7:8d:4c:9a:8f:86:4c], tid=0xc55f2574: client packet has been assigned to the following class(es): KNOWN
2018-12-28 00:00:53.363 DEBUG [kea-dhcp4.eval/10767] EVAL_DEBUG_MEMBER Checking membership of 'KNOWN', pushing result 'true'
2018-12-28 00:00:53.363 DEBUG [kea-dhcp4.eval/10767] EVAL_DEBUG_MEMBER Checking membership of 'Internet', pushing result 'false'
2018-12-28 00:00:53.363 DEBUG [kea-dhcp4.eval/10767] EVAL_DEBUG_AND Popping 'false' and 'true' pushing 'false'
2018-12-28 00:00:53.363 DEBUG [kea-dhcp4.options/10767] EVAL_RESULT Expression Internet_Class evaluated to 0

Thanks

Nitzan

_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Client Class from MySQL

Francis Dupont
A priori it is not possible because the host reservation lookup is done
after the subnet selection.

Regards

Francis Dupont <[hidden email]>
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Client Class from MySQL

Nitzan Tzelniker
Hi Francis,

I am not looking for subnet selection but for pool selection inside the same subnet 
I already tried with  require-client-classes  and   client-class  but the results are the same  
Please see the configuration bellow

Thanks

Nitzan

BTW the certificate for lists.isc.org expired at Dec 30 2018 and chrome does not let users to see the site 


    "client-classes": [
        {
            "name": "Internet",
            "only-if-required": true,
            "test": "member('ALL')"
        },
        {
            "name": "Internet_Class",
            "test": "member('KNOWN') and member('Internet')"
        },
        {
            "name": "NO_CLASS",
            "test": "member('KNOWN') and not member('Internet')"
        },
        {
            "name": "NOT_KNOWN",
            "test": "member('UNKNOWN')"
        }
    ],


    "subnet4": [
        {
            "subnet": "10.22.131.0/24",
            "authoritative": true,
            "renew-timer": 30,
            "rebind-timer": 45,
            "valid-lifetime": 90,
            "pools": [ 
                     { 
                       "pool": "10.22.131.110 - 10.22.131.190",
                       "client-class": "NO_CLASS" 
                     },
                     {
                       "pool": "10.22.131.10 - 10.22.131.90",
                       "require-client-classes": [ "Internet_Class" ]
                     },
                     {
                       "pool": "10.22.131.200 - 10.22.131.220",
                       "client-class": "NOT_KNOWN" 
                     }
             ],

            "option-data": [
                {
                    "name": "routers",
                    "data": "10.22.131.200"
                }
            ],
        }
    ]

}

On Tue, Jan 1, 2019 at 3:26 PM Francis Dupont <[hidden email]> wrote:
A priori it is not possible because the host reservation lookup is done
after the subnet selection.

Regards

Francis Dupont <[hidden email]>

_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Client Class from MySQL

Francis Dupont
Nitzan Tzelniker writes:
> I am not looking for subnet selection but for pool selection inside the
> same subnet

=> I am afraid it does not change things: the host reservation lookup
adds KNOWN / UNKNOWN class and all classes depending on it but nothing
else.

> I already tried with  require-client-classes  and   client-class  but the
> results are the same

=> both are usable after resource allocation so later than pool selection.

So I am afraid it is still impossible with writing a hook to set the class
before the pool selection. BTW the last callout is host4_identifier so just
before the host reservation lookup.

Regards.

Francis Dupont <[hidden email]>
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Client Class from MySQL

Nitzan Tzelniker
Hi Francis

The radius hook will do this ?
I saw reselect-subnet-pool in the radius hook and it looks like it will do this 

Thanks

Nitzan

On Tue, Jan 1, 2019 at 5:03 PM Francis Dupont <[hidden email]> wrote:
Nitzan Tzelniker writes:
> I am not looking for subnet selection but for pool selection inside the
> same subnet

=> I am afraid it does not change things: the host reservation lookup
adds KNOWN / UNKNOWN class and all classes depending on it but nothing
else.

> I already tried with  require-client-classes  and   client-class  but the
> results are the same

=> both are usable after resource allocation so later than pool selection.

So I am afraid it is still impossible with writing a hook to set the class
before the pool selection. BTW the last callout is host4_identifier so just
before the host reservation lookup.

Regards.

Francis Dupont <[hidden email]>

_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Client Class from MySQL

Francis Dupont
Nitzan Tzelniker writes:
> The radius hook will do this ?

=> yes but it is a hook,

> I saw *reselect-subnet-pool* in the radius hook and it looks like it will
> do this

=> not only it adds a class to select the "right" pool but it can
overwrite the selected subnet... Note it uses a host cache to not
do the host reservation lookup twice at some cost: shared subnets are
not supported.

Regards

Francis Dupont <[hidden email]>
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users