Installation and Configuration
Created: 2025-11-10 Mon 08:01
| Lease Commands | High Availability | Statistics Commands |
| BOOTP | DDNS Tuning | Leasequery |
| Limits | Run Script | User Check |
| Flexible Identifier | Flexible Option | Forensic Logging |
| Host Cache | Host Commands | RADIUS support |
| Subnet Commands | GSS-TSIG (Microsoft AD dynamic DNS Updates) | MySQL Configuration Backend |
| PostgreSQL Database Backend | PerfMon | Ping Check |
| Statistics Commands | Class Commands |
{
"Dhcp4": {
"interfaces-config": {
"interfaces": [ "eth0" ]
},
"control-socket": {
"socket-type": "unix",
"socket-name": "kea-dhcp4.socket"
},
[...]
// ) is ignored./* and */ is
ignored. This commenting can span multiple lines.<?include "file.json"?>.ESC-X json-mode<enter>CTRL+c-CTRL+fvim, syntax highlighting for JSON can be enabled in the
command mode with: set syntax=json
/etc/kea/
/usr/local/etc/kea on
FreeBSDkea-ctrl-agent.conf - Kea control agentkea-dhcp-ddns.conf - Kea dynamic DNS updaterkea-dhcp4.conf - Kea DHCPv4 serverkea-dhcp6.conf - Kea DHCPv6 serverkeactrl.conf - configuration file for keactrl script (not in
JSON format)
{
"Dhcp4": {
"interfaces-config": {
"interfaces": [ "eth0" ]
},
"control-socket": {
"socket-type": "unix",
"socket-name": "kea-dhcp4.socket"
},
[...]
[...]
"lease-database": {
"type": "memfile",
"lfc-interval": 3600
},
[...]
[...]
"renew-timer": 900,
"rebind-timer": 1800,
"valid-lifetime": 3600,
[...]
routers)
[...]
"subnet4": [
{
"subnet": "192.0.2.0/24",
"ID": 1000,
"pools": [ { "pool": "192.0.2.100 - 192.0.2.200" } ],
"option-data": [
{
"name": "routers",
"data": "192.0.2.1"
}
]
}
]
},
[...]
[...]
"loggers": [
{
"name": "kea-dhcp4",
"output_options": [
{
"output": "/var/log/kea/kea-dhcp4.log"
}
],
"severity": "INFO",
"debuglevel": 0
}
]
}
-t (test) parameter# kea-dhcp4 -t /etc/kea/kea-dhcp4.conf Syntax check failed with: /etc/kea/kea-dhcp4.conf:33.9: syntax error, unexpected }
# kea-dhcp4 -t /etc/kea/kea-dhcp4.conf
INFO [kea-dhcp4.dhcpsrv/51] DHCPSRV_CFGMGR_ADD_IFACE listening on interface server-eth0
INFO [kea-dhcp4.dhcpsrv/51] DHCPSRV_CFGMGR_SOCKET_TYPE_DEFAULT "dhcp-socket-type" not specified,
using default socket type raw
INFO [kea-dhcp4.dhcpsrv/51] DHCPSRV_CFGMGR_NEW_SUBNET4 a new subnet has been added to configuration:
192.0.2.0/24 with params: t1=900, t2=1800, valid-lifetime=3600
# systemctl start kea-dhcp4
# systemctl status kea-dhcp4
● kea-dhcp4.service - Kea DHCPv4 Server
Loaded: loaded (/usr/lib/systemd/system/kea-dhcp4.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2018-12-06 10:13:26 UTC; 4s ago
Docs: man:kea-dhcp4(8)
Main PID: 63 (kea-dhcp4)
Tasks: 1 (limit: 1144)
Memory: 1.9M
CGroup: /machine.slice/libpod-2e3e4a67333cf94630baa9c268ae84f8e77353abf14b074ed2ef9d73bc6e4f53.scope/system.slice/kea-dhcp4.service
└─63 /usr/sbin/kea-dhcp4 -c /etc/kea/kea-dhcp4.conf
Dec 06 10:13:26 2e3e4a67333c systemd[1]: Started Kea DHCPv4 Server.
Dec 06 10:13:26 2e3e4a67333c kea-dhcp4[63]: 2018-12-06 10:13:26.674 INFO [kea-dhcp4.dhcp4/63] DHCP4_STARTING Kea DHCPv4 server version 1.3.0 starting
Dec 06 10:13:26 2e3e4a67333c kea-dhcp4[63]: 2018-12-06 10:13:26.676 INFO [kea-dhcp4.dhcpsrv/63] DHCPSRV_CFGMGR_ADD_IFACE listening on interface server-eth0
Dec 06 10:13:26 2e3e4a67333c kea-dhcp4[63]: 2018-12-06 10:13:26.676 INFO [kea-dhcp4.dhcpsrv/63] DHCPSRV_CFGMGR_SOCKET_TYPE_DEFAULT "dhcp-socket-type" not specified , using default socke>
Dec 06 10:13:26 2e3e4a67333c kea-dhcp4[63]: 2018-12-06 10:13:26.677 INFO [kea-dhcp4.dhcpsrv/63] DHCPSRV_CFGMGR_NEW_SUBNET4 a new subnet has been added to configuration: 192.0.2.0/24 wit>
Dec 06 10:13:26 2e3e4a67333c kea-dhcp4[63]: 2018-12-06 10:13:26.677 INFO [kea-dhcp4.dhcp4/63] DHCP4_CONFIG_COMPLETE DHCPv4 server has completed configuration: added IPv4 subnets: 1; DDN>
Dec 06 10:13:26 2e3e4a67333c kea-dhcp4[63]: 2018-12-06 10:13:26.677 INFO [kea-dhcp4.dhcpsrv/63] DHCPSRV_MEMFILE_DB opening memory file lease database: lfc-interval=3600 type=memfile uni>
Dec 06 10:13:26 2e3e4a67333c kea-dhcp4[63]: 2018-12-06 10:13:26.679 INFO [kea-dhcp4.dhcpsrv/63] DHCPSRV_MEMFILE_LEASE_FILE_LOAD loading leases from file /var/lib/kea/kea-leases4.csv
Dec 06 10:13:26 2e3e4a67333c kea-dhcp4[63]: 2018-12-06 10:13:26.680 INFO [kea-dhcp4.dhcpsrv/63] DHCPSRV_MEMFILE_LFC_SETUP setting up the Lease File Cleanup interval to 3600 sec
dhclient
Create a new shell script in /usr/local/sbin/dhclient-debug.sh
with the lines below
#!/bin/sh env
Execute the dhclient tool with this script
dhclient -sf /usr/local/sbin/dhclient-debug.sh
perfdhcpkea-ctrl-agent is deprecated. As of Kea 2.7.2 the Kea
servers: kea-dhcp4, kea-dhcp6, and kea-dhcp-ddns directly
support command API connections over HTTPS/HTTP.127.0.0.1 Port 8000
kea-ctrl-agent.confjq can be used to pretty print the output
# kea-shell --service dhcp4 --host 127.0.0.1 --port 8000 version-get | jq
[
{
"arguments": {
"extended": "1.7.10-git\ngit 9bade6ae294f570976e7614e84a76a34ac4915b1\nlinked with:\nlog4cplus 1.2.2\nLibreSSL 3.2.1\ndatabase:\nPostgreSQL backend 6.1, library 120003\
nMemfile backend 2.1"
},
"result": 0,
"text": "1.7.10-git"
}
]
curl toolconfig-get command to the DHCPv4 server
[kea-server]# curl -X POST -H "Content-Type: application/json" \
-d '{ "command": "config-get", "service": [ "dhcp4" ] }' \
http://127.0.0.1:8000/
jq can be used to
pretty-print the output
[kea-server]# curl -X POST -H "Content-Type: application/json" \
-d '{ "command": "config-get", "service": [ "dhcp4" ] }' \
http://127.0.0.1:8000/ | jq
jq can be used to filter specific parts of the configuration. The
jq filter ".[0].arguments" can be used to produce a valid Kea
configuration file.
[kea-server]# curl -X POST -H "Content-Type: application/json" \
-d '{ "command": "config-get", "service": [ "dhcp4" ] }' \
http://127.0.0.1:8000/ | jq ".[0].arguments.Dhcp4.loggers"
Result:
[
{
"debuglevel": 0,
"name": "kea-dhcp4",
"output_options": [
{
"output": "/opt/kea/var/log/kea-dhcp4.log"
}
],
"severity": "INFO"
}
]
list-commands command returns the API commands available for
a specific Kea module
[kea-server]# curl -X POST -H "Content-Type: application/json" \
-d '{ "command": "list-commands", "service": [ "dhcp4" ] }' \
http://127.0.0.1:8000/ | jq
curl -s -X POST -H "Content-Type: application/json" \
-d '{ "command": "config-get", "service": [ "dhcp4" ] }' \
http://127.0.0.1:8000/ | jq ".[0]" > kea-dhcp4.tmp
command and service informationresult from the JSON file
{
"command": "config-set",
"service": [ "dhcp4" ],
"arguments": {
"Logging": {
"loggers": [
{
"severity": "INFO",
"output_options": [
[...]
[kea-server]# curl -s -X POST -H "Content-Type: application/json" \
-d @kea-dhcp4.tmp http://127.0.0.1:8000/ | jq
[
{
"result": 0,
"text": "Configuration successful."
}
]
config-write command (be careful, any
comments in the file will be gone and the formatting will be
different)
[kea-server]# curl -s -X POST -H "Content-Type: application/json" \
-d '{ "command": "config-write", "arguments": { "filename": "/etc/kea/kea-dhcp4-new.json" }, "service": [ "dhcp4" ] }' \
http://127.0.0.1:8000/ | jq
[
{
"arguments": {
"filename": "/etc/kea/kea-dhcp4-new.json",
"size": 3248
},
"result": 0,
"text": "Configuration written to /etc/kea/kea-dhcp4-new.json successful"
}
]
kea-dhcp6.confkeactrl script
or through systemd (on Linux)kea-dhcp6-serverid in
the /var/lib/kea directory (the path is system/distribution dependent)