[Kea-users] Fetching Active Leases
Shobhith Chikku
shobhithchikku at gmail.com
Thu Jun 8 12:31:02 UTC 2023
Thanks, Darren,
The main issue I face is
1. I have created a scope 3.0.0.10 - 3.0.0.20
2. I have generated leases from that scope.
3. I deleted that scope and created another one in the same subnet 3.0.0.50
- 3.0.0.100.
4. When I fetch the active lease, I am also getting the leases from the
deleted scope 3.0.0.10 - 3.0.0.20 also ( I shouldn't get them right?).
How do I solve this?
I tried the LFC process, which only cleans up the leases from the lease
file, but the memory still has them.
Here is my config file.
{"Dhcp4": {
"interfaces-config": {"interfaces": ["eth0"]},
"authoritative": true,
"multi-threading": {
"packet-queue-size": 16,
"enable-multi-threading": true,
"thread-pool-size": 4
},
"loggers": [{
"debuglevel": 55,
"severity": "DEBUG",
"output_options": [{
"output": "/var/log/kea-dhcp4.log",
"flush": true,
"maxsize": 204800
}],
"name": "kea-dhcp4"
}],
"lease-database": {
"name": "/opt/dhcp/dhcp/db/dhcp4.leases",
"persist": true,
"type": "memfile",
"lfc-interval":60,
},
"hooks-libraries": [{"library":
"/opt/dhcp/lib/kea/hooks/libdhcp_lease_cmds.so"}],
"server-hostname": "server-47",
"control-socket": {
"socket-type": "unix",
"socket-name": "/opt/dhcp/dhcp/kea4-ctrl-socket"
},
"decline-probation-period": 7200,
"sanity-checks": {"lease-checks": "fix-del"},
"subnet4": [{
"subnet": "3.0.0.0/8",
"valid-lifetime": 86400,
"option-data": [
{
"data": "www.shobhith.com",
"name": "domain-name"
},
{
"data": "86400",
"name": "dhcp-lease-time"
},
{
"data": "255.0.0.0",
"name": "subnet-mask"
},
{
"data": "3.0.0.1",
"name": "routers"
}
],
"pools": [{
"client-class": "allow-client",
"pool": "3.0.0.50-3.0.0.100"
}],
"id": 818110
}],
"client-classes": [
{"name": "deny-client"},
{
"test": "(not(member('deny-client')))",
"name": "allow-client"
}
]
}}
Thank you.
On Thu, 8 Jun 2023 at 17:44, Darren Ankney <darren.ankney at gmail.com> wrote:
> Hi Shobhith,
>
> It is difficult to answer without seeing your Kea configuration.
> Speculation would be that the lease is in memory and either not being
> recorded to the file or was removed from the file somehow? When using
> 'memfile' for lease storage, the leases are actually in memory. The
> file is only a record that Kea can use to read the leases back into
> memory in the case it is restarted. Its possible to setup memfile,
> set a filename, and not have leases written to the file if you have
> "persist": false in the lease-database configuration.
>
> Thank you,
>
> Darren Ankney
>
> On Thu, Jun 8, 2023 at 7:10 AM Shobhith Chikku <shobhithchikku at gmail.com>
> wrote:
> >
> > Hi,
> > When I am trying to fetch active leases, even though my lease file is
> empty, I am getting leases when I execute
> > /usr/bin/echo '{"command":"lease4-get-all"}' | /usr/bin/socat -
> UNIX:/opt/tcpwave/timsdhcp/kea4-ctrl-socket | /usr/bin/jq
> > Below mentioned is my lease file
> > cat /opt/test/dhcp/db/dhcp4.leases
> >
> address,hwaddr,client_id,valid_lifetime,expire,subnet_id,fqdn_fwd,fqdn_rev,hostname,state,user_context
> > When I execute lease4-get-all command, I get leases
> > {
> > "arguments": {
> > "leases": [
> > {
> > "client-id": "01:2f:ff:ff:00:00:01",
> > "cltt": 1686215869,
> > "fqdn-fwd": false,
> > "fqdn-rev": false,
> > "hostname": "dhcp-client-000001",
> > "hw-address": "2f:ff:ff:00:00:01",
> > "ip-address": "3.0.0.2",
> > "state": 0,
> > "subnet-id": 818110,
> > "valid-lft": 86400
> > } ]
> > },
> > "result": 0,
> > "text": "10 IPv4 lease(s) found."
> > }
> > Where am I getting this from?
> > Thanks in advance
> > Shobhith
> > --
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20230608/e64978bd/attachment-0001.htm>
More information about the Kea-users
mailing list