Skip to content

Kea DHCP4

This page contains information regarding the installation, configuration, and testing of ISC's Kea DHCP4 server. I run my tests of Kea on Debian Linux within KVM. To give a bit of a foundation there are two pre-work videos convering the basic installation and configuration of Kea.

Installation

Here I install The ISC Kea DHCP server to a Debian Linux virtual machine. Below you will find video and step-by-step instruction that documents the procedure. In the video I have already installed a Debian server (no gui) running version 10.4 and have SSH'd into the server from my main system. You can get Debian from this link. This page is dedicated to testing Kea DHCP but I wanted to give a bit of a foundation by going through a quick installation first.

I am running this lab in a test environment within KVM.

Warning

Do not attempt this in a production environment, or any other environment that you do not own, unless you have express permission.

Duration: 13 minutes

Procedure

1: SSH into the server.

2: Once you have connected, elevate privileges to root (or a user in sudoers)

3: Curl the repo! By this I mean use the curl command to make a connection to the ISC Kea repository of files. The ISC provides a bash script to make this as painless as possible for you. Below is an easy one-liner that you can run from the command line to run the script. In the video I actually make a script so that I can run it again if needed later, but that is not necessary.

curl -1sLf 'https://dl.cloudsmith.io/public/isc/kea-1-6/cfg/setup/bash.deb.sh'| sudo bash

Note

sudo is not installed by default on Debian 10 (with no graphical interface selected). If you want to use sudo, you would have to install it apt install sudo and then configure users appropriately. If you follow what I do in the video, you will see that I am logged in as root, so sudo is not necessary. If you are connected as root, omit "sudo" from the command.

That will connect to the Kea repository, set up a GPG key, and ready the system to accept installations of Kea packages. You might note a failure or two during the curl process. However, this is okay, and it means that the process saw that there were missing dependencies and installed them properly.

Note

The previous command allows you to curl the 1.6 version of the Kea repo. However, in the video I use version 1.7, which as of the recording of the video was not considered a stable release. Only use stable releases in production environments. Newer, unsupported versions should only be run in isolated, test environments. To install the 1.7 repo, simply change the command (or script) to read kea-1-7 instead of kea-1-6.

4: Install the ISC Kea packages. In this lab I installed the common package (which the other Kea packages rely on) and the DHCP4 package. You can install both at once with the following command:

apt install -y isc-kea-common isc-kea-dhcp4-server

5: Check the installation:

systemctl status isc-kea-dhcp4-server

It should show the service as active. But don't worry, it won't start handing out addresses all of a sudden. You still have to configure a listening interface and a proper IP subnet.

That's it!

ISC Kea DHCP4 server is installed and ready to be configured to hand out IP addresses to clients.

Note

For more information on the Kea packages and repository installation options, go to this link. To download individual packages and check their SHA keys, go to the main Cloudsmith repository at this link.


Basic Configuration and Client Connection

In this video I show a basic configuration of a Kea DHCP4 server. Then I connect from a Linux client. I'm using Debian Linux for both and have already installed the ISC Kea DHCP4 server.

Duration: 15 minutes

Procedure

1: Access the kea directory:

cd /etc/kea

2: Open the configuration file and analyze it:

vim kea-dhcp4.conf

3: Rename the configuration file as a backup:

mv kea-dhcp4.conf _kea-dhcp4.conf

4: Create a new configuration file:

vim kea-dhcp4.conf

5: I made a basic configuration file, the contents are below. Copy the following into the new file:

# The whole configuration starts here.
{
    # DHCPv4 specific configuration starts here.
    "Dhcp4": {
        "interfaces-config": {
            "interfaces": [ "enp1s0" ],
            "dhcp-socket-type": "raw"
        },
        "valid-lifetime": 4000,
        "renew-timer": 1000,
        "rebind-timer": 2000,

        "subnet4": [
    {
    "subnet": "172.21.0.0/16",  
    "pools": [ { "pool": "172.21.50.1-172.21.50.254" } ]
    }],

    "option-data": [
        {
        "name": "routers",
        "data": "172.21.0.1"},

        {       
        "name": "domain-name-servers",
        "data": "172.21.0.1"        
        }
        ],

       # Now loggers are inside the DHCPv4 object.
       "loggers": [{
            "name": "*",
            "severity": "DEBUG"
        }]
    }

# The whole configuration structure ends here.
}

6: Modify the configuration file to reflect your network adapter's name and your particular IP network scheme and save the file.

Note

If you are configuring this on a virtual machine, then you are most likely doing it in NAT mode. If so, your gateway and DNS server IP addresses might be something similar to the following:

  • VirtualBox: 10.0.2.1

  • VMware Workstation: 192.168.80.2

If you are working in bridged mode, then the gateway and DNS IP will be whatever is supplying those services on your LAN.

7: Restart the DHCP4 server and check its status:

systemctl restart isc-kea-dhcp4-server

systemctl status isc-kea-dhcp4-server

8: Disable any running DHCP servers. If you are using NAT in your virtualization system, then a DHCP server is most likely running and will have to be disabled so there is not a conflict. See this link for more information on how to disable the DHCP servers in VirtualBox, VMware Workstation, and KVM.

9: Connect from a client. Any client set up to obtain an IP address automatically will do! In the video I am using Debian with the Gnome desktop environment.

10: Verify the IP address assigned to the client. In Linux, type either nmcli or ip a in the Terminal. In Windows, type ipconfig in the Command Prompt or PowerShell.

Success

Now you have a working DHCP server and connected client (hopefully). Enjoy!


Basic Performance Testing (using perfdhcp)

This is a basic video about testing the performance of a Kea DHCP server. Both the target DHCP server and the testing system are Debian 10.4 virtual machines with 2 CPUs and 4 GB RAM running within KVM. Prior to the video I curled the Kea 1-7 repository on the testing system.

In this video I perform the following:

  • Install the Kea common and admin packages.

  • Test a Kea DHCP4 server using the perfdhcp tool.

Duration: 10 minutes

Procedure

1: Make sure you have the following set up:

  • A Debian server with ISC Kea installed and configured.

  • A Linux client computer to run the tests, with the Kea repository installed. Again, for this lab I am using Debian for both systems. See my previous videos on how to install and configure everything required.

2: Install the common and admin packages to the testing computer.

apt install -y isc-kea-common isc-kea-admin

3: From the testing system, test the DHCP server. The syntax for that is:

perfdhcp <IP address>

So for example, in the video I typed:

perfdhcp 172.21.0.211

Your IP address will be different. Let the test run for a minute or so and then end the test by pressing Ctrl+c.

4: View the results. what was the maximum rate of 4-way exchanges/second? Compare that to the results in my video (which was 1688.13 exchanges/sec.)

5: Now try modifying the amount of exchanges per second. For example:

perfdhcp -r 1000 <ip address>

6: Try different values for -r until you find one that is close to a 0% drop rate but allows for as many exchanges as possible.

That's about it for this initial basic test. For more information on perfdhcp, access the MAN page, man perfdhcp, or see this link for the official Kea documentation.