kea

From ArchWiki

Kea is the bleeding edge DHCP server of the Internet Systems Consortium (ISC) . The older dhcpd is end of life .

Installation

Install the kea package. For additional documentation install kea-docs. Additional optional dependencies are:

Usage

kea includes four systemd unit files:

unit file purpose
kea-dhcp4.service The IPv4 dhcp daemon.
kea-dhcp6.service The IPv6 dhcp daemon.
kea-dhcp-ddns.service The DNS update daemon.
kea-ctrl-agent.service Exposing a REST interface for managing Kea servers.

Configuration

The configuration files are located under /etc/kea. The content of the configuration files uses JSON structures. For special configurations that are not yet included in the following examples, please refer to the Kea documentation.

IPv4 DHCP

To use DHCP for IPv4, the configuration file /etc/kea/kea-dhcp4.conf must be adapted and the service kea-dhcp4.service must be activated and started.

Tip: The following subnets are usually reserved for private networks and will not conflict with hosts on the internet:
  • 192.168/16 (subnet 192.168.0.0, netmask 255.255.0.0)
  • 172.16/12 (subnet 172.16.0.0, netmask 255.240.0.0)
  • 10/8 (for large networks; subnet 10.0.0.0, netmask 255.0.0.0)

See also RFC 1918.

Make sure to assign a static IP address to the interface on which Kea is listen on.

Example configuration

Assumptions for the example:

  • The net is 192.168.0.0/24
  • DNS server has the IP 192.168.0.1/24
  • Gateway has the IP 192.168.0.254/24
  • Static IP of the DHCP server network interface eth0 is 192.168.0.253/24
  • Kea should provide IPs from 192.168.0.100/24 to 192.168.0.199/24

A minimal configuration file /etc/kea/kea-dhcp4.conf could look like:

/etc/kea/kea-dhcp4.conf
{
    "Dhcp4": {
        "interfaces-config": {
            "interfaces": [ "enp1s0/192.168.0.253" ],
            "dhcp-socket-type": "raw"
        },

        "subnet4": [
            {
                "id": 1,
                "subnet": "192.168.0.0/24",
                "pools": [ { "pool": "192.168.0.100 - 192.168.0.199" } ],
                "option-data": [
                    {
                        "name": "routers",
                        "data": "192.168.0.254"
                    },
                    {
                        "name": "domain-name-servers",
                        "data": "192.168.0.1"
                    }
                ]
            }
        ]
    }
}

The configuration file can be checked for errors by running the command:

# kea-dhcp4 -t /etc/kea/kea-dhcp4.conf

If everything looks ok enable and start Kea:

# systemctl enable kea --now

Check the log output of Kea by running the command:

# journalctl -u kea-dhcp4.service