[Kea-users] Some duplicates leases on my Lease File

Darren Ankney darren.ankney at gmail.com
Sun Jan 8 13:27:22 UTC 2023


see analysis in-line below


> On Jan 6, 2023, at 9:04 AM, Marcos Renato da Silva Junior <marcos.silva at unesp.br> wrote:
> 
> Context, I was only using one subnet. No duplication. I added two more subnets and configured shared network and the duplication only happens in these two subnets.
> 
> I'm using high availability (load-balancing), and lease-update is ok. One lease per update.
> 
> I noticed that some leases have a dot after hostname. ( sltecpc3. / sltecpc4 )

I’m not seeing the sltecpc4 listed below in the config so I couldn’t guess at what the difference is.  However, if you are trying 
to perform ddns updates using these hostnames you set (which I don’t see in your config below), then you may want to set

"ddns-qualifying-suffix": “<some domain.com>",

so that something comes after the ‘.' (‘.’ being the root zone I think your ddns update would not be functional).

Or you could not set that and set your hostnames in the reservation to the FQDN which would let you use different domain names, 
if required.

> 
> 
> server1# /var/lib/kea/kea-leases4.csv.2
> 
> 192.168.2.151,00:e1:4c:11:01:d6,,86400,1673091914,2,0,0,sltecpc3.,0,
> 
> server1# /var/lib/kea/kea-leases4.csv
> 
> 192.168.2.151,00:e1:4c:11:01:d6,,86400,1673096386,2,0,0,administrator.,0,
> 192.168.2.151,00:e1:4c:11:01:d6,,86400,1673096386,2,0,0,sltecpc3.,0,
> 
> 
> server2# /var/lib/kea/kea-leases4.csv.2
> 
> 192.168.2.151,00:e1:4c:11:01:d6,,86400,1673091914,2,0,0,sltecpc3.,0,
> 
> server2# /var/lib/kea/kea-leases4.csv
> 
> 192.168.2.151,00:e1:4c:11:01:d6,,86400,1673096386,2,0,0,sltecpc3.,0,

I would guess that this particular lease was served from server1 so server2 never received the duplication.

This duplication might actually be normal.  The lease file .csv is appended to by Kea during normal operation.  
Periodically, a process called 'kea-lfc’ is executed by the 'kea-dhcp4’ process to clean/rotate this leases.csv file.
It is normal to see many entries in the leases.csv with sort of a history between ‘lfc-interval’.  I was curious 
(as you were) as to why this same lease appeared twice with two different hostnames.

