How to setup Kea DHCPv4 Server with Ubuntu 23.10

In this article I will show you how to install and configure Kea DHCPv4 server on Ubuntu 23.10. Kea DHCP server is the successor of ISC DHCP server which recently got obsolete and is no longer maintained by ISC consortium.

Install kea dhcpv4 server

sudo apt update

sudo apt install kea-dhcp4-server

rename /etc/kea/kea-dhcp4.conf to kea-dhcp4.conf.bak 

sudo mv /etc/kea/kea-dhcp4.conf /etc/kea/kea-dhcp4.conf.bak

Create a new, empty configfile by using your favorite texteditor

sudo nano /etc/kea/kea-dhcp4.conf 

Copy/paste the content below and adjust the italic options as required

{
“Dhcp4”: {
“interfaces-config”: {
  “interfaces”: [ “ethx” ],
        “dhcp-socket-type”: “raw”
    },
    
    “control-socket”: {
        “socket-type”: “unix”,
        “socket-name”: “/run/kea/kea4-ctrl-socket”
    },
    
“authoritative”: true,
    
“lease-database”: {
    “type”: “memfile”,
        “persist”: true,
        “name”: “/var/lib/kea/kea-leases4.csv”,
    “lfc-interval”: 3600
},
        
    “renew-timer”: 15840,
    “rebind-timer”: 27720,
    “valid-lifetime”: 31680,
    “reservation-mode”: “out-of-pool”,
    
    “dhcp-ddns”: {
       “enable-updates”: true
    },
     
    “ddns-qualifying-suffix”: “smoky020.nl“,
    “ddns-override-client-update”: true,
    “ddns-override-no-update”: true,
    “ddns-replace-client-name”: “always”,
    “ddns-update-on-renew”: true,
     
    “option-data”: [
    {
      “name”: “domain-name-servers”,
      “data”: “ip address
    },
    {        
        “name”: “domain-search”,
        “data”: “smoky020.nl
    },
    {
      “name”: “domain-name”,
      “data”: “smoky020.nl
    }
  ],
    
        “loggers”: [ {
        “name”: “kea-dhcp4”,
        “output_options”: [ {
            “output”: “stdout”
    } 
    ],
        “severity”: “DEBUG”,
        “debuglevel”: 0
    } 
    ],
 
    “subnet4”: [
  {
    “id”: 1,
    “subnet”: “subnet/24“,
    
    “option-data”: [
    {
      “name”: “routers”,
      “data”: “ip address
    }
    ],
   
        “pools”: [
      {
        “pool”: “ip start – ip end
      }
    ],
        
        “reservations”: [
        {
            “hw-address”: “mac address“,
            “ip-address”: “ip address“,
            “hostname”: “hostname
        },   
        {
            “hw-address”: “mac address“,
            “ip-address”: “ip address“,
            “hostname”: “hostname
        } 
        ]
     }
     ]
  }
}

Save the .conf and restart kea dhcp4 server

sudo systemctl restart kea-dhcp4-server

Leave a Reply