On 02.02.2018 09:25, Frode Sætre wrote:
> We want to identify leases with circuit ID, how can we get the circuit
> ID with the lease4-get?
> Vennlig hilsen / Best regards
> Frode Sætre


I realize that this is quite an old thread, but from our most recent
correspondence via Kea dev I know that this issue still hasn't been

We have created Kea ticket for you https://kea.isc.org/ticket/5592. This
ticket is currently out of scope for the upcoming release as this is
really a broader problem of how to easily associate any custom data with
a lease, without having to update lease database schema every time we
add a new parameter.

As of today, the circuit id is not stored in the lease database and
therefore there is no way to query for leases by circuit id, with one
exception I discuss below.

The only way to achieve what you want is to use 'flex-id' hook library
which is available as part of our premium offering:


This library allows for specifying a custom expression which constitutes
flexible identifier by which static host reservations can be identified.
In particular, you may define an expression which uses circuit-id from
the received DHCP query as an identifier to lookup host reservations for
the client which sent this query.

This library has one more feature which is going to be useful for your
case. Setting "replace-client-id" to true in the library configuration
will cause the library to replace client identifier option sent by the
client with your custom identifier, e.g. circuit-id and store it in the
lease database instead of the client identifier when the lease is
allocated. The value of the circuit-id will be prefixed with hexadecimal
"00". Assuming that the circuit-id value is "54:64:45:66". If the
"replace-client-id" is set to true, the lease will be stored and the
client-id value stored in the lease database will be "00:54:64:45:66".

Now, you can query for this lease in the following way:

    "command": "lease4-get",
    "arguments": {
        "identifier-type": "client-id",
        "identifier": "00:54:64:45:66",
        "subnet-id": 44

Note that the identifier type is "client-id", but the value you put
under "identifier" is your circuit-id prefixed with 00.

This exact case is described in the Kea User's Guide:


This is the expression you may use for your custom identifier:

"identifier-expression": "relay4[1].hex"

which creates it from the relay agent sub option 1.

Hope that helps,

Marcin Siodelski
Kea-users mailing list

Reply via email to