2022-05-11 22:05:43 +00:00
|
|
|
|
.. _hooks-lease-query:
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
2022-06-13 16:07:48 +00:00
|
|
|
|
``lease_query``: Leasequery Support
|
|
|
|
|
===================================
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
2022-06-13 16:07:48 +00:00
|
|
|
|
This library provides support for DHCPv4 Leasequery as described in
|
2020-06-18 16:24:05 -04:00
|
|
|
|
`RFC 4388 <https://tools.ietf.org/html/rfc4388>`__; and for DHCPv6
|
2023-04-07 15:12:25 +00:00
|
|
|
|
Leasequery as described in (`RFC 5007 <https://tools.ietf.org/html/rfc5007>`__).
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
This library can only be loaded by the ``kea-dhcp4`` or
|
2020-05-18 09:37:09 -04:00
|
|
|
|
``kea-dhcp6`` process.
|
|
|
|
|
|
2022-11-19 16:03:17 +01:00
|
|
|
|
Kea version 2.3.4 added support for DHCPv6 Bulk Leasequery
|
2023-04-07 15:12:25 +00:00
|
|
|
|
(`RFC 5460 <https://tools.ietf.org/html/rfc5460>`__);
|
2023-02-07 11:32:32 +01:00
|
|
|
|
Kea version 2.3.5 added support for DHCPv4 Bulk Leasequery
|
|
|
|
|
(`RFC 6926 <https://tools.ietf.org/html/rfc6926>`__) using
|
|
|
|
|
the memfile lease backend.
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
2020-06-19 16:32:19 +02:00
|
|
|
|
The Leasequery library is only available to ISC customers with a paid support contract.
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
2020-05-21 00:07:09 +02:00
|
|
|
|
.. _lease-query-dhcpv4:
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
|
|
|
|
DHCPv4 Leasequery
|
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2021-12-02 20:54:04 +00:00
|
|
|
|
DHCPv4 simple Leasequery provides a requester the ability to query for
|
2020-05-18 09:37:09 -04:00
|
|
|
|
active lease information for either a single IP address or a single client.
|
2020-05-19 11:20:29 -04:00
|
|
|
|
RFC 4388 calls for three such queries:
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
|
|
|
|
- Query by IP address
|
2020-05-19 21:19:12 +02:00
|
|
|
|
|
2020-05-18 09:37:09 -04:00
|
|
|
|
The IP address of interest is contained within the ``ciaddr`` field of
|
|
|
|
|
the query.
|
|
|
|
|
- Query by hardware address
|
2020-05-19 21:19:12 +02:00
|
|
|
|
|
2020-05-18 09:37:09 -04:00
|
|
|
|
The hardware address of interest is contained with the ``chaddr`` field
|
2020-05-19 11:20:29 -04:00
|
|
|
|
of the query.
|
2020-05-18 09:37:09 -04:00
|
|
|
|
- Query by client identifier
|
2020-05-19 21:19:12 +02:00
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
The client identifier of interest is sent in the ``dhcp-client-identifier``
|
2020-05-18 09:37:09 -04:00
|
|
|
|
option (61) of the query.
|
|
|
|
|
|
2020-05-19 11:20:29 -04:00
|
|
|
|
The inbound DHCPLEASEQUERY packet must supply only one of the three values
|
2021-11-30 22:17:48 +00:00
|
|
|
|
above. Queries which supply more than one of these values are dropped.
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
|
|
|
|
In addition, the query must contain the IP address of the requester in
|
2021-11-30 22:17:48 +00:00
|
|
|
|
``giaddr``. This value is used not only as the destination for the
|
2020-05-18 09:37:09 -04:00
|
|
|
|
query response but also to validate the requester against a known
|
2021-11-30 22:17:48 +00:00
|
|
|
|
list of IP addresses which are permitted to query. This list of valid
|
2020-05-18 09:37:09 -04:00
|
|
|
|
requester addresses is specified as part of the Leasequery hook library's
|
2021-11-30 22:17:48 +00:00
|
|
|
|
configuration (see the section on configuration below).
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
In response to a valid query, the server returns one of three message
|
2020-05-18 09:37:09 -04:00
|
|
|
|
types:
|
|
|
|
|
|
2020-05-19 11:20:29 -04:00
|
|
|
|
- DHCPLEASEUNKNOWN
|
2020-05-19 21:19:12 +02:00
|
|
|
|
|
2020-05-19 11:20:29 -04:00
|
|
|
|
Returned when the IP address of interest is not one the server knows
|
|
|
|
|
about (query by IP address); or there are no active leases for the
|
2021-11-30 22:17:48 +00:00
|
|
|
|
client of interest (query by hardware address or client ID).
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
2020-05-19 11:20:29 -04:00
|
|
|
|
- DHCPLEASEUNASSIGNED
|
2020-05-19 21:19:12 +02:00
|
|
|
|
|
2020-05-18 09:37:09 -04:00
|
|
|
|
Returned when the IP address is one the server knows of but for which
|
|
|
|
|
there are no active leases (applies only to query by IP address).
|
|
|
|
|
|
|
|
|
|
- DHCPLEASEACTIVE
|
2020-05-19 21:19:12 +02:00
|
|
|
|
|
2020-05-18 09:37:09 -04:00
|
|
|
|
Returned when there is at least one active lease found matching the
|
2020-05-19 11:20:29 -04:00
|
|
|
|
criteria.
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
|
|
|
|
For both DHCPLEASEUNKNOWN and DHCPLEASEUNASSIGNED responses, the only
|
|
|
|
|
information sent back to the requester in response is the query parameter
|
|
|
|
|
itself (i.e. one of: IP address, hardware address, or client identifier).
|
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
For DHCPLEASEACTIVE the server provides the following information
|
2020-05-18 09:37:09 -04:00
|
|
|
|
for the newest active lease that matches the criteria, in the response:
|
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
- ``ciaddr`` - set to the lease's IP address
|
|
|
|
|
- ``chaddr`` - set to the lease's hardware address
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
In addition, one or more of the following options are included:
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
|
|
|
|
.. tabularcolumns:: |p{0.2\linewidth}|p{0.1\linewidth}|p{0.7\linewidth}|
|
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
.. table:: DHCPLEASEACTIVE options
|
2020-05-18 09:37:09 -04:00
|
|
|
|
:class: longtable
|
2020-05-19 21:19:12 +02:00
|
|
|
|
:widths: 30 10 70
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
2020-05-19 11:20:29 -04:00
|
|
|
|
+------------------------------+-------+-----------------------------------------------+
|
|
|
|
|
| Option | Code | Content |
|
|
|
|
|
+==============================+=======+===============================================+
|
2020-11-14 00:00:37 +00:00
|
|
|
|
| dhcp-client-identifier | 61 | copied from the lease (if appropriate) |
|
2020-05-19 11:20:29 -04:00
|
|
|
|
+------------------------------+-------+-----------------------------------------------+
|
2020-11-14 00:00:37 +00:00
|
|
|
|
| client-last-transaction-time | 91 | the amount of time that has elapsed since the |
|
|
|
|
|
| | | lease's client-last-transaction-time (CLTT). |
|
|
|
|
|
| | | This value is also used by the server to |
|
|
|
|
|
| | | adjust lifetime and timer values. |
|
2020-05-19 11:20:29 -04:00
|
|
|
|
+------------------------------+-------+-----------------------------------------------+
|
2020-11-14 00:00:37 +00:00
|
|
|
|
| dhcp-lease-time | 51 | lease's lifetime reduced by CLTT |
|
2020-05-19 11:20:29 -04:00
|
|
|
|
+------------------------------+-------+-----------------------------------------------+
|
|
|
|
|
| dhcp-renewal-time | 58 | as controlled by kea-dhcp4 configuration and |
|
|
|
|
|
| | | then reduced by CLTT |
|
|
|
|
|
+------------------------------+-------+-----------------------------------------------+
|
2020-11-14 00:00:37 +00:00
|
|
|
|
| dhcp-rebind-time | 59 | as dictated by kea-dhcp4 configuration and |
|
2020-05-19 11:20:29 -04:00
|
|
|
|
| | | then reduced by CLTT |
|
|
|
|
|
+------------------------------+-------+-----------------------------------------------+
|
|
|
|
|
| dhcp-agent-options | 82 | if stored on the lease. (See |
|
|
|
|
|
| | | :ref:`dhcp4-store-extended-info`) |
|
|
|
|
|
+------------------------------+-------+-----------------------------------------------+
|
|
|
|
|
| associated-ip | 92 | a list of all other IP addresses for which |
|
|
|
|
|
| | | the client has active leases. (Does not apply |
|
|
|
|
|
| | | to query by IP address) |
|
|
|
|
|
+------------------------------+-------+-----------------------------------------------+
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
The ``dhcp-server-identifier`` option (54) is returned in all responses in keeping with
|
|
|
|
|
RFC 2131, section 4.3.1.
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
2020-05-19 11:20:29 -04:00
|
|
|
|
RFC 4388 allows requesters to ask for specific options via the
|
2021-11-30 22:17:48 +00:00
|
|
|
|
``dhcp-parameter-request-list`` (PRL, option 55). This is not currently supported in Kea.
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
2020-05-21 00:07:09 +02:00
|
|
|
|
.. _lease-query-dhcpv4-config:
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
|
|
|
|
DHCPv4 Leasequery Configuration
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
Configuring the Leasequery hook library for use is straightforward. It
|
2020-05-18 09:37:09 -04:00
|
|
|
|
supports a single parameter, ``requesters``, which is a list of IP addresses from
|
2021-11-30 22:17:48 +00:00
|
|
|
|
which DHCPLEASEQUERY packets are accepted. In other words, it is a list of
|
|
|
|
|
known requesters. The following code shows an example configuration with two requester
|
2020-05-19 11:20:29 -04:00
|
|
|
|
addresses:
|
2020-05-18 09:37:09 -04:00
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
2023-05-05 15:04:16 +03:00
|
|
|
|
{
|
2020-05-18 09:37:09 -04:00
|
|
|
|
"hooks-libraries": [
|
|
|
|
|
{
|
|
|
|
|
"library": "lib/kea/hooks/libdhcp_lease_query.so",
|
|
|
|
|
"parameters": {
|
|
|
|
|
"requesters": [ "192.0.1.1", "10.0.0.2" ]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
],
|
2023-05-05 15:04:16 +03:00
|
|
|
|
...
|
|
|
|
|
}
|
2020-06-18 16:24:05 -04:00
|
|
|
|
|
2020-06-19 09:22:04 -04:00
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
|
|
For security purposes, there is no way to specify wildcards. Each requester address
|
|
|
|
|
must be explicitly listed.
|
|
|
|
|
|
2020-06-18 16:24:05 -04:00
|
|
|
|
.. _lease-query-dhcpv6:
|
|
|
|
|
|
|
|
|
|
DHCPv6 Leasequery
|
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2021-12-02 20:54:04 +00:00
|
|
|
|
DHCPv6 simple Leasequery gives a requester the ability to query for
|
2020-06-18 16:24:05 -04:00
|
|
|
|
active lease information for either a single IP address or a single client
|
2021-11-30 22:17:48 +00:00
|
|
|
|
DUID. The query type and parameters are conveyed in an ``lq-query`` option (44)
|
|
|
|
|
attached to a ``DHCPV6_LEASEQUERY`` message:
|
2020-06-18 16:24:05 -04:00
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
- ``query-type``
|
2020-06-18 16:24:05 -04:00
|
|
|
|
|
|
|
|
|
This is either ``query-by-address`` (1) or ``query-by-clientid`` (2)
|
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
- ``link-address``
|
2020-06-18 16:24:05 -04:00
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
The global link address, when not empty, instructs the query to be
|
|
|
|
|
limited to leases within that "link." Kea uses this value to
|
2020-06-18 16:24:05 -04:00
|
|
|
|
select only leases that belong to subnets whose prefix matches
|
2021-11-30 22:17:48 +00:00
|
|
|
|
this value. Active leases for prefix delegations for
|
|
|
|
|
a matched subnet are included in the query reply, even if the
|
2020-06-18 16:24:05 -04:00
|
|
|
|
delegated prefix itself falls outside the subnet prefix.
|
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
- ``query-options``
|
2020-06-18 16:24:05 -04:00
|
|
|
|
|
|
|
|
|
A single ``iaaddr`` option (12) must be supplied when querying by address.
|
|
|
|
|
When querying by client ID, a single ``clientid`` option (1) must be
|
|
|
|
|
supplied. RFC 5007 also calls for an optional, ``oro`` option (6), to
|
2021-11-30 22:17:48 +00:00
|
|
|
|
request specific options be returned for matched leases. This is
|
2020-06-18 16:24:05 -04:00
|
|
|
|
not currently implemented.
|
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
|
|
`RFC 5007, Section 3.3 <https://tools.ietf.org/html/rfc5007#section-3.3>`__
|
2020-06-19 09:22:04 -04:00
|
|
|
|
states that querying by IP address should return either a lease (e.g.
|
|
|
|
|
binding) for the address itself or a lease for a delegated prefix that
|
2023-04-18 15:35:27 -04:00
|
|
|
|
contains the address. The latter case is not supported by releases
|
|
|
|
|
prior to Kea 2.3.7.
|
2020-06-18 16:24:05 -04:00
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
``DHCPV6_LEASEQUERY`` queries are only honored if the source address of
|
2020-06-18 16:24:05 -04:00
|
|
|
|
the query matches an entry in a list of known IP addresses which are
|
|
|
|
|
permitted to query. This list of valid requester addresses is specified
|
2021-11-30 22:17:48 +00:00
|
|
|
|
as part of the Leasequery hook library’s configuration (see the section
|
|
|
|
|
on configuration below). Queries received from unknown requesters are
|
2020-06-18 16:24:05 -04:00
|
|
|
|
logged and dropped.
|
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
In response to a valid query, the server carries out the requisite
|
|
|
|
|
activities and returns a ``DHCPV6_LEASEQUERY_REPLY``. All replies contain
|
2020-06-18 16:24:05 -04:00
|
|
|
|
at least a ``status-code`` option (13) that indicates the outcome of the query
|
|
|
|
|
as detailed in the following table:
|
|
|
|
|
|
|
|
|
|
.. tabularcolumns:: |p{0.5\linewidth}|p{0.3\linewidth}|p{0.1\linewidth}|p{0.3\linewidth}|
|
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
.. table:: DHCPV6_LEASEQUERY_REPLY status option values per query outcome
|
2020-06-18 16:24:05 -04:00
|
|
|
|
:class: longtable
|
|
|
|
|
:widths: 50 30 10 30
|
|
|
|
|
|
|
|
|
|
+--------------------------------------+-------------------------+--------+------------------------------+
|
|
|
|
|
| | Status | Status | Status |
|
|
|
|
|
| Query Outcome | Label | Code | Text |
|
|
|
|
|
+======================================+=========================+========+==============================+
|
|
|
|
|
| Invalid query type field | STATUS_UnknownQueryType | 7 | "unknown query-type" |
|
|
|
|
|
+--------------------------------------+-------------------------+--------+------------------------------+
|
|
|
|
|
| Query by IP address that does not | STATUS_Malformed | 10 | "missing D6O_IAADDR" |
|
|
|
|
|
| contain an address option | | | |
|
|
|
|
|
+--------------------------------------+-------------------------+--------+------------------------------+
|
|
|
|
|
| Query by IP address for an address | STATUS_NotConfigured | 9 | "address not in a configured |
|
|
|
|
|
| that does fall within any configured | | | pool" |
|
|
|
|
|
| pools | | | |
|
|
|
|
|
+--------------------------------------+-------------------------+--------+------------------------------+
|
|
|
|
|
| Query by IP address which found only | STATUS_Success | 0 | "inactive lease exists" |
|
|
|
|
|
| an inactive lease (e.g. expired, | | | |
|
|
|
|
|
| declined, reclaimed-expired) | | | |
|
|
|
|
|
+--------------------------------------+-------------------------+--------+------------------------------+
|
|
|
|
|
| Query by IP address that found no | STATUS_Success | 0 | "no active lease" |
|
|
|
|
|
| leases (active or otherwise) | | | |
|
|
|
|
|
+--------------------------------------+-------------------------+--------+------------------------------+
|
2021-11-30 22:17:48 +00:00
|
|
|
|
| Query by IP address that found an | STATUS_Success | 0 | "active lease found" |
|
2020-06-18 16:24:05 -04:00
|
|
|
|
| active lease for the address | | | |
|
|
|
|
|
+--------------------------------------+-------------------------+--------+------------------------------+
|
|
|
|
|
| Query by Client ID that does not | STATUS_Malformed | 10 | "missing D6O_CLIENTID" |
|
|
|
|
|
| contain a client ID option | | | |
|
|
|
|
|
+--------------------------------------+-------------------------+--------+------------------------------+
|
|
|
|
|
| Query by Client ID with a link | STATUS_NotConfigured | 9 | "not a configured link" |
|
|
|
|
|
| address that does not match any | | | |
|
|
|
|
|
| configured subnets | | | |
|
|
|
|
|
+--------------------------------------+-------------------------+--------+------------------------------+
|
2021-11-30 22:17:48 +00:00
|
|
|
|
| Query by client ID which found no | STATUS_Success | 0 | "no active leases" |
|
2020-06-18 16:24:05 -04:00
|
|
|
|
| matching leases | | | |
|
|
|
|
|
+--------------------------------------+-------------------------+--------+------------------------------+
|
2021-11-30 22:17:48 +00:00
|
|
|
|
| Query by client ID which found one | STATUS_Success | 0 | "active lease(s) found" |
|
2020-06-18 16:24:05 -04:00
|
|
|
|
| or more active leases | | | |
|
|
|
|
|
+--------------------------------------+-------------------------+--------+------------------------------+
|
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
For those scenarios where the query was either invalid or for which no matching active
|
|
|
|
|
leases were found, the ``DHCPV6_LEASEQUERY_REPLY`` only contains the ``status-code``
|
2020-06-18 16:24:05 -04:00
|
|
|
|
option (12) per the above table.
|
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
When a query finds active leases in more than one subnet and the query's ``link-address``
|
|
|
|
|
is empty, then, in addition to the status-code, the ``DHCPV6_LEASEQUERY_REPLY``
|
2023-04-07 15:12:25 +00:00
|
|
|
|
contains an ``lq-client-link`` option (48). The ``lq-client-link`` contains a list of
|
2020-06-18 16:24:05 -04:00
|
|
|
|
IPv6 addresses, one for each subnet in which a lease was found (see
|
|
|
|
|
`RFC 5007, Section 4.1.2.5 <https://tools.ietf.org/html/rfc5007#section-4.1.2.5>`__)
|
2021-11-30 22:17:48 +00:00
|
|
|
|
If, however, the query's ``link-address`` is not empty, the list of queries is
|
2020-06-18 16:24:05 -04:00
|
|
|
|
pruned to contain only leases that belong to that subnet.
|
|
|
|
|
|
|
|
|
|
When the query results in one or more active leases which all belong to a single
|
2021-11-30 22:17:48 +00:00
|
|
|
|
subnet, in addition to the ``status-code``, the ``DHCPV6_LEASEQUERY_REPLY`` contains a
|
|
|
|
|
``client-data`` option (45) (see
|
|
|
|
|
`RFC 5007, Section 4.1.2.2 <https://tools.ietf.org/html/rfc5007#section-4.1.2.2>`__).
|
|
|
|
|
The client-data option encapsulates the following options:
|
2020-06-18 16:24:05 -04:00
|
|
|
|
|
|
|
|
|
.. tabularcolumns:: |p{0.2\linewidth}|p{0.1\linewidth}|p{0.7\linewidth}|
|
|
|
|
|
|
|
|
|
|
.. table:: OPTION_CLIENT_DATA returned when active lease(s) are found
|
|
|
|
|
:class: longtable
|
|
|
|
|
:widths: 30 10 70
|
|
|
|
|
|
|
|
|
|
+------------------------------+-------+-----------------------------------------------+
|
|
|
|
|
| Option | Code | Content |
|
|
|
|
|
+==============================+=======+===============================================+
|
2021-11-30 22:17:48 +00:00
|
|
|
|
| clientid | 1 | copied from the lease (if one exists) |
|
2020-06-18 16:24:05 -04:00
|
|
|
|
+------------------------------+-------+-----------------------------------------------+
|
|
|
|
|
| clt-time | 46 | amount of time that has elapsed since the |
|
2021-11-30 22:17:48 +00:00
|
|
|
|
| | | lease's client-last-transaction-time (CLTT). |
|
2020-06-18 16:24:05 -04:00
|
|
|
|
| | | This value will also be used by the server to |
|
2021-11-30 22:17:48 +00:00
|
|
|
|
| | | adjust lifetime and timer values. |
|
2020-06-18 16:24:05 -04:00
|
|
|
|
+------------------------------+-------+-----------------------------------------------+
|
2021-11-30 22:17:48 +00:00
|
|
|
|
| iaaddr | 5 | One option per matched address. Fields in |
|
2020-06-18 16:24:05 -04:00
|
|
|
|
| | | each option: |
|
|
|
|
|
| | | - lease address |
|
2021-11-30 22:17:48 +00:00
|
|
|
|
| | | - valid lifetime reduced by CLTT |
|
|
|
|
|
| | | - preferred lifetime reduced by CLTT |
|
2020-06-18 16:24:05 -04:00
|
|
|
|
+------------------------------+-------+-----------------------------------------------+
|
2021-11-30 22:17:48 +00:00
|
|
|
|
| iaprefix | 26 | One option per matched prefix. Fields in |
|
2020-06-18 16:24:05 -04:00
|
|
|
|
| | | each option: |
|
|
|
|
|
| | | - prefix |
|
|
|
|
|
| | | - prefix length |
|
2021-11-30 22:17:48 +00:00
|
|
|
|
| | | - valid lifetime reduced by CLTT |
|
|
|
|
|
| | | - preferred lifetime reduced by CLTT |
|
2020-06-18 16:24:05 -04:00
|
|
|
|
+------------------------------+-------+-----------------------------------------------+
|
|
|
|
|
|
2020-11-14 00:00:37 +00:00
|
|
|
|
If the lease with the most recent client-last-transaction-time (CLTT)
|
|
|
|
|
value has relay information in its user-context (see
|
2021-11-30 22:17:48 +00:00
|
|
|
|
:ref:`store-extended-info-v6`), then an ``OPTION_LQ_RELAY_DATA`` option is
|
2020-06-18 16:24:05 -04:00
|
|
|
|
added to the reply (see
|
2020-06-19 14:40:02 +02:00
|
|
|
|
`RFC 5007, Section 4.1.2.4 <https://tools.ietf.org/html/rfc5007#section-4.1.2.4>`__).
|
2020-06-18 16:24:05 -04:00
|
|
|
|
|
|
|
|
|
The relay information on the lease is a list with an entry for each
|
2021-11-30 22:17:48 +00:00
|
|
|
|
relay layer the client packet (e.g. ``DHCPV6_REQUEST``) traversed, with the
|
|
|
|
|
first entry in the list being the outermost layer (closest to the server). The
|
|
|
|
|
``peer-address`` field of the ``lq-rely-option`` is set to the peer address of this
|
|
|
|
|
relay. The list of relays is then used to construct a ``DHCPV6_RELAY_FORW`` message
|
2020-06-18 16:24:05 -04:00
|
|
|
|
equivalent to that which contained the client packet, minus the client packet.
|
2021-11-30 22:17:48 +00:00
|
|
|
|
This message is stored in the ``DHCP-relay-message`` field of the ``lq-relay-data`` option.
|
2020-06-18 16:24:05 -04:00
|
|
|
|
|
|
|
|
|
.. _lease-query-dhcpv6-config:
|
|
|
|
|
|
|
|
|
|
DHCPv6 Leasequery Configuration
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2021-11-30 22:17:48 +00:00
|
|
|
|
Configuring the Leasequery hook library for use is straightforward. It
|
2020-06-18 16:24:05 -04:00
|
|
|
|
supports a single parameter, ``requesters``, which is a list of IP addresses from
|
2021-11-30 22:17:48 +00:00
|
|
|
|
which DHCPV6_LEASEQUERY packets are accepted. In other words, it is a list of
|
|
|
|
|
known requesters. The following code shows an example configuration with two requester
|
2020-06-18 16:24:05 -04:00
|
|
|
|
addresses:
|
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
2023-05-05 15:04:16 +03:00
|
|
|
|
{
|
2020-06-18 16:24:05 -04:00
|
|
|
|
"hooks-libraries": [
|
|
|
|
|
{
|
|
|
|
|
"library": "lib/kea/hooks/libdhcp_lease_query.so",
|
|
|
|
|
"parameters": {
|
2023-04-18 15:35:27 -04:00
|
|
|
|
"requesters": [ "2001:db8:1::1", "2001:db8:2::1" ],
|
|
|
|
|
"prefix-lengths": [ 72 ]
|
2020-06-18 16:24:05 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
],
|
2023-05-05 15:04:16 +03:00
|
|
|
|
...
|
|
|
|
|
}
|
2020-06-19 09:22:04 -04:00
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
|
|
For security purposes, there is no way to specify wildcards. Each requester address
|
|
|
|
|
must be explicitly listed.
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
2023-04-18 15:35:27 -04:00
|
|
|
|
When a query by IP address does not match an existing address lease,
|
2023-04-20 11:00:11 +03:00
|
|
|
|
a search for a matching delegated prefix is conducted. This is carried
|
2023-04-18 15:35:27 -04:00
|
|
|
|
out by iterating over a list of prefix lengths, in descending order,
|
|
|
|
|
extracting a prefix of that length from the query address and searching
|
|
|
|
|
for a delegation matching the resulting prefix. This continues for each
|
|
|
|
|
length in the list until a match is found or the list is exhausted.
|
|
|
|
|
|
2023-04-20 11:00:11 +03:00
|
|
|
|
By default, the list of prefix lengths to use in the search is determined
|
|
|
|
|
dynamically after (re)configuration events. This resulting list will
|
|
|
|
|
contain unique values of ``delegated-len`` gleaned from the currently
|
2023-04-18 15:35:27 -04:00
|
|
|
|
configured set of PD pools.
|
|
|
|
|
|
|
|
|
|
There is an optional parameter, ``prefix-lengths``, shown above which
|
|
|
|
|
provides the ability to explicitly configure the list rather than having
|
2023-04-20 11:00:11 +03:00
|
|
|
|
it be determined dynamically. This provides tighter control over which
|
|
|
|
|
prefix lengths are searched. In the above example, the prefix length
|
2023-04-18 15:35:27 -04:00
|
|
|
|
search will be restricted to single pass, using a length of 72, regardless
|
|
|
|
|
of whether or not there are pools using other values for ``delegated-len``.
|
|
|
|
|
Specifying an empty list, as shown below:
|
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
|
|
:
|
|
|
|
|
"prefix-lengths": [ ]
|
|
|
|
|
:
|
|
|
|
|
|
|
|
|
|
disables the search for delegated prefixes for query by IP address.
|
|
|
|
|
|
2023-02-07 11:32:32 +01:00
|
|
|
|
.. _bulk-lease-query-dhcpv4:
|
|
|
|
|
|
|
|
|
|
DHCPv4 Bulk Leasequery
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
DHCPv4 Bulk Leasequery gives a requester the ability to query for
|
|
|
|
|
active lease information over a TCP connection. This allows the server
|
2023-04-07 15:12:25 +00:00
|
|
|
|
to return all leases matching a given query.
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
Two of the query types identified by RFC 4388 - Query by MAC address and
|
|
|
|
|
Query by Client-identifier - are Bulk Leasequery types specified by RFC
|
|
|
|
|
6926. That RFC also defines these new Bulk Leasequery types:
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
- Query by Relay Identifier
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
The query carries an RAI (dhcp-agent-options (82)) option with
|
2023-02-07 11:32:32 +01:00
|
|
|
|
a relay-id (12) sub-option.
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
- Query by Remote ID
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
The query carries an RAI (dhcp-agent-options (82) option) with
|
2023-02-07 11:32:32 +01:00
|
|
|
|
a remote-id (2) sub-option.
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
- Query for All Configured IP Addresses
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
|
|
|
|
This query type is selected when no other query type is specified.
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
RFC 6926 also defines new options for Bulk Leasequery:
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
|
|
|
|
- status-code (151)
|
|
|
|
|
|
2023-02-08 16:35:31 +01:00
|
|
|
|
This reply option carries a status code such as MalformedQuery or
|
2023-04-07 15:12:25 +00:00
|
|
|
|
NotAllowed, with an optional text message.
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
|
|
|
|
- base-time (152)
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
This reply option carries the absolute current time that the response
|
2023-02-08 16:35:31 +01:00
|
|
|
|
was created. All other time-based reply options are related to
|
|
|
|
|
this value.
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
|
|
|
|
- start-time-of-state (153)
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
This reply option carries the time of the lease's transition into its
|
2023-02-07 11:32:32 +01:00
|
|
|
|
current state.
|
|
|
|
|
|
|
|
|
|
- query-start-time (154)
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
This query option specifies a start query time; replies will only
|
2023-02-08 16:35:31 +01:00
|
|
|
|
contain leases that are older than this value.
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
|
|
|
|
- query-end-time (155)
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
This query option specifies an end query time; replies will only
|
|
|
|
|
contain leases that are newer than this value.
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
|
|
|
|
- dhcp-state (156)
|
|
|
|
|
|
2023-02-08 16:35:31 +01:00
|
|
|
|
This reply option carries the lease state.
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
|
|
|
|
- data-source (157)
|
|
|
|
|
|
2023-02-08 16:35:31 +01:00
|
|
|
|
This reply option carries the source of the data as a remote flag.
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
2023-02-08 16:35:31 +01:00
|
|
|
|
RFC 6926 reuses and extends the Virtual Subnet Selection option (221)
|
|
|
|
|
defined in RFC 6607.
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
Kea does not yet support querying for all configured IP addresses,
|
|
|
|
|
so the dhcp-state option cannot be used, as only active leases can be
|
|
|
|
|
returned in replies. Kea does not keep the start time of the lease's state,
|
|
|
|
|
nor the local/remote information, so it cannot emit the corresponding
|
2023-02-07 11:32:32 +01:00
|
|
|
|
start-time-of-state and data-source options. Kea does not support VPNs
|
2023-04-07 15:12:25 +00:00
|
|
|
|
so the presence of option 221 in the query is considered a
|
2023-02-07 11:32:32 +01:00
|
|
|
|
(NotAllowed) error.
|
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
The new query types are only supported with the memfile lease backend.
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
2022-11-19 16:03:17 +01:00
|
|
|
|
.. _bulk-lease-query-dhcpv6:
|
|
|
|
|
|
|
|
|
|
DHCPv6 Bulk Leasequery
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
DHCPv6 Bulk Leasequery gives a requester the ability to query for
|
|
|
|
|
active lease information over a TCP connection. This allows the server
|
2022-11-22 17:13:27 +01:00
|
|
|
|
to return all active leases matching a query.
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
|
|
|
|
New query types are available: ``query-by-relay-id`` (3),
|
2023-04-07 15:12:25 +00:00
|
|
|
|
``query-by-link-address`` (4), and ``query-by-remote-id`` (5).
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
A new status code, ``STATUS_QueryTerminated`` (11), has been defined but it is
|
2022-11-19 16:03:17 +01:00
|
|
|
|
not yet used by the hook library.
|
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
2023-01-11 15:36:24 -05:00
|
|
|
|
Kea attempts to map link address parameters to the prefixes of configured
|
2023-04-07 15:12:25 +00:00
|
|
|
|
subnets. If a given address falls outside all configured subnet prefixes,
|
2023-04-19 17:58:06 +03:00
|
|
|
|
the query fails with a status code of ``STATUS_NotConfigured``. If
|
2023-01-12 07:48:05 -05:00
|
|
|
|
the link address parameter for ``query-by-relay-id`` or ``query-by-remote-id``
|
2023-04-07 15:12:25 +00:00
|
|
|
|
is not ``::`` (i.e. not empty), only delegated prefixes that lie within matching
|
|
|
|
|
subnet prefixes are returned. Currently, ``query-by-address`` does not
|
2023-01-12 07:48:05 -05:00
|
|
|
|
support finding delegated prefixes by specifying an address that lies within
|
|
|
|
|
the prefix.
|
2023-01-11 14:08:13 -05:00
|
|
|
|
|
|
|
|
|
.. note::
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
The new query types are only supported with the memfile lease backend.
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
|
|
|
|
.. _bulk-lease-query-dhcpv6-config:
|
|
|
|
|
|
|
|
|
|
Bulk Leasequery Configuration
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
Bulk Leasequery configuration is done via a new map parameter, ``advanced``,
|
|
|
|
|
with these possible entries:
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
|
|
|
|
- ``bulk-query-enabled``
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
When ``true``, Kea accepts connections from IP addresses in the requesters
|
|
|
|
|
list and processes received Bulk Leasequeries. The default is ``false``.
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
|
|
|
|
- ``active-query-enabled``
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
This is an anticipated parameter: if set, it must be ``false``.
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
2022-11-21 20:33:29 +01:00
|
|
|
|
- ``extended-info-tables-enabled``
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
When ``true``, the lease backend manages DHCPv6 lease extended info
|
|
|
|
|
(relay info) in tables to support the new DHCPv6 Bulk Leasequery
|
|
|
|
|
by-relay-id and by-remote-id types. The default is to use the
|
2023-02-07 11:32:32 +01:00
|
|
|
|
same value as ``bulk-query-enabled``.
|
2022-11-21 20:33:29 +01:00
|
|
|
|
|
2022-11-19 16:03:17 +01:00
|
|
|
|
- ``lease-query-ip``
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
This is the IP address upon which to listen for connections. The address must be
|
2022-11-19 16:03:17 +01:00
|
|
|
|
of the same family as the server, e.g. IPv6 for DHCPv6 server.
|
|
|
|
|
|
|
|
|
|
- ``lease-query-port``
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
This is the port upon which to listen. The default is 67 for IPv4 and 547 for IPv6,
|
2022-11-19 16:03:17 +01:00
|
|
|
|
i.e. the same value as for the UDP DHCP service but for TCP.
|
|
|
|
|
|
2022-12-07 23:39:44 +01:00
|
|
|
|
- ``max-bulk-query-threads``
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
This indicates the maximum number of threads that Bulk Leasequery processing
|
2022-12-07 23:39:44 +01:00
|
|
|
|
should use. A value of 0 instructs the server to use the same number of
|
|
|
|
|
threads that the Kea core is using for DHCP multi-threading.
|
|
|
|
|
The default is 0.
|
|
|
|
|
|
2022-11-19 16:03:17 +01:00
|
|
|
|
- ``max-requester-connections``
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
This is the maximum number of concurrent requester connections. The default
|
|
|
|
|
is 10; the value must be greater than 0.
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
|
|
|
|
- ``max-concurrent-queries``
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
This is the maximum number of concurrent queries per connection. The value 0
|
|
|
|
|
allows Kea to determine the number, and is the default.
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
|
|
|
|
- ``max-requester-idle-time``
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
This is the amount of time that may elapse after receiving data from a requester
|
|
|
|
|
before its connection is closed as idle, in seconds. The default
|
|
|
|
|
is 300.
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
|
|
|
|
- ``max-leases-per-fetch``
|
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
This is the maximum number of leases to return in a single fetch. The default is 100.
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
Once TLS is supported, we expect to implement common TLS parameters.
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
|
For instance, for DHCPv4:
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
2023-05-05 15:04:16 +03:00
|
|
|
|
{
|
2023-02-07 11:32:32 +01:00
|
|
|
|
"hooks-libraries": [
|
|
|
|
|
{
|
|
|
|
|
"library": "lib/kea/hooks/libdhcp_lease_query.so",
|
|
|
|
|
"parameters": {
|
|
|
|
|
"requesters": [ "192.0.2.1", "192.0.2.2" ],
|
|
|
|
|
"advanced" : {
|
|
|
|
|
"bulk-query-enabled": true,
|
|
|
|
|
"active-query-enabled": false,
|
|
|
|
|
|
|
|
|
|
"lease-query-ip": "127.0.0.1",
|
|
|
|
|
"lease-query-tcp-port": 67,
|
|
|
|
|
|
|
|
|
|
"max-bulk-query-threads": 0,
|
|
|
|
|
"max-requester-connections": 10,
|
|
|
|
|
"max-concurrent-queries": 4,
|
|
|
|
|
"max-requester-idle-time": 300,
|
|
|
|
|
"max-leases-per-fetch": 100
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
],
|
2023-05-05 15:04:16 +03:00
|
|
|
|
...
|
|
|
|
|
}
|
2023-02-07 11:32:32 +01:00
|
|
|
|
|
|
|
|
|
or for DHCPv6:
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
2023-05-05 15:04:16 +03:00
|
|
|
|
{
|
2022-11-19 16:03:17 +01:00
|
|
|
|
"hooks-libraries": [
|
|
|
|
|
{
|
|
|
|
|
"library": "lib/kea/hooks/libdhcp_lease_query.so",
|
|
|
|
|
"parameters": {
|
|
|
|
|
"requesters": [ "2001:db8:1::1", "2001:db8:2::1" ],
|
|
|
|
|
"advanced" : {
|
2022-12-07 23:39:44 +01:00
|
|
|
|
"bulk-query-enabled": true,
|
|
|
|
|
"active-query-enabled": false,
|
2022-11-19 16:03:17 +01:00
|
|
|
|
|
2022-11-21 20:33:29 +01:00
|
|
|
|
"extended-info-tables-enabled": true,
|
|
|
|
|
|
2022-11-19 16:03:17 +01:00
|
|
|
|
"lease-query-ip": "::1",
|
|
|
|
|
"lease-query-tcp-port": 547,
|
|
|
|
|
|
2022-12-07 23:39:44 +01:00
|
|
|
|
"max-bulk-query-threads": 0,
|
|
|
|
|
"max-requester-connections": 10,
|
2022-11-19 16:03:17 +01:00
|
|
|
|
"max-concurrent-queries": 4,
|
2022-12-07 23:39:44 +01:00
|
|
|
|
"max-requester-idle-time": 300,
|
|
|
|
|
"max-leases-per-fetch": 100
|
2022-11-19 16:03:17 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
],
|
2023-05-05 15:04:16 +03:00
|
|
|
|
...
|
|
|
|
|
}
|