> 
> server2# /etc/kea/kea-dhcp4.conf
> 
> {
> "Dhcp4": {
>     "interfaces-config": {
>         "interfaces": [ "eth0" ]
>     },
>     "control-socket": {
>         "socket-type": "unix",
>         "socket-name": "/tmp/kea4-ctrl-socket"
>     },
>     "lease-database": {
>         "type": "memfile",
>         "lfc-interval": 3600
>     },
>     "expired-leases-processing": {
>         "reclaim-timer-wait-time": 3600,    
>         "flush-reclaimed-timer-wait-time": 25,
>         "hold-reclaimed-time": 172800,    
>         "max-reclaim-leases": 100,
>         "max-reclaim-time": 250,
>         "unwarned-reclaim-cycles": 5
>     },
>     "renew-timer": 43200,
>     "rebind-timer": 64800, 
>     "valid-lifetime": 86400,
>     "hooks-libraries": [
>         {
>             "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_lease_cmds.so",
>             "parameters": { }
>         },
>         {
>             "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_ha.so",
>             "parameters": {
>                 "high-availability": [ {
>                     "this-server-name": "server2",
>                     "trust-anchor": "/usr/lib/x86_64-linux-gnu/kea/kea-ca.crt",
>                     "cert-file": "/usr/lib/x86_64-linux-gnu/kea/kea-client.crt",
>                     "key-file": "/usr/lib/x86_64-linux-gnu/kea/kea-client.key", 
>                     "mode": "load-balancing",
>                     "heartbeat-delay": 10000,
>                     "max-response-delay": 60000,
>                     "max-ack-delay": 5000,
>                     "max-unacked-clients": 0,
>                     "sync-timeout": 60000,
>                     "delayed-updates-limit": 100,
>                     "peers": [
>                          {
>                              "name": "server1",
>                              "url": "http://server1:8000/" <http://server1:8000/>,
>                              "role": "primary",
>                              "auto-failover": true
>                          },
>                          {
>                              "name": "server2",
>                              "url": "http://server2:8000/" <http://server2:8000/>,
>                              "role": "secondary",
>                              "auto-failover": true
>                          }
>                      ]
>                  } ]
>             }
>         }
>     ],
>     
>     "host-reservation-identifiers": [ "hw-address" ],
>     
>     "match-client-id": false,
>     
>     "shared-networks": [
>         {
>             "name": "vlan-2",
>     "subnet4": [
>         {
>             "subnet": "192.168.1.0/24",
>             "interface": "eth0",
>             "reservations-global": false,
>             "reservations-in-subnet": true,
>             "reservations-out-of-pool": true,
>             "option-data": [
>                 {
>                     "name": "routers",
>                     "data": "192.168.1.10"
>                 },
>                 {
>                     "name": "domain-name-servers",
>                     "data": "192.168.1.17, 192.168.1.18"
>                 },
>                 {
>                     "name": "domain-name",
>                     "data": "domain"
>                 },
>                 {
>                     "name": "domain-search",
>                     "data": "domain",
>                     "always-send": true
>                 }
>             ],
>             "reservations": [
>                 { "hostname": "sl1pc", "hw-address": "00:00:00:00:00:00", "ip-address": "192.168.1.2" }             
>             ]
>         },
>         {
>             "subnet": "192.168.2.0/24",
>             "interface": "eth0",
>             "reservations-global": false,
>             "reservations-in-subnet": true,
>             "reservations-out-of-pool": true,
>             "option-data": [
>                 {
>                     "name": "routers",
>                     "data": "192.168.2.10"
>                 },
>                 {
>                     "name": "domain-name-servers",
>                     "data": "192.168.1.17, 192.168.1.18"
>                 },
>                 {
>                     "name": "domain-name",
>                     "data": "domain"
>                 },
>                 {
>                     "name": "domain-search",
>                     "data": "domain",
>                     "always-send": true
>                 }
>             ],
>             "reservations": [
>                 { "hostname": "sltecpc3", "hw-address": "00:e1:4c:11:01:d6", "ip-address": "192.168.2.151” }

This is what I was looking for.  I think what is happening is Kea is first logging the hostname that the client sent with the lease to the leases.csv
and then logging the hostname that is assigned by the reservation here.  I don’t think it’s anything to worry about.  Probably wouldn’t happen if
the client wasn’t sending a hostname (you can confirm with wireshark / tcpdump / or Kea packet log on debug:99 whether client is sending a 
hostname or not)

>             ]
>         },
>         {
>             "subnet": "192.168.3.0/24",
>             "interface": "eth0",
>             "reservations-global": false,
>             "reservations-in-subnet": true,
>             "reservations-out-of-pool": true,
>             "option-data": [
>                 {
>                     "name": "routers",
>                     "data": "192.168.3.10"
>                 },
>                 {
>                     "name": "domain-name-servers",
>                     "data": "192.168.1.17, 192.168.1.18"
>                 },
>                 {
>                     "name": "domain-name",
>                     "data": "domain"
>                 },
>                 {
>                     "name": "domain-search",
>                     "data": "domain",
>                     "always-send": true
>                 }
>             ],
>             "reservations": [
>                 { "hostname": "sl2nb", "hw-address": "00:00:00:00:00:00", "ip-address": "192.168.3.2" }
>             ]
>         }
>     ]
>   }
> ],
>     
>     "loggers": [
>     {
>         "name": "kea-dhcp4",
>         "output_options": [
>             {
>                 "output": "/var/log/kea/kea-dhcp4.log",
>                 "maxsize": 10240000,
>                 "maxver": 4
>             }
>         ],
>         "severity": "INFO",
>         "debuglevel": 0
>     }
>   ]
> }
> }
> 
> 
> 
> Em 05/01/2023 21:41, Darren Ankney escreveu:
>> can you share any relevant configurations involving an example device that is exhibiting this behavior?
>> 
>>> On Jan 5, 2023, at 4:15 PM, Marcos Renato da Silva Junior <marcos.silva at unesp.br> <mailto:marcos.silva at unesp.br> wrote:
>>> 
>>> Hi,
>>> 
>>> I seeing some duplicates leases on my Lease File (kea-leases4.csv), apparently one with device hostname and other with dhcp hostname. After LFC the Previous Lease File (kea-leases4.csv.2) seems ok. Its normal?
>>> 
>>> /var/lib/kea/kea-leases4.csv
>>> 
>>> 192.168.0.100,00:00:00:00:00:00,,86400,1673038783,3,0,0,device-hostname.,0,
>>> 192.168.0.100,00:00:00:00:00:00,,86400,1673038783,3,0,0,dhcp-hostname.,0,
>>> 
>>> -- 
>>> Marcos Renato da Silva Junior
>>> Universidade Estadual Paulista - Unesp
>>> Faculdade de Engenharia de Ilha Solteira - FEIS
>>> Departamento de Engenharia Elétrica - DEE
>>> 15385-000 - Ilha Solteira/SP
>>> (18) 3743-1164
>>> 
>>> -- 
>>> 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 <mailto:Kea-users at lists.isc.org>
>>> https://lists.isc.org/mailman/listinfo/kea-users
> -- 
> Marcos Renato da Silva Junior
> Universidade Estadual Paulista - Unesp
> Faculdade de Engenharia de Ilha Solteira - FEIS
> Departamento de Engenharia Elétrica - DEE
> 15385-000 - Ilha Solteira/SP
> (18) 3743-1164
> -- 
> 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/20230108/8fc9c438/attachment-0001.htm>


More information about the Kea-users mailing list