Why You Should Switch to Kea DHCP Right Now
Getting a “DHCP pool exhausted” alert at 2 AM is a nightmare. With the aging ISC DHCP, an oversized lease file frequently causes the service to hang. You have to restart the entire service just to make a minor configuration change, instantly disrupting connections for thousands of devices in one fell swoop.
ISC DHCP officially reached End of Life in 2022. It’s far too slow to keep up with the demands of modern cloud infrastructure. Kea DHCP was built to solve exactly that problem. Kea handles thousands of requests per second, supports JSON-based configuration, and provides a REST API for full automation. Most notably, Kea’s High Availability (HA) feature runs extremely reliably, without the frustrating sync issues that plagued its predecessor.
Installing Kea DHCP on Ubuntu
In this guide, I’m using Ubuntu 22.04. Kea has a modular architecture, meaning you only install what you actually need, saving system resources.
# Update and install the DHCPv4 server
sudo apt update
sudo apt install kea-dhcp4-server -y
Before making any edits, back up the original configuration file. This gives you a fallback if you accidentally corrupt the JSON format:
sudo cp /etc/kea/kea-dhcp4.conf /etc/kea/kea-dhcp4.conf.bak
Try the basic configuration below to get the server up and running right away. Replace eth0 with your actual network interface (check with ip a):
{
"Dhcp4": {
"interfaces-config": {
"interfaces": [ "eth0" ]
},
"control-socket": {
"socket-type": "unix",
"socket-name": "/tmp/kea4-ctrl-socket"
},
"lease-database": {
"type": "memfile",
"persist": true,
"name": "/var/lib/kea/kea-leases4.csv",
"lfc-interval": 3600
},
"subnet4": [
{
"subnet": "192.168.1.0/24",
"pools": [ { "pool": "192.168.1.100 - 192.168.1.200" } ],
"option-data": [
{ "name": "routers", "data": "192.168.1.1" },
{ "name": "domain-name-servers", "data": "8.8.8.8, 8.8.4.4" }
]
}
]
}
}
After saving the file, restart the service and check its status:
sudo systemctl restart kea-dhcp4-server
sudo systemctl status kea-dhcp4-server
The Power of JSON Configuration
Many people are wary of JSON because a single missing comma , will cause the server to throw an error. That said, JSON is the standard format for tools like Ansible and Terraform. To avoid silly mistakes, use kea-dhcp4 -t /etc/kea/kea-dhcp4.conf to validate the syntax before restarting.
Flexible Database Backend
By default, Kea uses memfile (a CSV file) to store leases. For large deployments with over 10,000 devices, you should switch to PostgreSQL or MySQL. Storing leases in a database enables extremely fast queries and allows multiple DHCP servers to run in parallel without data conflicts.
Extending Functionality with Hooks
Kea lets you load additional libraries (Hooks) to extend its feature set. You can add the High Availability module to run two servers in parallel (Active-Passive or Active-Active). This keeps your network running smoothly even when one server experiences a hardware failure.
"hooks-libraries": [
{
"library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_ha.so",
"parameters": {
"high-availability": [{
"name": "primary-server",
"role": "primary",
"url": "http://192.168.1.10:8000/",
"peers": [{
"name": "secondary-server",
"role": "standby",
"url": "http://192.168.1.11:8000/"
}]
}]
}
}
]
Real-Time Management via REST API
This is the most valuable improvement over ISC DHCP. With kea-ctrl-agent enabled, you can update configuration or view the list of currently assigned IPs without ever restarting the server. Every operation is performed over HTTP.
For example, retrieve the full lease list with a curl command:
curl -X POST -H "Content-Type: application/json" \
-d '{"command": "lease4-get-all", "service": ["dhcp4"]}' \
http://localhost:8000/
The JSON response makes it straightforward to build a custom monitoring dashboard or integrate with an IP Address Management (IPAM) system.
Lessons from Real-World Deployment
I once dealt with a serious network outage caused by an ISC DHCP server overwhelmed by I/O. The dhcpd.leases file had ballooned past 600MB, causing each write operation to take several seconds. After migrating to Kea with a PostgreSQL backend, DHCP response latency dropped from 2 seconds to under 50ms. The system ran smoothly even during peak hours.
Tips for fellow admins:
- Leverage the Logs: Kea produces very detailed logs. Use
journalctl -u kea-dhcp4-server -fto monitor devices requesting IPs in real time. - Configure LFC: Always set
lfc-intervalto around 3600 (1 hour). This cleans up stale records and keeps the database lean. - Reserve Static IPs: Use the
reservationssection within a subnet to assign fixed IPs to servers or printers based on their MAC address.
Conclusion
Migrating from ISC DHCP to Kea takes some adjustment to the new syntax. However, the performance gains and API-driven management capabilities make it well worth the effort. If your infrastructure is growing, upgrade to Kea now to ensure a stable, easily manageable network foundation.

