[Kea-users] Unable to get the active lease list in sync with configuration data

Kraishak Mahtha kraishak.edu at gmail.com
Mon Apr 24 05:48:58 UTC 2023


Hi Darren,

The clients are not active clients those are created from a test tool, so
until we send the renew request command we don't see them get renewed,

After changing the configuration I did a restart and observed the logs, the
logs say that leases loaded from the lease file (this time I didn't delete
the lease file) to observe it correctly. I still see the old leases in the
lease output which are totally out of range as per the new config, for the
same case in ISC DHCP it discards the leases if the IP is not in sync with
the config.

Please find my attached test results:
Initial config: before_changes_first_config.txt
Initial lease output: before_changes_first_lease_output.txt
Changed the config with a totally different scope
range: after_changes_second_config.txt
After changing I initiated a few lease requests and tried to fetch the
leases, it showed me the old and new leases in the
output: after_changes_second_lease.txt

Do we have any parameter config statement or process where we can reload
the lease memory of the kea-DHCP to be in sync with the config? In ISC it
handles by default

Thanks
Kraishak






On Sun, Apr 23, 2023 at 10:44 AM Darren Ankney <darren.ankney at gmail.com>
wrote:

> Hi Kraishak,
>
> I would suspect that you have a particularly chatty client that is
> constantly renewing the lease.  I suspect that by the time you start
> the server and have a chance to perform the lease4-get-all that the
> client has already renewed the lease.  You confirm this by having a
> look in the logs.  Possibly, while testing, set the severity to DEBUG
> and debug level to 99.
>
> lease4-get-all is getting the data from the kea-dhcp4 server, it has
> no where else to get it from.  It has to be the data as the kea-dhcp4
> server sees it.
>
> Thank you,
>
> Darren Ankney
>
> On Fri, Apr 21, 2023 at 11:05 AM Kraishak Mahtha <kraishak.edu at gmail.com>
> wrote:
> >
> > Hi All,
> > I am using the kea-HA in load balance mode, as part of testing I
> configured a subnet and set the lease time to "86400", later as part of the
> change I changed the scope rang and restarted kea-dhcp4(stopped and
> started) but still the lease4-get-all command shows all the old lease as
> active.
> > Command I used to get lease : echo '{"command":"lease4-get-all"}' |
> /usr/bin/socat - UNIX:/root/tmp/kea4-ctrl-socket
> >
> > I stopped kea-DHCP on both servers, deleted all the lease files(kea
> service created two lease files with .2 extension remove that too), and
> then recreated with empty, and then started one by one but still, the
> command gives me the old leases data, Now I removed the HA config and made
> it standalone, deleted all the lease files and recreated lease file with
> empty data and started again but still, it shows the old lease entries as
> active.
> >
> > I tried adding the sanity check section too in the config,  line
> "lease-checks": "del" but it looks like it works at the subnet level, if I
> remove the subnet then it is not showing the data, but when I add it back
> the subnet with the different pool range still I can get the old lease data.
> >
> > I have two doubts
> > 1)Even after deleting the lease file and deleting the range from the
> config file how can the server still have the lease information or from
> where does it get the data, Can we reset it manually or do we have any
> approach that needs to be followed for the server to auto figure out the
> lease entries are not used as the range definition itself is removed from
> the config file.
> >
> > 2)lease4-get-all command is not giving the correct data, do we have any
> way or any other command where we can get the current active leases without
> having old ones?
> >
> > Thanks In Advance
> > Kraishak
> >
> > --
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20230424/6f57bc30/attachment-0001.htm>
-------------- next part --------------
[root at dhcp1 ~]# cat /var/tmp/kea-dhcp4.conf
#DHCPv4 192.168.0.125
{
"Dhcp4": {
    "valid-lifetime": 300,
    "renew-timer": 150,
    "rebind-timer": 200,
    "server-tag": "192.168.0.125",
      "control-socket": {
            "socket-name": "/usr/local/kea4-ctrl-socket",
            "socket-type": "unix"
        },
      "sanity-checks": {
        "lease-checks": "fix-del"
     },
     "multi-threading": {
       "enable-multi-threading": true,
       "thread-pool-size": 4,
       "packet-queue-size": 16
    },
    "lease-database": {
        "type": "memfile",
        "persist": true,
        "name": "/usr/local/db/dhcp4.leases"
    },

   "interfaces-config": {
        "interfaces": ["eth0"]
  },

"hooks-libraries": [
            {
                "library": "/usr/local/lib/kea/hooks/libdhcp_lease_cmds.so",
                "parameters": { }
            },
           #Testing the comments flow
            {
                "library": "/usr/local/lib/kea/hooks/libdhcp_bootp.so",
                "parameters": { }
            }
],
            "subnet4": [{
        "subnet": "4.0.0.0/16",
        "valid-lifetime": 86400,
                 "option-data": [
                    {
                        "data": "8.8.8.8, 8.8.8.4",
                        "name": "domain-name-servers"
                    },
                    {
                     "data": "86400",
                     "name": "dhcp-lease-time"
                    },
                    {
                        "data": "4.0.0.1",
                        "name": "routers"
                    }
                ],
            "pools": [
            {
                "pool": "4.0.0.25 - 4.0.0.125"
            }
        ]


                }],
         "loggers": [
        {
            "name": "kea-dhcp4",
            "debuglevel": 99,
            "output_options": [
                {
                    "output": "/var/log/kea-dhcp4.log"
                }
            ],
            "severity": "DEBUG"
        }
    ]
}
}

