Page MenuHomeVyOS Platform

Incorrect DHCP lease counting
Closed, ResolvedPublicFEATURE REQUEST

Description

Dear, Developers

I build 2 vyos in vrrp mode. and then I setup dhcp server on 2 vyos in failure over mode. It works great. But I met a problems that is a lot o f duplicate record of lease .

vyos@vrrp01.gctest.net# run show dhcp server  leases 
IP address     Hardware address    Lease expiration     Pool       Client Name
-------------  ------------------  -------------------  ---------  -------------
192.168.1.179  50:00:00:07:00:00   2019/05/11 23:47:28  dhcppool1  client04
192.168.1.177  50:00:00:04:00:00   2019/05/12 00:24:12  dhcppool1  vyosclient02
192.168.1.178  50:00:00:03:00:00   2019/05/12 00:27:03  dhcppool1  vyosclient01
192.168.1.100  50:00:00:06:00:00   2019/05/12 01:17:28  dhcppool1  vyosclient03
192.168.1.100  50:00:00:06:00:00   2019/05/12 01:17:28  dhcppool1  vyosclient03
192.168.1.179  50:00:00:07:00:00   2019/05/12 01:22:59  dhcppool1  client04
192.168.1.179  50:00:00:07:00:00   2019/05/12 01:22:59  dhcppool1  client04
192.168.1.177  50:00:00:04:00:00   2019/05/12 01:59:46  dhcppool1  vyosclient02
192.168.1.177  50:00:00:04:00:00   2019/05/12 01:59:46  dhcppool1  vyosclient02
192.168.1.178  50:00:00:03:00:00   2019/05/12 02:02:30  dhcppool1  vyosclient01
192.168.1.178  50:00:00:03:00:00   2019/05/12 02:02:30  dhcppool1  vyosclient01
[edit]

only 4 ip address was leased but the counting number is 11. That was not right. Can we fixed this issue ?

vyos@vrrp01.gctest.net# run show dhcp server  statistics 
Pool         Size    Leases    Available  Usage
---------  ------  --------  -----------  -------
dhcppool1     154        11          143  0%
[edit]

my vyos version is:

vyos@vrrp01.gctest.net# run show version
Version:          VyOS 1.2.1
Built by:         Sentrium S.L.
Built on:         Sun 14 Apr 2019 12:13 UTC
Build ID:         4ccd819a-db31-452e-b34b-a0b24af4e984

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  Bochs
Hardware model:   Bochs
Hardware S/N:     Unknown
Hardware UUID:    Unknown

Copyright:        VyOS maintainers and contributors
[edit]

Yours Sincerely!
Steve Dong

Details

Difficulty level
Unknown (require assessment)
Version
vyos 1.2.1 release
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

dongjunbo updated the task description. (Show Details)
dongjunbo updated the task description. (Show Details)May 12 2019, 1:59 AM
dongjunbo edited projects, added VyOS 1.2 Crux (VyOS 1.2.0-GA); removed VyOS 1.2 Crux.
dongjunbo changed Version from - to vyos 1.2.1 release.
pasik added a subscriber: pasik.May 23 2019, 6:52 AM
zsdc added a subscriber: zsdc.Jun 4 2019, 12:38 PM

This bug must be fixed in current rolling, because of T1416. @dongjunbo, check this, please.

dmbaturin changed the task status from Open to Needs testing.Jun 22 2019, 11:54 AM
zsdc added a comment.Jun 26 2019, 3:26 PM

Seem like static counting still not right

@dongjunbo, show please the configuration of this router so we could check why gcdomestic pool does not count correctly.

jjakob added a subscriber: jjakob.Jun 26 2019, 5:08 PM

@zsdc I'm thinking of partially rewriting show_dhcp.py soon. You can wait a few days if it's not urgent.
@dongjunbo please attach your /config/dhcpd.leases as a file so we can test the code against it. You can sanitize it manually of MAC addresses if you prefer.

syncer changed the task status from Needs testing to Backport candidate.Aug 31 2019, 12:55 AM
syncer assigned this task to dmbaturin.
syncer triaged this task as Normal priority.
syncer moved this task from Needs Triage to Backlog on the VyOS 1.2 Crux (VyOS 1.2.3) board.
dmbaturin renamed this task from Change dhcp lease couting funcition to Incorrect DHCP lease counting.Nov 17 2019, 6:13 PM
dmbaturin set Is it a breaking change? to Unspecified (possibly destroys the router).
dmbaturin closed this task as Resolved.Nov 17 2019, 6:15 PM
dongjunbo reopened this task as Open.Nov 19 2019, 8:25 AM

Dear, Developers
Seem like the bug still there in vyos 1.2.3 release version

bash
gcadmin@xadns-10-32-0-8:~$ show dhcp server statistics  | strip-private
Pool          Size    Leases    Available  Usage
----------  ------  --------  -----------  -------
gcdomestic     204       837         -633  400%
gclan          766       837          -71  100%
gcserver       766       837          -71  100%
gcwpa2         766       837          -71  100%
gcadmin@xadns-10-32-0-8:~$ show version
Version:          VyOS 1.2.3
Built by:         Sentrium S.L.
Built on:         Fri 13 Sep 2019 11:15 UTC
Build UUID:       bb328444-2f89-4d39-8dab-068278c09194
Build Commit ID:  24f1a74bc88f3a

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  QEMU
Hardware model:   Standard PC (i440FX + PIIX, 1996)
Hardware S/N:
Hardware UUID:    2066b42c-5f89-4f0d-8fc8-d2bfa2f22462

Copyright:        VyOS maintainers and contributors
In T1376#38816, @zsdc wrote:

Seem like static counting still not right

@dongjunbo, show please the configuration of this router so we could check why gcdomestic pool does not count correctly.

show service dhcp-server  shared-network-name gcdomestic  | strip-private
 subnet xxx.xxx.61.0/24 {
     default-router xxx.xxx.61.1
     dns-server xxx.xxx.0.8
     dns-server xxx.xxx.0.18
     domain-name xxxxxx
     lease 7200
     range 0 {
         start xxx.xxx.61.50
         stop xxx.xxx.61.254
     }
 }

Crux needs a backport of show_dhcp.py from current, I fixed this in current

https://github.com/vyos/vyos-1x/blob/current/src/op_mode/show_dhcp.py
https://github.com/vyos/vyos-1x/blob/crux/src/op_mode/show_dhcp.py

Commits:
7a27f6f93b58abd2fabc9e80e429e14a70ebd6aa
9f20bee81c0a0f4632aa152297d0fdf89139d6af

syncer reassigned this task from dmbaturin to jestabro.Jan 1 2020, 1:00 PM
syncer added a subscriber: dmbaturin.
jestabro closed this task as Resolved.Jan 29 2020, 8:57 PM