Dynamic Host Configuration Protocol (DHCP) is the backbone of IP address management in every network from home labs to enterprise data centers. But when devices cannot connect, IP conflicts arise, or you need to audit address assignments, understanding what your DHCP server has handed out — and when — becomes critical.
This guide compares three open-source approaches to DHCP lease analysis: the ISC Kea lease database, ISC DHCP server log parsing, and Dnsmasq lease file analysis. Each method offers different visibility into DHCP lease state, from real-time database queries to historical log-based forensics.
What Is DHCP Lease Analysis?
DHCP lease analysis involves examining the records of IP address assignments made by your DHCP server. A lease record typically contains:
- Client MAC address — The hardware identifier of the requesting device
- Assigned IP address — The IPv4 or IPv6 address leased to the client
- Lease start time — When the address was assigned
- Lease expiry time — When the lease expires and the address becomes available again
- Client hostname — The device’s reported hostname (if provided)
- Lease state — Active, expired, released, or abandoned
Understanding these records helps network administrators troubleshoot connectivity issues, plan IP address pool sizing, detect rogue DHCP clients, and maintain accurate network inventory.
ISC Kea: Modern DHCP with Queryable Lease Database
ISC Kea is ISC’s next-generation DHCP server, designed to replace the legacy ISC DHCP server. Kea stores lease information in a queryable database (Memfile, MySQL, PostgreSQL, or Cassandra), enabling real-time lease analysis through SQL queries and a REST API.
GitHub: isc-projects/kea — 714+ stars, actively developed
Lease Database Backends
Kea supports multiple storage backends for lease data:
- Memfile — CSV files on disk, suitable for small deployments
- MySQL/MariaDB — Full relational database with indexing
- PostgreSQL — Production-grade with advanced query capabilities
- Cassandra — Distributed database for large-scale deployments
Docker Compose Configuration
| |
Kea Lease Database Schema
When using PostgreSQL, Kea creates the following lease tables:
| |
Querying Kea Leases
| |
Kea REST API for Lease Queries
| |
ISC DHCP Server: Log-Based Lease Analysis
The legacy ISC DHCP server (dhcpd) stores lease information in a flat text file (/var/lib/dhcp/dhcpd.leases) and writes assignment events to syslog. While the server is no longer actively developed (superseded by Kea), it remains widely deployed in production networks.
Lease File Format
The ISC DHCP lease file uses a simple text format:
| |
Parsing ISC DHCP Leases with Python
| |
Log-Based Lease History
ISC DHCP writes lease events to syslog:
| |
Dnsmasq: Lightweight DHCP with Simple Lease File
Dnsmasq is a lightweight DNS/DHCP/TFTP server commonly used in home networks, small offices, and as a DHCP server in container environments. Its lease file is simpler than ISC DHCP’s but contains all essential information.
Lease File Format
| |
Format: timestamp mac_address ip_address hostname client_id
Docker Compose Configuration
| |
Dnsmasq DHCP Configuration
| |
Analyzing Dnsmasq Leases
| |
Comparison Table
| Feature | ISC Kea | ISC DHCP Server | Dnsmasq |
|---|---|---|---|
| GitHub Stars | 714+ | Legacy (EOL) | N/A (project site) |
| Lease Storage | Database (SQL/Memfile) | Flat text file | Flat text file |
| Query Interface | SQL + REST API | File parsing + logs | File parsing |
| Real-Time Queries | Yes | No | No |
| Historical Analysis | Via database queries | Via syslog parsing | Limited |
| DHCPv4 | Yes | Yes | Yes |
| DHCPv6 | Yes | Yes | Yes |
| Lease Hooks | Yes (hook libraries) | Limited | No |
| HA Support | Yes (native) | Via failover protocol | No |
| Pool Sizing Reports | Via SQL queries | Manual calculation | Manual calculation |
| Conflict Detection | Yes | Partial | No |
| Active Development | Yes | No (EOL since 2023) | Yes |
| Best For | Enterprise networks | Legacy infrastructure | Home/small networks |
Choosing the Right DHCP Lease Analysis Approach
Use ISC Kea when: You need production-grade DHCP with queryable lease data. The database backend enables real-time lease analysis, automated reporting, and integration with IPAM systems. Kea’s REST API allows programmatic lease management from monitoring dashboards.
Use ISC DHCP log analysis when: You are working with a legacy deployment that has not yet migrated to Kea. Log-based analysis can reconstruct historical lease activity but requires custom parsing scripts and cannot provide real-time queries.
Use Dnsmasq lease file analysis when: You run a small network with fewer than 256 DHCP clients. The simple lease file format is easy to parse manually or with basic scripts, but lacks the analytical capabilities of a database backend.
Building a DHCP Lease Dashboard
For Kea deployments, you can build a real-time dashboard by querying the lease database and feeding results to Grafana:
| |
Why Self-Host Your DHCP Lease Analysis?
Understanding your DHCP lease data is fundamental to network operations. When devices fail to obtain IP addresses, the first question is always: is the pool exhausted? Without lease analysis, you are guessing. With it, you can immediately see pool utilization, identify expired leases that should be reclaimed, and detect patterns like devices requesting addresses faster than expected.
Self-hosted DHCP analysis keeps your network intelligence in-house. Instead of sending lease data to a cloud monitoring service, you query your own database and build custom reports tailored to your environment. This is especially important for organizations with compliance requirements around network access logging.
The migration path from ISC DHCP to Kea is well-documented, and Kea’s database backend makes lease analysis dramatically easier than parsing flat text files. For organizations still running the legacy ISC DHCP server, this is a timely opportunity to modernize — ISC officially ended support in September 2023.
If you manage DHCP infrastructure, our DHCP high availability guide covers failover configurations, and the DHCP failover deep dive provides detailed HA setup instructions. For broader DHCP management, the DHCP lease management comparison covers the server selection process.
For DHCP infrastructure planning, see our DHCP high availability guide, the DHCP failover deep dive, and the DHCP lease management comparison.
For DHCP infrastructure planning, see our DHCP high availability guide, the DHCP failover deep dive, and the DHCP lease management comparison.
FAQ
How do I find which device has a specific IP address?
In Kea, query the lease database: SELECT hostname, hwaddr, cltt FROM lease4 WHERE address = inet '192.168.1.100';. In ISC DHCP, search the lease file: grep -A 10 "lease 192.168.1.100" /var/lib/dhcp/dhcpd.leases. In Dnsmasq, grep the lease file for the IP address.
Why are there more DHCP leases than active devices?
DHCP leases remain in the database until they expire. A device that was once connected but has since left the network will retain its lease until the lease time expires. Use state = 0 (active) filters in Kea to see only currently active leases.
How do I detect IP address conflicts in DHCP?
Kea tracks lease state and can detect when a client reports an address conflict via DHCPDECLINE. In ISC DHCP, look for DHCPDECLINE entries in syslog. Dnsmasq does not have built-in conflict detection.
Can I export DHCP lease data to CSV for reporting?
Yes. For Kea with PostgreSQL: COPY (SELECT address, hostname, hwaddr, expire FROM lease4 WHERE state = 0) TO '/tmp/dhcp-leases.csv' WITH CSV HEADER;. For ISC DHCP and Dnsmasq, use the Python parsing scripts shown above.
What is the maximum number of DHCP leases Kea can handle?
Kea with PostgreSQL backend can handle millions of leases. The Memfile backend is suitable for deployments with up to ~100,000 leases. For larger deployments, use the database backend with proper indexing.
Should I migrate from ISC DHCP to Kea?
Yes. ISC officially ended support for the legacy DHCP server in September 2023. Kea offers active development, database-backed leases, REST API, HA support, and hook libraries for custom functionality.