[root at dhcp1 ~]#
-------------- next part --------------
[root at dhcp1 ~]# /usr/bin/echo '{"command":"lease4-get-all"}' | /usr/bin/socat - UNIX:/usr/local/kea4-ctrl-socket | /usr/bin/jq
{
  "arguments": {
    "leases": [
      {
        "client-id": "01:66:53:f3:00:00:04",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000004",
        "hw-address": "66:53:f3:00:00:04",
        "ip-address": "4.0.0.25",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:02",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000002",
        "hw-address": "66:53:f3:00:00:02",
        "ip-address": "4.0.0.26",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:01",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000001",
        "hw-address": "66:53:f3:00:00:01",
        "ip-address": "4.0.0.27",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:07",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000007",
        "hw-address": "66:53:f3:00:00:07",
        "ip-address": "4.0.0.28",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:03",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000003",
        "hw-address": "66:53:f3:00:00:03",
        "ip-address": "4.0.0.29",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:08",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000008",
        "hw-address": "66:53:f3:00:00:08",
        "ip-address": "4.0.0.30",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:09",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000009",
        "hw-address": "66:53:f3:00:00:09",
        "ip-address": "4.0.0.31",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:0a",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-00000a",
        "hw-address": "66:53:f3:00:00:0a",
        "ip-address": "4.0.0.32",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:06",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000006",
        "hw-address": "66:53:f3:00:00:06",
        "ip-address": "4.0.0.33",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:05",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000005",
        "hw-address": "66:53:f3:00:00:05",
        "ip-address": "4.0.0.34",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      }
    ]
  },
  "result": 0,
  "text": "10 IPv4 lease(s) found."
}
[root at dhcp1 ~]#
-------------- next part --------------
[root at dhcp1 ~]# cat /var/tmp/kea-dhcp4.conf
#DHCPv4 192.168.0.125
{
"Dhcp4": {
    "valid-lifetime": 300,
    "renew-timer": 150,
    "rebind-timer": 200,
    "server-tag": "192.168.0.125",
      "control-socket": {
            "socket-name": "/usr/local/kea4-ctrl-socket",
            "socket-type": "unix"
        },
      "sanity-checks": {
        "lease-checks": "fix-del"
     },
     "multi-threading": {
       "enable-multi-threading": true,
       "thread-pool-size": 4,
       "packet-queue-size": 16
    },
    "lease-database": {
        "type": "memfile",
        "persist": true,
        "name": "/usr/local/db/dhcp4.leases"
    },

   "interfaces-config": {
        "interfaces": ["eth0"]
  },

"hooks-libraries": [
            {
                "library": "/usr/local/lib/kea/hooks/libdhcp_lease_cmds.so",
                "parameters": { }
            },
           #Testing the comments flow
            {
                "library": "/usr/local/lib/kea/hooks/libdhcp_bootp.so",
                "parameters": { }
            }
],
            "subnet4": [{
        "subnet": "4.0.0.0/16",
        "valid-lifetime": 86400,
                 "option-data": [
                    {
                        "data": "8.8.8.8, 8.8.8.4",
                        "name": "domain-name-servers"
                    },
                    {
                     "data": "86400",
                     "name": "dhcp-lease-time"
                    },
                    {
                        "data": "4.0.0.1",
                        "name": "routers"
                    }
                ],
            "pools": [
            {
                "pool": "4.0.0.130 - 4.0.0.230"
            }
        ]


                }],
         "loggers": [
        {
            "name": "kea-dhcp4",
            "debuglevel": 99,
            "output_options": [
                {
                    "output": "/var/log/kea-dhcp4.log"
                }
            ],
            "severity": "DEBUG"
        }
    ]
}
}

