2019-06-06 18:25:46 +02:00
|
|
|
.. _ctrl-channel:
|
|
|
|
|
|
|
|
**************
|
|
|
|
Management API
|
|
|
|
**************
|
|
|
|
|
|
|
|
A classic approach to daemon configuration assumes that the server's
|
|
|
|
configuration is stored in configuration files and, when the
|
|
|
|
configuration is changed, the daemon is restarted. This approach has the
|
|
|
|
significant disadvantage of introducing periods of downtime when client
|
|
|
|
traffic is not handled. Another risk is that if the new configuration is
|
|
|
|
invalid for any reason, the server may refuse to start, which will
|
|
|
|
further extend the downtime period until the issue is resolved.
|
|
|
|
|
2019-06-28 17:57:37 -04:00
|
|
|
To avoid such problems, the DHCPv4, DHCPv6, and D2 servers in Kea include
|
2019-06-06 18:25:46 +02:00
|
|
|
support for a mechanism that allows online reconfiguration without
|
|
|
|
requiring server shutdown. Both servers can be instructed to open
|
|
|
|
control sockets, which is a communications channel. The server is able
|
|
|
|
to receive commands on that channel, act on them, and report back
|
|
|
|
status.
|
|
|
|
|
2019-06-28 17:57:37 -04:00
|
|
|
The DHCPv4, DHCPv6, and D2 servers receive commands over the UNIX domain
|
|
|
|
sockets. For details on how to configure these sockets, see
|
2024-07-30 14:38:46 +02:00
|
|
|
:ref:`dhcp4-unix-ctrl-channel`, :ref:`dhcp6-unix-ctrl-channel` and
|
|
|
|
:ref:`d2-unix-ctrl-channel`. While
|
2019-06-28 17:57:37 -04:00
|
|
|
it is possible to control the servers directly using UNIX domain sockets,
|
|
|
|
that requires that the controlling client be running on the same machine
|
2019-06-06 18:25:46 +02:00
|
|
|
as the server. SSH is usually used to connect remotely to the controlled
|
|
|
|
machine.
|
|
|
|
|
|
|
|
Network administrators usually prefer using some form of a RESTful API
|
|
|
|
to control the servers, rather than using UNIX domain sockets directly.
|
2021-12-03 22:54:13 +00:00
|
|
|
Therefore, Kea includes a component called the Control Agent (CA), which
|
2019-06-06 18:25:46 +02:00
|
|
|
exposes a RESTful API to the controlling clients and can forward
|
|
|
|
commands to the respective Kea services over the UNIX domain sockets.
|
2019-06-28 17:57:37 -04:00
|
|
|
The CA configuration is described in
|
|
|
|
:ref:`agent-configuration`.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
The HTTP requests received by the CA contain the control commands
|
|
|
|
encapsulated within HTTP requests. Simply speaking, the CA is
|
|
|
|
responsible for stripping the HTTP layer from the received commands and
|
|
|
|
forwarding the commands in a JSON format over the UNIX domain sockets to
|
|
|
|
the respective services. Because the CA receives commands for all
|
|
|
|
services, it requires additional "forwarding" information to be included
|
|
|
|
in the client's messages. This forwarding information is carried within
|
|
|
|
the ``service`` parameter of the received command. If the ``service``
|
|
|
|
parameter is not included, or if the parameter is a blank list, the CA
|
2021-12-03 22:54:13 +00:00
|
|
|
assumes that the control command is targeted at the CA itself and
|
|
|
|
attempts to respond.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
Control connections over both HTTP and UNIX domain sockets are guarded
|
2021-12-03 22:54:13 +00:00
|
|
|
with timeouts. The timeout value is set to 10 seconds and is not
|
2019-06-06 18:25:46 +02:00
|
|
|
configurable.
|
|
|
|
|
2020-04-24 12:24:56 +02:00
|
|
|
This API can be used by external tools to manage and monitor Kea operation.
|
2021-12-03 22:54:13 +00:00
|
|
|
An example of such a monitoring tool is ISC's Stork. For details, see
|
2020-04-24 12:24:56 +02:00
|
|
|
:ref:`stork`.
|
|
|
|
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _ctrl-channel-syntax:
|
|
|
|
|
|
|
|
Data Syntax
|
|
|
|
===========
|
|
|
|
|
|
|
|
Communication over the control channel is conducted using JSON
|
2021-12-03 22:54:13 +00:00
|
|
|
structures. If configured, Kea opens a socket and listens for
|
2019-06-06 18:25:46 +02:00
|
|
|
incoming connections. A process connecting to this socket is expected to
|
|
|
|
send JSON commands structured as follows:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "foo",
|
2023-05-05 15:04:16 +03:00
|
|
|
"service": [ "dhcp4" ],
|
2019-06-06 18:25:46 +02:00
|
|
|
"arguments": {
|
|
|
|
"param1": "value1",
|
|
|
|
"param2": "value2",
|
|
|
|
...
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The same command sent over the RESTful interface to the CA has the
|
2019-06-06 18:25:46 +02:00
|
|
|
following structure:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
POST / HTTP/1.1\r\n
|
|
|
|
Content-Type: application/json\r\n
|
|
|
|
Content-Length: 147\r\n\r\n
|
|
|
|
{
|
|
|
|
"command": "foo",
|
2023-05-05 15:04:16 +03:00
|
|
|
"service": [ "dhcp4" ],
|
2019-06-06 18:25:46 +02:00
|
|
|
"arguments": {
|
|
|
|
"param1": "value1",
|
|
|
|
"param2": "value2",
|
|
|
|
...
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-10 22:35:25 +03:00
|
|
|
The ``command`` parameter contains the name of the command to execute and it
|
|
|
|
is mandatory.
|
|
|
|
The ``arguments`` map contains the parameters required to carry out the
|
2023-05-12 12:44:25 +03:00
|
|
|
given command. The exact content and format of the map are command-specific.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-05-12 14:30:47 +03:00
|
|
|
The ``service`` list contains the servers at which the control command is
|
2019-06-06 18:25:46 +02:00
|
|
|
targeted. In the example above, the control command is targeted at the
|
2021-12-03 22:54:13 +00:00
|
|
|
DHCPv4 server. In most cases, the CA simply forwards this command to
|
2019-06-06 18:25:46 +02:00
|
|
|
the DHCPv4 server for processing via a UNIX domain socket. Sometimes,
|
|
|
|
the command including a service value may also be processed by the CA,
|
2021-12-03 22:54:13 +00:00
|
|
|
if the CA is running a hook library which handles such a command for
|
|
|
|
the given server. As an example, the hook library loaded by the CA may
|
2019-06-06 18:25:46 +02:00
|
|
|
perform some operations on the database, such as adding host
|
|
|
|
reservations, modifying leases, etc. An advantage of performing
|
|
|
|
DHCPv4-specific administrative operations in the CA, rather than
|
|
|
|
forwarding it to the DHCPv4 server, is the ability to perform these
|
|
|
|
operations without disrupting the DHCPv4 service, since the DHCPv4
|
2021-12-03 22:54:13 +00:00
|
|
|
server does not have to stop processing DHCP messages to apply changes to
|
|
|
|
the database. Nevertheless, these situations are rather rare; in
|
2019-06-06 18:25:46 +02:00
|
|
|
most cases, when the ``service`` parameter contains a name of the
|
2021-12-03 22:54:13 +00:00
|
|
|
service, the commands are simply forwarded by the CA. The forwarded
|
|
|
|
command includes the ``service`` parameter, but this parameter is ignored
|
2019-06-06 18:25:46 +02:00
|
|
|
by the receiving server. This parameter is only meaningful to the CA.
|
|
|
|
|
|
|
|
If the command received by the CA does not include a ``service``
|
|
|
|
parameter or this list is empty, the CA simply processes this message on
|
2023-06-06 13:43:28 +03:00
|
|
|
its own. For example, a :isccmd:`config-get` command which includes no service
|
|
|
|
parameter returns the Control Agent's own configuration. The :isccmd:`config-get`
|
2023-05-12 14:30:47 +03:00
|
|
|
command with a service value "dhcp4" is forwarded to the DHCPv4 server and
|
|
|
|
returns the DHCPv4 server's configuration.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
The following list shows the mapping of the values carried within the
|
|
|
|
``service`` parameter to the servers to which the commands are
|
|
|
|
forwarded:
|
|
|
|
|
2023-06-06 13:43:11 +03:00
|
|
|
- ``dhcp4`` - the command is forwarded to the :iscman:`kea-dhcp4` server.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:11 +03:00
|
|
|
- ``dhcp6`` - the command is forwarded to the :iscman:`kea-dhcp6` server.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:11 +03:00
|
|
|
- ``d2`` - the command is forwarded to the :iscman:`kea-dhcp-ddns` server.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The server processing the incoming command sends a response of the
|
2019-06-06 18:25:46 +02:00
|
|
|
form:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
2023-05-05 15:04:16 +03:00
|
|
|
"result": 0, // 0|1|2|3|4
|
2019-06-06 18:25:46 +02:00
|
|
|
"text": "textual description",
|
|
|
|
"arguments": {
|
|
|
|
"argument1": "value1",
|
|
|
|
"argument2": "value2",
|
|
|
|
...
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
The ``result`` value is a status code indicating a result of the command. The
|
2022-09-12 13:05:36 +02:00
|
|
|
following general status codes are currently supported:
|
|
|
|
|
|
|
|
- ``0`` - the command has been processed successfully.
|
|
|
|
- ``1`` - a general error or failure has occurred during the command processing.
|
2023-04-07 15:12:25 +00:00
|
|
|
- ``2`` - the specified command is unsupported by the server receiving it.
|
2022-09-12 13:05:36 +02:00
|
|
|
- ``3`` - the requested operation has been completed but the requested
|
|
|
|
resource was not found. This status code is returned when a command
|
|
|
|
returns no resources or affects no resources.
|
|
|
|
- ``4`` - the well-formed command has been processed but the requested
|
2023-04-07 15:12:25 +00:00
|
|
|
changes could not be applied, because they were in conflict with the
|
2022-09-12 13:05:36 +02:00
|
|
|
server state or its notion of the configuration.
|
|
|
|
|
|
|
|
For example, a well-formed command that requests a subnet that exists
|
|
|
|
in a server's configuration returns the result 0. If the server encounters
|
2023-04-07 15:12:25 +00:00
|
|
|
an error condition, it returns 1. If the command asks for an IPv6 subnet,
|
2019-06-06 18:25:46 +02:00
|
|
|
but was sent to a DHCPv4 server, it returns 2. If the query asks for a
|
2023-04-07 15:12:25 +00:00
|
|
|
subnet with ``subnet-id`` that has matches, the result is 3.
|
2022-09-12 13:05:36 +02:00
|
|
|
If the command attempts to update a lease but the specified ``subnet-id``
|
|
|
|
does not match the identifier in the server's configuration, the result
|
|
|
|
is 4.
|
|
|
|
|
2023-04-07 15:12:25 +00:00
|
|
|
Hook libraries can sometimes return additional status codes specific
|
2022-09-12 13:05:36 +02:00
|
|
|
to their use cases.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
The ``text`` field typically appears when the result is non-zero and
|
|
|
|
contains a description of the error encountered, but it often also
|
|
|
|
appears for successful outcomes. The exact text is command-specific, but
|
|
|
|
in general uses plain English to describe the outcome of the command.
|
2023-05-12 14:30:47 +03:00
|
|
|
The ``arguments`` map contains additional data values returned by the server
|
|
|
|
which are specific to the command issued. The map may be present, but that
|
|
|
|
depends on the specific command.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2021-04-22 18:50:59 +02:00
|
|
|
.. note::
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
Since Kea 1.9.7, it is possible to put comments in commands as
|
|
|
|
in the configuration file. For instance:
|
2021-04-23 14:44:56 +02:00
|
|
|
|
|
|
|
::
|
|
|
|
|
2021-04-23 17:15:05 +02:00
|
|
|
{
|
|
|
|
"command": "foo",
|
|
|
|
// service is a list
|
2023-05-05 15:04:16 +03:00
|
|
|
"service": [ "dhcp4" ],
|
2021-04-23 17:15:05 +02:00
|
|
|
# command arguments are here.
|
|
|
|
"arguments": {
|
2023-05-05 15:04:16 +03:00
|
|
|
"param1": "value1",
|
|
|
|
...
|
|
|
|
/*
|
2021-04-23 17:15:05 +02:00
|
|
|
"param2": "value2",
|
2023-05-05 15:04:16 +03:00
|
|
|
...
|
|
|
|
*/
|
2021-04-23 14:44:56 +02:00
|
|
|
}
|
2021-04-23 17:15:05 +02:00
|
|
|
}
|
2021-04-22 18:50:59 +02:00
|
|
|
|
2024-11-18 17:03:08 +01:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
Since Kea 2.7.5 it is possible to specify extra HTTP headers which
|
2024-11-22 11:24:15 +01:00
|
|
|
are added to HTTP responses. Each header is specified by its name
|
|
|
|
and value with optionally a user context. For instance:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
2024-11-22 15:50:06 +01:00
|
|
|
{
|
|
|
|
"http-headers": [
|
|
|
|
{
|
|
|
|
"name": "Strict-Transport-Security",
|
|
|
|
"value": "max-age=31536000"
|
|
|
|
}
|
|
|
|
],
|
2024-11-22 11:24:15 +01:00
|
|
|
...
|
2024-11-22 15:50:06 +01:00
|
|
|
}
|
2024-11-22 11:24:15 +01:00
|
|
|
|
|
|
|
adds a HSTS header declaring that HTTPS (vs HTTP) must be used for one year.
|
2024-11-18 17:03:08 +01:00
|
|
|
|
2022-07-21 14:12:35 -04:00
|
|
|
.. _ctrl-channel-control-agent-command-response-format:
|
|
|
|
|
|
|
|
Control Agent Command Response Format
|
|
|
|
=====================================
|
|
|
|
|
|
|
|
When sending commands via the Control Agent, it is possible to specify
|
|
|
|
multiple services at which the command is targeted. CA forwards this
|
|
|
|
command to each service individually. Thus, the CA response to the
|
|
|
|
controlling client is always wrapped in an array (JSON list) of
|
|
|
|
individual responses. For example, the response for a command sent
|
|
|
|
to one service would be structured as follows:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
[
|
|
|
|
{
|
2023-05-05 15:04:16 +03:00
|
|
|
"result": 0, // 0|1|2|3|4
|
2022-07-21 14:12:35 -04:00
|
|
|
"text": "textual description",
|
|
|
|
"arguments": {
|
|
|
|
"argument1": "value1",
|
2022-07-22 06:45:56 -04:00
|
|
|
"argument2": "value2",
|
2023-05-05 15:04:16 +03:00
|
|
|
...
|
|
|
|
}
|
2022-07-21 14:12:35 -04:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
If the command is sent to more than one service, the array would
|
|
|
|
contain responses from each service, in the order they were requested:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
[
|
|
|
|
{
|
2023-05-05 15:04:16 +03:00
|
|
|
"result": 0, // 0|1|2|3|4
|
2022-07-21 14:12:35 -04:00
|
|
|
"text": "textual description",
|
|
|
|
"arguments": {
|
|
|
|
"argument1": "value1",
|
2022-07-22 06:45:56 -04:00
|
|
|
"argument2": "value2",
|
2023-05-05 15:04:16 +03:00
|
|
|
...
|
|
|
|
}
|
2022-07-21 14:12:35 -04:00
|
|
|
},
|
|
|
|
{
|
2023-05-05 15:04:16 +03:00
|
|
|
"result": 0, // 0|1|2|3|4
|
2022-07-21 14:12:35 -04:00
|
|
|
"text": "textual description",
|
|
|
|
"arguments": {
|
|
|
|
"argument1": "value1",
|
2022-07-22 06:45:56 -04:00
|
|
|
"argument2": "value2",
|
2023-05-05 15:04:16 +03:00
|
|
|
...
|
|
|
|
}
|
2022-07-21 14:12:35 -04:00
|
|
|
},
|
|
|
|
...
|
|
|
|
]
|
|
|
|
|
|
|
|
An exception to this are authentication or authorization errors which cause CA
|
2023-03-29 20:03:04 +00:00
|
|
|
to reject the command entirely. The response to such an error is formatted
|
2022-07-21 14:12:35 -04:00
|
|
|
as a single entry (JSON map) as follows:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"result": 403,
|
|
|
|
"text": "Forbidden"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
These types of errors are possible on systems configured for either basic
|
2024-07-23 19:46:54 +02:00
|
|
|
authentication or agents that load :ischooklib:`libdhcp_rbac.so`.
|
2022-07-21 14:12:35 -04:00
|
|
|
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _ctrl-channel-client:
|
|
|
|
|
|
|
|
Using the Control Channel
|
|
|
|
=========================
|
|
|
|
|
|
|
|
The easiest way to start interacting with the control API is to use
|
|
|
|
common UNIX/Linux tools such as ``socat`` and ``curl``.
|
|
|
|
|
2019-06-28 17:57:37 -04:00
|
|
|
In order to control the given Kea service via a UNIX domain socket, use
|
2019-06-06 18:25:46 +02:00
|
|
|
``socat`` in interactive mode as follows:
|
|
|
|
|
2019-07-15 08:32:02 +02:00
|
|
|
.. code-block:: console
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
$ socat UNIX:/path/to/the/kea/socket -
|
|
|
|
|
|
|
|
or in batch mode, include the "ignoreeof" option as shown below to
|
2019-06-28 17:57:37 -04:00
|
|
|
ensure ``socat`` waits long enough for the server to respond:
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2019-07-15 08:32:02 +02:00
|
|
|
.. code-block:: console
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
$ echo "{ some command...}" | socat UNIX:/path/to/the/kea/socket -,ignoreeof
|
|
|
|
|
|
|
|
where ``/path/to/the/kea/socket`` is the path specified in the
|
|
|
|
``Dhcp4/control-socket/socket-name`` parameter in the Kea configuration
|
|
|
|
file. Text passed to ``socat`` is sent to Kea and the responses received
|
|
|
|
from Kea are printed to standard output. This approach communicates with
|
|
|
|
the specific server directly and bypasses the Control Agent.
|
|
|
|
|
|
|
|
It is also easy to open a UNIX socket programmatically. An example of a
|
|
|
|
simple client written in C is available in the Kea Developer's Guide, in
|
2019-06-28 17:57:37 -04:00
|
|
|
the Control Channel Overview chapter, in the
|
2021-07-28 14:36:24 +02:00
|
|
|
`Using Control Channel <https://reports.kea.isc.org/dev_guide/d2/d96/ctrlSocket.html#ctrlSocketClient>`__
|
2019-06-06 18:25:46 +02:00
|
|
|
section.
|
|
|
|
|
2019-06-28 17:57:37 -04:00
|
|
|
To use Kea's RESTful API with ``curl``, use the following:
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2019-07-15 08:32:02 +02:00
|
|
|
.. code-block:: console
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
$ curl -X POST -H "Content-Type: application/json" -d '{ "command": "config-get", "service": [ "dhcp4" ] }' http://ca.example.org:8000/
|
|
|
|
|
|
|
|
This assumes that the Control Agent is running on host
|
|
|
|
``ca.example.org`` and is running the RESTful service on port 8000.
|
|
|
|
|
|
|
|
.. _commands-common:
|
|
|
|
|
|
|
|
Commands Supported by Both the DHCPv4 and DHCPv6 Servers
|
|
|
|
========================================================
|
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: build-report
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _command-build-report:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``build-report`` Command
|
|
|
|
----------------------------
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`build-report` command returns on the control channel what the
|
2019-06-06 18:25:46 +02:00
|
|
|
command line ``-W`` argument displays, i.e. the embedded content of the
|
|
|
|
``config.report`` file. This command does not take any parameters.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "build-report"
|
|
|
|
}
|
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: config-get
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _command-config-get:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``config-get`` Command
|
|
|
|
--------------------------
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`config-get` command retrieves the current configuration used by the
|
2019-06-06 18:25:46 +02:00
|
|
|
server. This command does not take any parameters. The configuration
|
|
|
|
returned is roughly equal to the configuration that was loaded using the
|
2021-12-03 22:54:13 +00:00
|
|
|
``-c`` command-line option during server start-up, or was later set using the
|
2023-06-06 13:43:28 +03:00
|
|
|
:isccmd:`config-set` command. However, there may be certain differences, as
|
2019-06-06 18:25:46 +02:00
|
|
|
comments are not retained. If the original configuration used file
|
2023-03-29 20:03:04 +00:00
|
|
|
inclusion, the returned configuration includes all parameters from
|
2024-05-16 20:09:54 +00:00
|
|
|
all included files. In Kea 2.4.0 and later, the successful response also
|
|
|
|
contains a SHA-256 digest that can be used to easily determine whether a
|
|
|
|
configuration has changed.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2021-12-07 21:02:34 +00:00
|
|
|
.. warning::
|
|
|
|
|
|
|
|
The returned configuration is not redacted, i.e. it
|
|
|
|
contains database passwords in plain text, if those were specified in the
|
|
|
|
original configuration. Care should be taken not to expose the command
|
|
|
|
channel to unprivileged users.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
An example command invocation looks like this:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "config-get"
|
|
|
|
}
|
|
|
|
|
2023-06-05 17:15:59 +02:00
|
|
|
.. isccmd:: config-hash-get
|
|
|
|
.. _command-config-hash-get:
|
|
|
|
|
|
|
|
The ``config-hash-get`` Command
|
|
|
|
-------------------------------
|
|
|
|
|
|
|
|
The ``config-hash-get`` command retrieves the SHA-256 hash of the current
|
|
|
|
configuration used by the server. This command does not take any parameters.
|
|
|
|
The returned hash can be used to detect configuration changes.
|
|
|
|
|
|
|
|
An example command invocation looks like this:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "config-hash-get"
|
|
|
|
}
|
|
|
|
|
|
|
|
And the server's response:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"result": 0,
|
|
|
|
"arguments": {
|
|
|
|
"hash": "5C3C90EF7035249E2FF74D003C19F34EE0B83A3D329E741B52B2EF95A2C9CC5C"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-16 20:09:54 +00:00
|
|
|
In Kea 2.4.0 and later, ``config-set`` and ``config-get`` also return the SHA-256 hash
|
|
|
|
of the new or current configuration. This may be used to determine whether a configuration
|
|
|
|
has changed.
|
2023-06-21 22:37:05 +02:00
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: config-reload
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _command-config-reload:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``config-reload`` Command
|
|
|
|
-----------------------------
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`config-reload` command instructs Kea to load again the
|
2019-06-06 18:25:46 +02:00
|
|
|
configuration file that was used previously. This operation is useful if
|
|
|
|
the configuration file has been changed by some external source; for
|
2021-12-03 22:54:13 +00:00
|
|
|
example, a system administrator can tweak the configuration file and use this
|
2024-05-16 20:09:54 +00:00
|
|
|
command to force Kea to pick up the changes.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2024-05-16 20:09:54 +00:00
|
|
|
Care should be taken when using this in conjunction with the :isccmd:`config-set` command. Kea
|
2019-06-06 18:25:46 +02:00
|
|
|
remembers the location of the configuration file it was started with,
|
2023-06-06 13:43:28 +03:00
|
|
|
and this configuration can be significantly changed using the :isccmd:`config-set`
|
|
|
|
command. When :isccmd:`config-reload` is issued after :isccmd:`config-set`, Kea attempts
|
2019-06-06 18:25:46 +02:00
|
|
|
to reload its original configuration from the file, possibly losing all
|
2023-06-06 13:43:28 +03:00
|
|
|
changes introduced using :isccmd:`config-set` or other commands.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`config-reload` command does not take any parameters. An example command
|
2019-06-06 18:25:46 +02:00
|
|
|
invocation looks like this:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "config-reload"
|
|
|
|
}
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
If the configuration file is incorrect, reloading it can raise an error
|
|
|
|
which leaves the server in an unusable state. See :ref:`command-config-set`
|
|
|
|
to learn how to recover from a non-working server.
|
2020-07-21 18:05:50 +02:00
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: config-test
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _command-config-test:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``config-test`` Command
|
|
|
|
---------------------------
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`config-test` command instructs the server to check whether the new
|
2019-06-06 18:25:46 +02:00
|
|
|
configuration supplied in the command's arguments can be loaded. The
|
|
|
|
supplied configuration is expected to be the full configuration for the
|
2021-12-08 16:23:55 +00:00
|
|
|
target server, along with an optional logger configuration. The configuration
|
|
|
|
is sanity-checked to the extent possible without the server actually
|
|
|
|
attempting to load it; it is possible for a configuration which successfully
|
2023-06-06 13:43:28 +03:00
|
|
|
passes this command to still fail in the :isccmd:`config-set` command or at launch
|
2021-12-08 16:23:55 +00:00
|
|
|
time. The structure of the command is as follows:
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "config-test",
|
|
|
|
"arguments": {
|
|
|
|
"<server>": {
|
|
|
|
}
|
2023-03-17 12:45:18 +02:00
|
|
|
}
|
2019-06-06 18:25:46 +02:00
|
|
|
}
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
where <server> is the configuration element name for a given server, such
|
2019-06-06 18:25:46 +02:00
|
|
|
as "Dhcp4" or "Dhcp6". For example:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "config-test",
|
|
|
|
"arguments": {
|
|
|
|
"Dhcp6": {
|
2023-05-05 15:04:16 +03:00
|
|
|
...
|
2019-06-06 18:25:46 +02:00
|
|
|
}
|
2023-03-17 12:45:18 +02:00
|
|
|
}
|
2019-06-06 18:25:46 +02:00
|
|
|
}
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The server's response contains a numeric code, ``result`` (0 for
|
|
|
|
success, non-zero on failure), and a string, ``text``, describing the
|
2019-06-06 18:25:46 +02:00
|
|
|
outcome:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{"result": 0, "text": "Configuration seems sane..." }
|
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
{"result": 1, "text": "unsupported parameter: BOGUS (<string>:16:26)" }
|
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: config-write
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _command-config-write:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``config-write`` Command
|
|
|
|
----------------------------
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`config-write` command instructs the Kea server to write its current
|
2019-06-28 17:57:37 -04:00
|
|
|
configuration to a file on disk. It takes one optional argument, called
|
|
|
|
"filename", that specifies the name of the file to write the
|
2019-06-06 18:25:46 +02:00
|
|
|
configuration to. If not specified, the name used when starting Kea
|
2021-12-03 22:54:13 +00:00
|
|
|
(passed as a ``-c`` argument) is used. If a relative path is specified,
|
|
|
|
Kea writes its files only in the directory where it is running.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
An example command invocation looks like this:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "config-write",
|
|
|
|
"arguments": {
|
|
|
|
"filename": "config-modified-2017-03-15.json"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: leases-reclaim
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _command-leases-reclaim:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``leases-reclaim`` Command
|
|
|
|
------------------------------
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`leases-reclaim` command instructs the server to reclaim all expired
|
2019-06-06 18:25:46 +02:00
|
|
|
leases immediately. The command has the following JSON syntax:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "leases-reclaim",
|
|
|
|
"arguments": {
|
|
|
|
"remove": true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-28 17:57:37 -04:00
|
|
|
The ``remove`` boolean parameter is mandatory and indicates whether the
|
2021-12-03 22:54:13 +00:00
|
|
|
reclaimed leases should be removed from the lease database (if ``true``), or
|
|
|
|
left in the ``expired-reclaimed`` state (if ``false``). The latter facilitates
|
|
|
|
lease affinity, i.e. the ability to re-assign an expired lease to a
|
2021-12-07 21:02:34 +00:00
|
|
|
returning client that previously used that lease. See :ref:`lease-affinity`
|
2021-12-03 22:54:13 +00:00
|
|
|
for details. Also, see :ref:`lease-reclamation` for general
|
2019-06-28 17:57:37 -04:00
|
|
|
information about the processing of expired leases (lease reclamation).
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: list-commands
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _command-list-commands:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``list-commands`` Command
|
|
|
|
-----------------------------
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`list-commands` command retrieves a list of all commands supported
|
2019-06-06 18:25:46 +02:00
|
|
|
by the server. It does not take any arguments. An example command may
|
|
|
|
look like this:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "list-commands",
|
|
|
|
"arguments": { }
|
|
|
|
}
|
|
|
|
|
|
|
|
The server responds with a list of all supported commands. The arguments
|
|
|
|
element is a list of strings, each of which conveys one supported
|
|
|
|
command.
|
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: config-set
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _command-config-set:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``config-set`` Command
|
|
|
|
--------------------------
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`config-set` command instructs the server to replace its current
|
2019-06-06 18:25:46 +02:00
|
|
|
configuration with the new configuration supplied in the command's
|
|
|
|
arguments. The supplied configuration is expected to be the full
|
2021-12-03 22:54:13 +00:00
|
|
|
configuration for the target server, along with an optional logger
|
|
|
|
configuration. While optional, the logger configuration is highly
|
|
|
|
recommended, as without it the server reverts to its default logging
|
2019-06-06 18:25:46 +02:00
|
|
|
configuration. The structure of the command is as follows:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "config-set",
|
|
|
|
"arguments": {
|
|
|
|
"<server>": {
|
|
|
|
}
|
2023-03-17 12:45:18 +02:00
|
|
|
}
|
2019-06-06 18:25:46 +02:00
|
|
|
}
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
where <server> is the configuration element name for a given server, such
|
2019-06-06 18:25:46 +02:00
|
|
|
as "Dhcp4" or "Dhcp6". For example:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "config-set",
|
|
|
|
"arguments": {
|
|
|
|
"Dhcp6": {
|
2023-05-05 15:04:16 +03:00
|
|
|
...
|
2019-06-06 18:25:46 +02:00
|
|
|
}
|
2023-03-17 12:45:18 +02:00
|
|
|
}
|
2019-06-06 18:25:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
If the new configuration proves to be invalid, the server retains its
|
2021-12-03 22:54:13 +00:00
|
|
|
current configuration; however, in some cases a fatal error message is logged
|
2023-04-19 17:58:06 +03:00
|
|
|
indicating that the server is no longer providing any service: a working
|
2020-07-21 18:05:50 +02:00
|
|
|
configuration must be loaded as soon as possible. If the control channel
|
2021-12-03 22:54:13 +00:00
|
|
|
is dead, the configuration file can still be reloaded using the ``SIGHUP``
|
|
|
|
signal. If that is unsuccessful, restart the server.
|
2020-07-21 18:05:50 +02:00
|
|
|
|
|
|
|
Please note that the new configuration is
|
2019-06-06 18:25:46 +02:00
|
|
|
retained in memory only; if the server is restarted or a configuration
|
|
|
|
reload is triggered via a signal, the server uses the configuration
|
|
|
|
stored in its configuration file. The server's response contains a
|
2021-12-03 22:54:13 +00:00
|
|
|
numeric code, ``result`` (0 for success, non-zero on failure), and a
|
|
|
|
string, ``text``, describing the outcome:
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{"result": 0, "text": "Configuration successful." }
|
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
{"result": 1, "text": "unsupported parameter: BOGUS (<string>:16:26)" }
|
|
|
|
|
2024-05-16 20:09:54 +00:00
|
|
|
In Kea 2.4.0 and later, the successful response from a DHCPv4, DHCPv6, or DHCP-DDNS daemon
|
|
|
|
also contains a SHA-256 digest of the newly set configuration. The digest can be used to easily
|
|
|
|
determine whether a configuration has changed.
|
2023-06-21 22:37:05 +02:00
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: shutdown
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _command-shutdown:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``shutdown`` Command
|
|
|
|
------------------------
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`shutdown` command instructs the server to initiate its shutdown
|
2024-05-16 20:09:54 +00:00
|
|
|
procedure; it is the equivalent of sending a ``SIGTERM`` signal to the
|
2019-06-06 18:25:46 +02:00
|
|
|
process. This command does not take any arguments. An example command
|
|
|
|
may look like this:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
2023-05-05 15:04:16 +03:00
|
|
|
"command": "shutdown",
|
2020-03-02 09:32:17 -05:00
|
|
|
"arguments": {
|
|
|
|
"exit-value": 3
|
|
|
|
}
|
2019-06-06 18:25:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
The server responds with a confirmation that the shutdown procedure has
|
2021-12-03 22:54:13 +00:00
|
|
|
been initiated. The optional parameter, ``exit-value``, specifies the
|
|
|
|
numeric value with which the server process exits to the system.
|
2020-03-03 11:54:16 -05:00
|
|
|
The default value is zero.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The DDNS daemon supports an extra parameter, ``type``, which controls the way
|
2020-08-19 12:39:53 +03:00
|
|
|
the process cleans up on exit. The supported shutdown types are:
|
2020-08-19 12:35:46 +03:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
- "normal" - stops the queue manager and finishes all current transactions
|
2020-08-19 12:35:46 +03:00
|
|
|
before exiting. This is the default.
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
- "drain_first" - stops the queue manager but continues processing requests
|
2020-08-19 12:35:46 +03:00
|
|
|
from the queue until it is empty.
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
- "now" - exits immediately.
|
2020-08-19 12:35:46 +03:00
|
|
|
|
|
|
|
An example command may look like this:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
2023-05-05 15:04:16 +03:00
|
|
|
"command": "shutdown",
|
2020-08-19 12:35:46 +03:00
|
|
|
"arguments": {
|
|
|
|
"exit-value": 3,
|
|
|
|
"type": "drain_first"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: dhcp-disable
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _command-dhcp-disable:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``dhcp-disable`` Command
|
|
|
|
----------------------------
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`dhcp-disable` command globally disables the DHCP service. The
|
2019-06-06 18:25:46 +02:00
|
|
|
server continues to operate, but it drops all received DHCP messages.
|
|
|
|
This command is useful when the server's maintenance requires that the
|
|
|
|
server temporarily stop allocating new leases and renew existing leases.
|
|
|
|
It is also useful in failover-like configurations during a
|
|
|
|
synchronization of the lease databases at startup, or recovery after a
|
2021-12-03 22:54:13 +00:00
|
|
|
failure. The optional parameter ``max-period`` specifies the time in
|
2019-06-06 18:25:46 +02:00
|
|
|
seconds after which the DHCP service should be automatically re-enabled,
|
2023-06-06 13:43:28 +03:00
|
|
|
if the :isccmd:`dhcp-enable` command is not sent before this time elapses.
|
2021-01-22 17:19:42 +02:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
Since Kea 1.9.4, there is an additional ``origin`` parameter that specifies the
|
2021-01-22 15:29:40 +02:00
|
|
|
command source. A server administrator should typically omit this parameter
|
|
|
|
because the default value "user" indicates that the administrator sent the
|
2024-05-16 20:09:54 +00:00
|
|
|
command. In Kea 2.5.5 through 2.5.7, this parameter was also used in communication
|
2024-04-26 12:59:09 +02:00
|
|
|
between the HA partners to specify the identifier of an HA service sending the command
|
2024-05-16 20:09:54 +00:00
|
|
|
in a numeric format. However, due to compatibility issues with older
|
|
|
|
Kea versions that did not properly parse numeric values, it was necessary
|
2024-04-26 12:59:09 +02:00
|
|
|
to introduce the new parameter, ``origin-id``, in Kea 2.5.8.
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2024-04-26 12:59:09 +02:00
|
|
|
It holds a numeric value representing the origin of the command. The same value
|
|
|
|
can still be passed using the ``origin`` parameter, but it can cause the
|
2024-05-16 20:09:54 +00:00
|
|
|
aforementioned compatibility issues between HA partners running different
|
|
|
|
Kea versions; if both are used, ``origin-id`` takes precedence. New Kea versions
|
|
|
|
favor using ``origin-id`` in communication between the HA partners, but
|
|
|
|
overall, it is recommended that both parameters be
|
|
|
|
omitted and the default value used.
|
2024-04-26 12:59:09 +02:00
|
|
|
|
|
|
|
The following codes represent the supported origins in numeric format:
|
|
|
|
|
2024-05-16 20:09:54 +00:00
|
|
|
- ``1`` - a user command; the same as specifying ``"origin": "user"``.
|
|
|
|
- ``2000``, ``2001``, ``2002``, etc. - origins specified by HA partners where
|
2024-04-26 12:59:09 +02:00
|
|
|
the increments above ``2000`` are distinct HA service identifiers used when
|
|
|
|
the partners have many relationships.
|
|
|
|
|
|
|
|
In the following example:
|
2024-04-24 21:04:18 +02:00
|
|
|
|
2021-01-20 17:16:38 +02:00
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "dhcp-disable",
|
|
|
|
"arguments": {
|
|
|
|
"max-period": 20,
|
2024-04-24 21:04:18 +02:00
|
|
|
"origin-id": 2002,
|
2021-01-20 17:16:38 +02:00
|
|
|
"origin": "user"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-16 20:09:54 +00:00
|
|
|
the effective origin is ``2002``, which indicates it is an HA partner
|
2024-04-26 12:59:09 +02:00
|
|
|
sending the command for the service with ID of ``2``. The ``origin``
|
|
|
|
parameter will be ignored in this case.
|
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: dhcp-enable
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _command-dhcp-enable:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``dhcp-enable`` Command
|
|
|
|
---------------------------
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`dhcp-enable` command globally enables the DHCP service.
|
2021-01-22 17:27:13 +02:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
Since Kea 1.9.4, there is an additional ``origin`` parameter that specifies the
|
2021-01-22 17:27:13 +02:00
|
|
|
command source. A server administrator should typically omit this parameter
|
|
|
|
because the default value "user" indicates that the administrator sent the
|
2024-05-16 20:09:54 +00:00
|
|
|
command. In Kea 2.5.5 through 2.5.7, this parameter was also used in communication
|
2024-04-26 12:59:09 +02:00
|
|
|
between the HA partners to specify the identifier of an HA service sending the command
|
2024-05-16 20:09:54 +00:00
|
|
|
in a numeric format. However, due to compatibility issues with older
|
|
|
|
Kea versions that did not properly parse numeric values, it was necessary
|
2024-04-26 12:59:09 +02:00
|
|
|
to introduce the new parameter, ``origin-id``, in Kea 2.5.8.
|
|
|
|
|
|
|
|
It holds a numeric value representing the origin of the command. The same value
|
|
|
|
can still be passed using the ``origin`` parameter, but it can cause the
|
2024-05-16 20:09:54 +00:00
|
|
|
aforementioned compatibility issues between HA partners running different
|
|
|
|
Kea versions.; if both are used, ``origin-id`` takes precedence. New Kea versions
|
|
|
|
favor using ``origin-id`` in communication between the HA partners, but
|
|
|
|
overall, it is recommended that both
|
2024-04-26 12:59:09 +02:00
|
|
|
|
|
|
|
The following codes represent the supported origins in numeric format:
|
|
|
|
|
2024-05-16 20:09:54 +00:00
|
|
|
- ``1`` - a user command; the same as specifying ``"origin": "user"``.
|
|
|
|
- ``2000``, ``2001``, ``2002``, etc. - origins specified by HA partners where
|
2024-04-26 12:59:09 +02:00
|
|
|
the increments above ``2000`` are distinct HA service identifiers used when
|
|
|
|
the partners have many relationships.
|
|
|
|
|
|
|
|
In the following example:
|
2024-04-24 21:04:18 +02:00
|
|
|
|
2021-01-20 17:16:38 +02:00
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "dhcp-enable",
|
|
|
|
"arguments": {
|
2024-04-26 12:59:09 +02:00
|
|
|
"origin-id": 2002,
|
2021-01-20 17:16:38 +02:00
|
|
|
"origin": "user"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-16 20:09:54 +00:00
|
|
|
the effective origin is ``2002``, which indicates it is an HA partner
|
2024-04-26 12:59:09 +02:00
|
|
|
sending the command for the service with ID of ``2``. The ``origin``
|
|
|
|
parameter will be ignored in this case.
|
|
|
|
|
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: status-get
|
2019-12-06 13:09:20 +01:00
|
|
|
.. _command-status-get:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``status-get`` Command
|
|
|
|
--------------------------
|
2019-12-06 13:09:20 +01:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`status-get` command returns the server's runtime information:
|
2019-12-11 19:34:32 +01:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
- ``pid``: the process ID.
|
2019-12-11 19:34:32 +01:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
- ``uptime``: the number of seconds since the start of the server.
|
2019-12-11 19:34:32 +01:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
- ``reload``: the number of seconds since the last configuration (re)load.
|
2019-12-11 19:34:32 +01:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
- ``high-availability``: HA-specific status information about the DHCP servers
|
|
|
|
configured to use the HA hook library:
|
2019-12-11 20:35:36 +01:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
* ``local``: the state, the role (primary,
|
|
|
|
secondary, ...), and the scopes (i.e. what the server is actually
|
|
|
|
processing) of the local server.
|
2019-12-11 20:35:36 +01:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
* ``remote``: the remote server's last known state, its served
|
|
|
|
HA scopes, and the role of the remote server in the HA relationship.
|
2019-12-11 20:35:36 +01:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
- ``multi-threading-enabled``: a flag indicating whether multi-threading is enabled.
|
2020-08-18 21:47:18 +03:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
- ``thread-pool-size``: the number of DHCP service threads.
|
2020-08-18 21:47:18 +03:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
- ``packet-queue-size``: the maximum size of the packet queue. There is one queue,
|
|
|
|
regardless of the number of running threads.
|
2020-10-02 15:58:50 +02:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
- ``packet-queue-statistics``: the average queue size for the last 10, 100, and 1000
|
|
|
|
packets, using an approach similar to the UNIX ``top`` command.
|
|
|
|
The average queue size for the last 10 packets can be considered an
|
2021-06-09 09:49:22 +00:00
|
|
|
instantaneous value, while the average for the last 1000 packets shows
|
2021-12-03 22:54:13 +00:00
|
|
|
a longer-term trend.
|
2020-08-18 21:47:18 +03:00
|
|
|
|
|
|
|
The ``high-availability`` information is returned only when the command is
|
2021-12-03 22:54:13 +00:00
|
|
|
sent to the DHCP servers in an HA setup. This parameter is
|
2023-06-06 13:43:28 +03:00
|
|
|
never returned when the :isccmd:`status-get` command is sent to the
|
2020-11-14 00:00:37 +00:00
|
|
|
Control Agent or DDNS daemon.
|
2019-12-13 16:03:05 +01:00
|
|
|
|
2022-01-10 16:25:40 +01:00
|
|
|
The ``thread-pool-size``, ``packet-queue-size`` and
|
|
|
|
``packet-queue-statistics`` parameters are returned only when the
|
|
|
|
command is sent to DHCP servers with multi-threading enabled. These
|
|
|
|
three parameters and ``multi-threading-enabled`` are never returned when
|
2023-06-06 13:43:28 +03:00
|
|
|
the :isccmd:`status-get` command is sent to the Control Agent or DDNS daemon.
|
2020-08-18 21:47:18 +03:00
|
|
|
|
2019-12-13 16:03:05 +01:00
|
|
|
To learn more about the HA status information returned by the
|
2023-06-06 13:43:28 +03:00
|
|
|
:isccmd:`status-get` command, please refer to the :ref:`command-ha-status-get`
|
2019-12-13 16:03:05 +01:00
|
|
|
section.
|
2019-12-11 20:35:36 +01:00
|
|
|
|
2019-12-06 13:09:20 +01:00
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: server-tag-get
|
2019-10-07 01:51:06 +02:00
|
|
|
.. _command-server-tag-get:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``server-tag-get`` Command:
|
|
|
|
-------------------------------
|
2019-10-07 01:51:06 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`server-tag-get` command returns the configured server tag of
|
2021-12-03 22:54:13 +00:00
|
|
|
the DHCPv4 or DHCPv6 server (:ref:`cb-sharing` explains the server tag concept).
|
2019-10-07 01:51:06 +02:00
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: config-backend-pull
|
2019-10-25 18:15:42 +02:00
|
|
|
.. _command-config-backend-pull:
|
2019-10-07 01:51:06 +02:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``config-backend-pull`` Command:
|
|
|
|
------------------------------------
|
2019-10-07 01:51:06 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`config-backend-pull` command triggers the polling of configuration backends
|
2021-12-03 22:54:13 +00:00
|
|
|
(which must be configured for this command to have an effect),
|
2019-10-07 01:51:06 +02:00
|
|
|
explained in :ref:`dhcp4-cb-json`.
|
|
|
|
|
2023-06-06 13:33:44 +03:00
|
|
|
.. isccmd:: version-get
|
2019-06-06 18:25:46 +02:00
|
|
|
.. _command-version-get:
|
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The ``version-get`` Command
|
2021-12-03 22:58:44 +00:00
|
|
|
---------------------------
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
The :isccmd:`version-get` command returns extended information about the Kea
|
2024-05-16 20:09:54 +00:00
|
|
|
version; it is the same information available via the ``-V``
|
2019-06-06 18:25:46 +02:00
|
|
|
command-line argument. This command does not take any parameters.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
{
|
|
|
|
"command": "version-get"
|
|
|
|
}
|
|
|
|
|
2024-06-13 21:50:09 +02:00
|
|
|
Commands Supported by the DHCPv4 Server
|
|
|
|
=======================================
|
|
|
|
|
2024-10-21 15:13:59 -04:00
|
|
|
.. isccmd:: subnet4-select-test
|
|
|
|
.. _command-subnet4-select-test:
|
2024-06-13 21:50:09 +02:00
|
|
|
|
2024-10-21 15:13:59 -04:00
|
|
|
The ``subnet4-select-test`` Command
|
|
|
|
-----------------------------------
|
2024-06-13 21:50:09 +02:00
|
|
|
|
2024-10-21 15:56:21 -04:00
|
|
|
The :isccmd:`subnet4-select-test` provides a way to test DHCPv4 subnet selection based
|
2024-10-20 13:42:01 +02:00
|
|
|
on a set of input parameters typically supplied in a client packet.
|
|
|
|
Recognized parameters take strings and are:
|
2024-06-14 10:12:57 +02:00
|
|
|
|
|
|
|
- ``interface`` - the incoming interface name
|
|
|
|
- ``address`` - the client address
|
|
|
|
- ``relay`` - the relay/gateway address
|
|
|
|
- ``local`` - the local/destination address
|
|
|
|
- ``remote`` - the remote/source address
|
|
|
|
- ``link`` - the RAI link-selection address
|
|
|
|
- ``subnet`` - the subnet-selection address
|
|
|
|
- ``classes`` - (list of strings) client classes (allowing to select a guarded subnet)
|
|
|
|
|
|
|
|
The RAI link-selection is ignored when the ``ignore-rai-link-selection``
|
|
|
|
compatibility flag is ``true``. When it is not ignored it has precedence
|
|
|
|
over the subnet-selection.
|
|
|
|
|
|
|
|
Outside of errors possible results are:
|
|
|
|
|
|
|
|
- (empty) "no selected subnet"
|
|
|
|
- "selected shared network '<name>' starting with subnet '<subnet>' id <id>"
|
|
|
|
- "selected subnet '<subnet>' id <id>"
|
2024-06-13 21:50:09 +02:00
|
|
|
|
2024-10-21 15:13:59 -04:00
|
|
|
.. isccmd:: subnet4o6-select-test
|
|
|
|
.. _command-subnet4o6-select-test:
|
2024-06-13 21:50:09 +02:00
|
|
|
|
2024-10-21 15:13:59 -04:00
|
|
|
The ``subnet4o6-select-test`` Command
|
|
|
|
-------------------------------------
|
2024-06-13 21:50:09 +02:00
|
|
|
|
2024-10-21 15:13:59 -04:00
|
|
|
The :isccmd:`subnet4o6-select-test` provides a way to test DHCPv4-over-DHCPv6 subnet
|
2024-10-21 15:56:21 -04:00
|
|
|
selection based on a set of input parameters typically supplied in a client
|
2024-10-20 13:42:01 +02:00
|
|
|
packet. Recognized parameters take strings and are:
|
2024-06-14 10:12:57 +02:00
|
|
|
|
|
|
|
- ``interface`` - the incoming interface name of the DHCPv6 server
|
|
|
|
- ``interface-id`` - the binary content of the interface-id relay option
|
|
|
|
- ``address`` - the client address
|
|
|
|
- ``relay`` - the relay/gateway address
|
|
|
|
- ``local`` - the local/destination address
|
|
|
|
- ``remote`` - the remote/source IPv6 address of the DHCPv6 server
|
|
|
|
- ``link`` - the first relay link IPv6 address
|
|
|
|
- ``subnet`` - the subnet-selection address
|
|
|
|
- ``classes`` - (list of strings) client classes (allowing to select a guarded subnet)
|
|
|
|
|
|
|
|
According to the code only ``remote``, ``interface-id`` and ``interface``
|
2024-10-23 14:41:58 +03:00
|
|
|
selectors are used. In DHCPv4-over-DHCPv6 implementation ``interface`` and
|
2024-06-14 10:12:57 +02:00
|
|
|
``remote`` values are transmitted from the DHCPv6 server, ``interface-id``
|
|
|
|
and ``link`` are carried in the relay info part of the DHCPv6 packet so
|
|
|
|
are the same as for the DHCPv6 server.
|
|
|
|
|
|
|
|
Outside of errors possible results are:
|
|
|
|
|
|
|
|
- (empty) "no selected subnet"
|
|
|
|
- "selected shared network '<name>' starting with subnet '<subnet>' id <id>"
|
|
|
|
- "selected subnet '<subnet>' id <id>"
|
2024-06-13 21:50:09 +02:00
|
|
|
|
|
|
|
Commands Supported by the DHCPv6 Server
|
|
|
|
=======================================
|
|
|
|
|
2024-10-21 15:13:59 -04:00
|
|
|
.. isccmd:: subnet6-select-test
|
|
|
|
.. _command-subnet6-select-test:
|
2024-06-13 21:50:09 +02:00
|
|
|
|
2024-10-21 15:13:59 -04:00
|
|
|
The ``subnet6-select-test`` Command
|
|
|
|
-----------------------------------
|
2024-06-13 21:50:09 +02:00
|
|
|
|
2024-10-21 15:56:21 -04:00
|
|
|
The :isccmd:`subnet6-select-test` provides a way to test DHCPv6 subnet selection based
|
2024-10-20 13:42:01 +02:00
|
|
|
on a set of input parameters typically supplied in a client packet.
|
|
|
|
Recognized parameters take strings and are:
|
2024-06-14 10:12:57 +02:00
|
|
|
|
|
|
|
- ``interface`` - the incoming interface name
|
|
|
|
- ``interface-id`` - the binary content of the interface-id relay option
|
|
|
|
- ``remote`` - the remote/source address
|
|
|
|
- ``link`` - the first relay link address
|
|
|
|
- ``classes`` - (list of strings) client classes (allowing to select a guarded subnet)
|
|
|
|
|
|
|
|
Outside of errors possible results are:
|
|
|
|
|
|
|
|
- (empty) "no selected subnet"
|
|
|
|
- "selected shared network '<name>' starting with subnet '<subnet>' id <id>"
|
|
|
|
- "selected subnet '<subnet>' id <id>"
|
2024-06-13 21:50:09 +02:00
|
|
|
|
2019-06-28 17:57:37 -04:00
|
|
|
Commands Supported by the D2 Server
|
|
|
|
===================================
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The D2 server supports only a subset of the DHCPv4/DHCPv6 server commands:
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`build-report`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`config-get`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-05 17:15:59 +02:00
|
|
|
- :isccmd:`config-hash-get`
|
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`config-reload`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`config-set`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`config-test`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`config-write`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`list-commands`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`shutdown`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`status-get`
|
2019-12-12 15:22:56 +01:00
|
|
|
|
2024-06-14 10:12:57 +02:00
|
|
|
- :isccmd:`version-get`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
.. _agent-commands:
|
|
|
|
|
2019-06-28 17:57:37 -04:00
|
|
|
Commands Supported by the Control Agent
|
|
|
|
=======================================
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2021-12-03 22:54:13 +00:00
|
|
|
The following commands, listed in :ref:`commands-common`, are also supported by the
|
|
|
|
Control Agent; when the ``service`` parameter is blank, the
|
2019-06-06 18:25:46 +02:00
|
|
|
commands are handled by the CA and they relate to the CA process itself:
|
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`build-report`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`config-get`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-05 17:15:59 +02:00
|
|
|
- :isccmd:`config-hash-get`
|
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`config-reload`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`config-set`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`config-test`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`config-write`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`list-commands`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`shutdown`
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`status-get`
|
2019-12-12 15:22:56 +01:00
|
|
|
|
2023-06-06 13:43:28 +03:00
|
|
|
- :isccmd:`version-get`
|
2024-07-30 14:38:46 +02:00
|
|
|
|
|
|
|
.. _ctrl-channel-migration:
|
|
|
|
|
|
|
|
Migration from the Control Agent
|
|
|
|
================================
|
|
|
|
|
|
|
|
Since Kea version 2.7.2 DHCP servers support HTTP/HTTPS control channels
|
|
|
|
so the Control Agent (CA) is no longer needed.
|
|
|
|
|
|
|
|
The DHCPv4, DHCPv6, and D2 servers extend the ``control-socket`` entry
|
|
|
|
to ``control-sockets`` list. To migrate a CA configuration add an element
|
|
|
|
to this list with:
|
|
|
|
|
|
|
|
- ``socket-type`` set to ``http`` or ``https``
|
|
|
|
|
|
|
|
- ``socket-address`` with the content of CA ``http-host``
|
|
|
|
|
|
|
|
- ``socket-port`` with the content of CA ``http-port``
|
|
|
|
|
|
|
|
- ``trust-anchor`` (unchanged)
|
|
|
|
|
|
|
|
- ``cert-file`` (unchanged)
|
|
|
|
|
|
|
|
- ``key-file`` (unchanged)
|
|
|
|
|
|
|
|
- ``cert-required`` (unchanged)
|
|
|
|
|
|
|
|
- ``authentication`` (unchanged)
|
|
|
|
|
|
|
|
User context is supported too. Please look at respective HTTP control socket
|
|
|
|
sections for defaults and other details (beware that two servers must use
|
|
|
|
different address / port pairs): :ref:`dhcp4-http-ctrl-channel`,
|
|
|
|
:ref:`dhcp6-http-ctrl-channel` and :ref:`d2-http-ctrl-channel`
|
|
|
|
|
|
|
|
For compatibility the JSON result of these HTTP/HTTPS control sockets is
|
|
|
|
still encapsulated into a list.
|