[Kea-users] How do I list current IPv4 leases? (OPEN)

Darren Ankney darren.ankney at gmail.com
Tue Jun 6 20:03:43 UTC 2023


Hi,

First, have a look in your DHCP4 Kea configuration and locate the
socket statement which should look something like this:

    "control-socket": {
      "socket-type": "unix",
      "socket-name": "/tmp/kea-dhcp4-socket"
    },

Make sure your kea-ctrl-agent is connecting to that socket which would
look something like this if following the example above:

        "control-sockets": {
            "dhcp4": {
                "socket-type": "unix",
                "socket-name": "/tmp/kea-dhcp4-socket"
            },

Make sure you have the correct ip and port set in your kea-ctrl-agent
also.  Something like this:

{
    "Control-agent": {
        "http-host": "10.123.97.212",
        "http-port": 8001,


If all that checks out, then try sending your commands directly to the
socket... Put your command in a .json file.  I'll call mine
command.json.  I'll put the command in the command.json file like
this:

{
    "command": "config-get"
}

And then I'll execute the command:

 cat command.json | sudo socat UNIX:/tmp/kea-dhcp4-socket -,ignoreeof | jq .

You may need to install socat or jq or both.  They are both useful.
socat lets you talk to a unix socket.  jq formats (among other things)
json output.

If you are still not able to connect using kea-shell to the IP, then
it might be a firewall problem?

Thank you,

Darren Ankney

On Tue, Jun 6, 2023 at 8:59 AM Weisteen Per <per.weisteen at telenor.no> wrote:
>
> Hi
>
> Thanks, I'll try to keep this conversation OPEN 😉
>
> I'm running HA setup and has kea-ctrl-agent on port 8001 on my primary server (10.123.97.212) and tried kea-shell :
> kea-shell --host 10.123.97.212 --port 8001 --service dhcp4 lease4-get-all
> but I'm just receiving a Connection Timeout after several minutes.
>
> Did the same using curl and got same reply packed in HTML code.
> curl -X POST -H "Content-Type: application/json" -d '{ "command": "lease4-get-all", "service": [ "dhcp4" ] }' http://10.123.97.212:8081
> <I didn't bother pasting the HTML encoded reply>
>
> I've got approx. 80 leases so this shouldn't take much time.
>
>
> ./PerW
>
> > -----Original Message-----
> > From: Kea-users <kea-users-bounces at lists.isc.org> On Behalf Of Kevin P.
> > Fleming
> > Sent: tirsdag 6. juni 2023 13:32
> > To: kea-users at lists.isc.org
> > Subject: Re: [Kea-users] How do I list current IPv4 leases? (INTERNAL)
> >
> > On Tue, Jun 6, 2023, at 07:28, Weisteen Per wrote:
> > > Hi
> >
> > I'm replying even though this was apparently an "INTERNAL" message :-)
> >
> > >
> > > Simple question, how do I get a list of all current leases when using
> > > memfile as database backend?
> >
> > Regardless of the backend, the 'lease_cmds' hook library is what you want:
> >
> > https://kea.readthedocs.io/en/kea-2.2.0/arm/hooks.html#lease-cmds-lease-
> > commands-for-easier-lease-management
> > --
> > ISC funds the development of this software with paid support subscriptions.
> > Contact us at https://www.isc.org/contact/ for more information.
> >
> > To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
> >
> > Kea-users mailing list
> > Kea-users at lists.isc.org
> > https://lists.isc.org/mailman/listinfo/kea-users
> --
> ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
>
> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
>
> Kea-users mailing list
> Kea-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users


More information about the Kea-users mailing list