Start deploying your customized DHCP system by installing the ISC KEA DHCP server on Ubuntu 24.04 LTS Noble Linux.
In any computer network, DHCP – Dynamic Host Configuration Protocol (DHCP) plays an important in managing multiple systems by assigning them an identification in the form of an address. Without an IP address, a device can’t communicate with another device in a network. DHCP servers eliminate the need for manually configuring IP addresses for each device, hence making network management simpler and more efficient.
Kea DHCP is an open-source and high-performance server software to convert existing systems into DHCP servers. It is designed to replace the traditional ISC DHCP server by offering a modern modular architecture that makes it more flexible and scalable for contemporary network environments. It supports both IPv4 and IPv6 and provides dynamic reconfiguration capabilities, allowing changes to be made without restarting the server.
Key features of Kea DHCP:
- Offers Modular Architecture, therefore developers can extend its functions easily.
- High-performance DHCP server, hence suitable for both large-scale and high-availability deployments.
- Low-latency
- Dynamic Reconfiguration without restarting.
- Supports for IPv4 and IPv6
- API and Database Integration
Step 1: Update Ubuntu 24.04
Start updating the system, open the command terminal, and run the given command. It will install the latest available updates for security and other packages.
sudo apt update && sudo apt upgrade
Apart from updating the system also install a few required dependencies:
sudo apt install curl apt-transport-https -y
Step 2: Add ISC KEA Repository
The version of the KEA DHCP server available through the default system repository is not the latest one, therefore, for the latest version of Kea add the given but don’t forget to change the version number in the command. For example, while doing this article the latest version was 2.6, hence we used that, in case it is different in your case then use that.
curl -1sLf 'https://dl.cloudsmith.io/public/isc/kea-2-6/setup.deb.sh' | sudo -E bash
After adding the repository, once run the system update command:
sudo apt update
Step 3: Installing KEA DHCP on Ubuntu 24.04
After having the repository added successfully, run the given command that will install the KEA-DHCP4 and KEA-DHCP6 along with the kea-ctrl-agent & kea-dhcp-ddns-server packages.
sudo apt install isc-kea
Step 4: Check the Version and Service Status
After completing the installation successfully, let’s check what version of KEA DHCP is on our system.
kea-dhcp4 -version
To check the service and confirm it is running without any error use:
For DHCP 4:
systemctl status isc-kea-dhcp4-server
For DHCP 6:
systemctl status isc-kea-dhcp6-server
Whereas to enable the service:
Enable the DHCPv4 service to start on boot:
sudo systemctl enable isc-kea-dhcp4-server
Enable the DHCPv6 service to start on boot:
sudo systemctl enable isc-kea-dhcp6-server
To Monitor Kea Logs
Kea logs provide valuable information for troubleshooting and monitoring server activity. You can view the logs using the journalctl command:
View logs for the DHCPv4 server:
sudo journalctl -u isc-kea-dhcp4-server
View logs for the DHCPv6 server:
sudo journalctl -u isc-kea-dhcp6-server
Example- Basic Configuration for Kea DHCP4
Before performing any changes to the DHCP configuration file of KEA, let’s take the backup of its original file:
sudo mv /etc/kea/kea-dhcp4.conf /etc/kea/kea-dhcp4.conf.bak
Now, create the configuration file in your preferred text editor:
sudo nano /etc/kea/kea-dhcp4.conf
Past the following basic and typical configuration setup:
To save and close the file (Ctrl + O to write and Ctrl + X to exit in nano.
{
"Dhcp4": {
"interfaces-config": {
"interfaces": ["eth0"]
},
"lease-database": {
"type": "memfile",
"persist": true,
"name": "/var/lib/kea/kea-leases4.csv"
},
"subnet4": [
{
"id": 1,
"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"
},
{
"name": "domain-name",
"data": "example.com"
}
]
}
],
"valid-lifetime": 3600,
"renew-timer": 900,
"rebind-timer": 1800
}
}
Explanation of the above Configuration file elements:
interfaces-config
: Specifies the network interfaces that the DHCP server will listen on. Replace"eth0"
with your network interface name. You can find your network interface usingip a
command if you are unsure.lease-database
: This will configure the database file where DHCP leases will be stored. Thememfile
type means leases are stored in a CSV file on disk (/var/lib/kea/kea-leases4.csv
).subnet4
: Defines the subnets and address pools that the DHCP server will manage:subnet
: Specifies the subnet in CIDR notation (e.g.192.168.1.0/24
).pools
: Defines the range of IP addresses within the subnet that can be assigned to clients (192.168.1.100 - 192.168.1.200
in this example).option-data
: Specifies various DHCP options provided to clients:routers
: The default gateway for clients.domain-name-servers
: The DNS servers clients should use.domain-name
: The domain name suffix for clients.
valid-lifetime
: The duration (in seconds) for which an IP address is valid (e.g., 3600 seconds or 1 hour).renew-timer
: Time (in seconds) after which a client should begin to attempt to renew its lease (e.g., 900 seconds or 15 minutes).rebind-timer
: Time (in seconds) after which a client should attempt to rebind to any available server if it hasn’t been able to renew its lease (e.g., 1800 seconds or 30 minutes).
Let’s validate the configuration file for syntax errors after that we will restart the Kea Service.
sudo kea-dhcp4 -t /etc/kea/kea-dhcp4.conf
Restart the Kea DHCP4 Service: Apply the new configuration by restarting the Kea DHCP4 service:
sudo systemctl restart kea-dhcp4-server
Check the Service Status: Ensure that the Kea DHCP4 service is running correctly:
sudo systemctl status kea-dhcp4-server
Conclusion
The Kea DHCP server is a powerful open-source tool for Linux systems to power modern network systems. It offers high-performance and dynamic configuration support that makes it a good choice to deploy for both small and large-scale deployments for efficiently handling DHCP operations. Although we have just shown the installation process, for more advanced configurations check out the official Kea documentation whereas for source code see the Kea GitLab repository.