Skip to content

Beginners Guide to DHCP: Set Up a Kea DHCP Server and DHCP Clients

Updated 3 min read

Updated: 29 September 2026 · Applies to: Kea DHCP 2.4 to 3.0 on AlmaLinux and Rocky Linux 9 and 10, RHEL 9 and 10, Ubuntu 24.04 and 26.04, Debian 13

DHCP (Dynamic Host Configuration Protocol) gives computers on a network their IP address, gateway and DNS servers automatically when they connect. A DHCP server holds a range of free addresses and hands them out on request; clients use them for a set time (the lease) and renew them. DHCP works by broadcast, so the server and its clients must be on the same network segment, or a router must relay the requests.

The ISC DHCP server (dhcpd) used in older guides reached end of life in 2022, and RHEL 10 and its rebuilds no longer include it. Its successor from the same developers is Kea. We checked the configuration below with Kea 2.4 (Ubuntu 24.04), 2.6 (AlmaLinux 9 and Debian 13) and 3.0 (AlmaLinux 10).

1. Install Kea

dnf install kea                   # AlmaLinux and Rocky Linux 10 (on 9: dnf install epel-release first)
apt install kea-dhcp4-server      # Ubuntu, Debian

2. Configure the DHCPv4 server

Back up the example file and replace /etc/kea/kea-dhcp4.conf with a configuration for your network. This example serves 192.168.10.100 to 192.168.10.200 on the interface eth1 and gives a fixed address to one printer:

{
  "Dhcp4": {
    "interfaces-config": { "interfaces": [ "eth1" ] },
    "lease-database": { "type": "memfile", "persist": true, "lfc-interval": 3600 },
    "valid-lifetime": 86400,
    "renew-timer": 43200,
    "rebind-timer": 75600,
    "option-data": [
      { "name": "domain-name-servers", "data": "192.168.10.1" },
      { "name": "domain-name", "data": "office.example" }
    ],
    "subnet4": [
      {
        "id": 1,
        "subnet": "192.168.10.0/24",
        "pools": [ { "pool": "192.168.10.100 - 192.168.10.200" } ],
        "option-data": [ { "name": "routers", "data": "192.168.10.1" } ],
        "reservations": [
          { "hw-address": "52:54:00:12:34:56", "ip-address": "192.168.10.20", "hostname": "printer" }
        ]
      }
    ]
  }
}
  • interfaces: the network card that faces the clients. Find its name with ip -br addr. The server needs a fixed address in the same subnet on that interface.
  • valid-lifetime: lease time in seconds (86400 is one day).
  • reservations: fixed addresses for devices by MAC address. Keep reserved addresses outside the pool.

3. Check, start and open the firewall

kea-dhcp4 -t /etc/kea/kea-dhcp4.conf
systemctl enable --now kea-dhcp4            # AlmaLinux, Rocky Linux, RHEL
systemctl enable --now kea-dhcp4-server     # Ubuntu, Debian
firewall-cmd --permanent --add-service=dhcp && firewall-cmd --reload

With UFW: ufw allow in on eth1 to any port 67 proto udp. Kea 3.0 also checks that the interface exists when you test the file.

4. Check the leases

Kea writes the leases it hands out to /var/lib/kea/kea-leases4.csv. Watch the log while a client connects: journalctl -u kea-dhcp4 -f (or -u kea-dhcp4-server on Ubuntu and Debian).

Configure a client to use DHCP

  • AlmaLinux, Rocky Linux, RHEL (NetworkManager): find the connection name with nmcli connection show, then nmcli connection modify NAME ipv4.method auto and nmcli connection up NAME.
  • Ubuntu (netplan): set dhcp4: true for the interface in /etc/netplan/*.yaml and run netplan apply.
  • Check the result with ip -br addr and ip route.

Never run a DHCP server on a network where another one already hands out addresses, such as a data centre's public network: two servers answering the same clients cause address conflicts.

Official documentation: Kea administrator reference manual.

Esta resposta foi útil?

Still stuck? Open a ticket