[Kea-users] Host reservation via Kea control agent API

Allan Tinker allan at m33access.com
Tue Oct 5 18:16:00 UTC 2021


Im trying to add a host reservation via the kea-ctrl-agent API. 

This is the data Im sending to the API as a POST: 

{
    "command": "reservation-add",
    "arguments": {
            "reservation": {
                "subnet-id": 2,
                "hw-address": "4c:e1:73:43:78:3e",
                "ip-address": "172.16.132.16"
        
        }
    }
}

And the response Im getting is: 

[
    {
        "result": 1,
        "text": "Host database not available, cannot add host."
    }
]

Using MySQL, built database via kea-admin
The database is working for lease information and logs. 

In kea-dhcp4.conf I have the hosts hooks loaded,
In kea-ctrl-agent.conf I have the hosts hooks loaded.

Here is what my configs look like: 

Kea-dhcp4.conf:

"Dhcp4": {
    "interfaces-config": {
        "interfaces": ["ens224"]
    },

    "control-socket": {
        "socket-type": "unix",
        "socket-name": "/tmp/kea4-ctrl.sock"
    },

    "lease-database": {
         "type": "mysql",
         "name": "DHCP",
         "user": “dummyuser",
         "password": “dummypass",
         "host": "localhost",
         "port": 3306
    },

    "hosts-database": {
         "type": "mysql",
         "name": "DHCP",
         "user": "root",
         "password": “dummyuser",
         "host": “dummypass",
         "port": 3306,
         "readonly": false
     },
…

"hooks-libraries": [
        {
	"library": "/usr/local/lib/kea/hooks/libdhcp_host_cmds.so"
        },
        {
	"library": "/usr/local/lib/kea/hooks/libdhcp_lease_cmds.so"
        },
	{
	"library": "/usr/local/lib/kea/hooks/libdhcp_flex_id.so",
                "parameters": {
                "identifier-expression": "relay4[1].hex",
                "replace-client-id": true
                }
        },
…


Kea-ctrl-agent.conf:

"Control-agent": {
    "http-host": "172.16.132.2",
    "http-port": 8033,
    "cert-required": false,
    "authentication": {
        "type": "basic",
        "realm": "kea-control-agent",
        "clients": [
        {
            "user": “dummyuser",
            "password": “dummypass"
        }]
},

        "dhcp4": {
            "socket-type": "unix",
            "socket-name": "/tmp/kea4-ctrl.sock"
        },
	"dhcp6": {
            "socket-type": "unix",
            "socket-name": "/tmp/kea6-ctrl-socket"
        },
	"d2": {
            "socket-type": "unix",
            "socket-name": "/tmp/kea-ddns-ctrl-socket"
        }
    },

    "hooks-libraries": [
      {
       	"library": "/usr/local/lib/kea/hooks/libdhcp_host_cmds.so"
      },
    ],
…


This ones got me confused for sure..

- Allan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20211005/bd592620/attachment-0001.htm>


More information about the Kea-users mailing list