[root at dhcp1 ~]#
-------------- next part --------------
[root at dhcp1 ~]# /usr/bin/echo '{"command":"lease4-get-all"}' | /usr/bin/socat - UNIX:/usr/local/kea4-ctrl-socket | /usr/bin/jq
{
  "arguments": {
    "leases": [
      {
        "client-id": "01:66:53:f3:00:00:04",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000004",
        "hw-address": "66:53:f3:00:00:04",
        "ip-address": "4.0.0.25",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:02",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000002",
        "hw-address": "66:53:f3:00:00:02",
        "ip-address": "4.0.0.26",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:01",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000001",
        "hw-address": "66:53:f3:00:00:01",
        "ip-address": "4.0.0.27",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:07",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000007",
        "hw-address": "66:53:f3:00:00:07",
        "ip-address": "4.0.0.28",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:03",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000003",
        "hw-address": "66:53:f3:00:00:03",
        "ip-address": "4.0.0.29",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:08",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000008",
        "hw-address": "66:53:f3:00:00:08",
        "ip-address": "4.0.0.30",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:09",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000009",
        "hw-address": "66:53:f3:00:00:09",
        "ip-address": "4.0.0.31",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:0a",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-00000a",
        "hw-address": "66:53:f3:00:00:0a",
        "ip-address": "4.0.0.32",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:06",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000006",
        "hw-address": "66:53:f3:00:00:06",
        "ip-address": "4.0.0.33",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:53:f3:00:00:05",
        "cltt": 1682313370,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l747-client-10000-000005",
        "hw-address": "66:53:f3:00:00:05",
        "ip-address": "4.0.0.34",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:56:f3:00:00:03",
        "cltt": 1682313830,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l748-client-10000-000003",
        "hw-address": "66:56:f3:00:00:03",
        "ip-address": "4.0.0.130",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:56:f3:00:00:05",
        "cltt": 1682313830,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l748-client-10000-000005",
        "hw-address": "66:56:f3:00:00:05",
        "ip-address": "4.0.0.131",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:56:f3:00:00:06",
        "cltt": 1682313830,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l748-client-10000-000006",
        "hw-address": "66:56:f3:00:00:06",
        "ip-address": "4.0.0.132",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:56:f3:00:00:07",
        "cltt": 1682313830,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l748-client-10000-000007",
        "hw-address": "66:56:f3:00:00:07",
        "ip-address": "4.0.0.133",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:56:f3:00:00:01",
        "cltt": 1682313830,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l748-client-10000-000001",
        "hw-address": "66:56:f3:00:00:01",
        "ip-address": "4.0.0.134",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:56:f3:00:00:09",
        "cltt": 1682313830,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l748-client-10000-000009",
        "hw-address": "66:56:f3:00:00:09",
        "ip-address": "4.0.0.135",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:56:f3:00:00:04",
        "cltt": 1682313830,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l748-client-10000-000004",
        "hw-address": "66:56:f3:00:00:04",
        "ip-address": "4.0.0.136",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:56:f3:00:00:0a",
        "cltt": 1682313830,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l748-client-10000-00000a",
        "hw-address": "66:56:f3:00:00:0a",
        "ip-address": "4.0.0.137",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:56:f3:00:00:02",
        "cltt": 1682313830,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l748-client-10000-000002",
        "hw-address": "66:56:f3:00:00:02",
        "ip-address": "4.0.0.138",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      },
      {
        "client-id": "01:66:56:f3:00:00:08",
        "cltt": 1682313830,
        "fqdn-fwd": false,
        "fqdn-rev": false,
        "hostname": "l748-client-10000-000008",
        "hw-address": "66:56:f3:00:00:08",
        "ip-address": "4.0.0.139",
        "state": 0,
        "subnet-id": 1,
        "valid-lft": 86400
      }
    ]
  },
  "result": 0,
  "text": "20 IPv4 lease(s) found."
}
[root at dhcp1 ~]#


More information about the Kea-users mailing list