Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    DHCP server is not releasing expired lease

    Scheduled Pinned Locked Moved DHCP and DNS
    31 Posts 4 Posters 4.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sdugoten
      last edited by sdugoten

      alt text

      As you can see from the picture, dhcp lease page showing a lot of expired/offline lease, but it still tag to an IP address.

      The problem is that these IP address would not be reuse until you manually delete these expired lease. You can see that one of the IP isn't reuse since 2022/12/29.

      And i am getting error in the log saying "no free leases", which doesn't make sense because there are IP address avaialble and not being reused since 2022 December...

      I wonder how to solve this problem?

      G 1 Reply Last reply Reply Quote 0
      • G
        guile @sdugoten
        last edited by

        @sdugoten

        did u try this?

        Go to: Status > DHCP Leases

        Click on button "Clear ALL DHCP Leases"

        Screenshot_1.png

        S 1 Reply Last reply Reply Quote 0
        • S
          sdugoten @guile
          last edited by

          @guile I tried that already, after manually click on that button and erased the expired lease, those IP address got reuse again.

          The problem is, DHCP server should have been re-use these IP address without someone manually intervene the process. I wouldn't expect a DHCP server wouldn't re-use an IP address that was last used in 2022 Dec and need someone to manually delete the entry. That sounds like a problem to me, at least this is not how other DHCP server works.

          G johnpozJ 3 Replies Last reply Reply Quote 0
          • G
            guile @sdugoten
            last edited by

            @sdugoten can u post your DHCP server settings?

            S 1 Reply Last reply Reply Quote 0
            • G
              guile @sdugoten
              last edited by

              @sdugoten

              If u cant post your settings try to reduce the dhcp lease time.. like 1 hour.

              S 1 Reply Last reply Reply Quote 0
              • S
                sdugoten @guile
                last edited by

                @guile said in DHCP server is not releasing expired lease:

                @sdugoten can u post your DHCP server settings?

                It's just stock settingm, nothing fancy...

                alt text

                1 Reply Last reply Reply Quote 0
                • johnpozJ
                  johnpoz LAYER 8 Global Moderator @sdugoten
                  last edited by

                  @sdugoten said in DHCP server is not releasing expired lease:

                  DHCP server should have been re-use these IP address without someone manually intervene the process

                  completely agree, that is how it is suppose to work.. I have a bunch of expired leases in my one vlan. When I get a chance going to try and duplicate the problem by changing the scope to not have any space left other than expired and see what happens.

                  But yeah dhcp server should use expired leases once its free leases are used up..

                  An intelligent man is sometimes forced to be drunk to spend time with his fools
                  If you get confused: Listen to the Music Play
                  Please don't Chat/PM me for help, unless mod related
                  SG-4860 24.11 | Lab VMs 2.8, 24.11

                  1 Reply Last reply Reply Quote 0
                  • S
                    sdugoten @guile
                    last edited by sdugoten

                    @guile I doubt the time make any difference, because you see that in the first screenshot I posted, many lease expired back in 2022 Dec........those entries shouldn't exist in that page at all when I have new connection make to the LAN and it complains "no free leases". The logic in the DHCP server is plain wrong.

                    I didn't even know the DHCP server don't re-use those IP address until I got error in the log saying "no free leases"

                    johnpozJ G 2 Replies Last reply Reply Quote 0
                    • johnpozJ
                      johnpoz LAYER 8 Global Moderator @sdugoten
                      last edited by

                      @sdugoten I just looked through redmine, and I didn't see anything related to this. Once I get a chance to duplicate your problem I will put in a redmine if seeing the same thing.

                      But yeah once a lease has expired - should be free to use, once all the actual free IP have been handed out. You should not run into a issue with no leases available unless all leases are active. If there are expired leases - they should be reused and handed out to some new client looking for a lease.

                      You should not have to manually clear old expired leases.

                      An intelligent man is sometimes forced to be drunk to spend time with his fools
                      If you get confused: Listen to the Music Play
                      Please don't Chat/PM me for help, unless mod related
                      SG-4860 24.11 | Lab VMs 2.8, 24.11

                      1 Reply Last reply Reply Quote 0
                      • G
                        guile @sdugoten
                        last edited by guile

                        @sdugoten

                        Try this:

                        Your config:
                        Range: 10.0.1.70 - 10.0.1.180
                        You have 13 static mappings.

                        Change to this:
                        Range: 10.0.1.20 - 10.0.1.255
                        Your 13 static mappings, change to: 10.0.1.1, 10.0.1.2, 10.0.1.3, 10.0.1.4, 10.0.1.5.. and so on.

                        johnpozJ S 2 Replies Last reply Reply Quote 0
                        • johnpozJ
                          johnpoz LAYER 8 Global Moderator @guile
                          last edited by johnpoz

                          @guile while creating a larger scope would be a possible work around to his problem - dhcp server should hand out expired leases when all its free ones are used up. That is the whole point of expiring a lease - so it can be reused, you shouldn't have to clear them manually for them to be available once they are expired.

                          The only thing I could think of that could cause such an issue, is those IPs are actually active - and just don't have a lease from the dhcpd. Dhcp server as you see from his above settings would ping an IP before it hands out an a lease, if something responds to that ping, it shouldn't hand out the lease even if it is expired.

                          I am about to head out, but I have a bunch of old expired leases in one of my vlans, I should be able to duplicate if this is a problem - and not just something odd on his box by reducing the scope to not have free leases available, and only expired ones - and then trying to get a lease it should hand out one of the expired ones.

                          An intelligent man is sometimes forced to be drunk to spend time with his fools
                          If you get confused: Listen to the Music Play
                          Please don't Chat/PM me for help, unless mod related
                          SG-4860 24.11 | Lab VMs 2.8, 24.11

                          1 Reply Last reply Reply Quote 0
                          • S
                            sdugoten @guile
                            last edited by

                            @guile I actually have more fixed IP assigned manually on other devices in the range of 10.0.1.1 to 10.0.1.20 already. I intentionally use 10.0.1.70 - 10.0.1.180 for dynamic IP address. So, there is no static mapping or fixed IP are being used inside this dynamic IP range already.

                            G 1 Reply Last reply Reply Quote 0
                            • G
                              guile @sdugoten
                              last edited by guile

                              @sdugoten @johnpoz

                              So.. maybe create a script to stop dhcp service, delete dhcp leases file and start dhcp service and CRON it ?!

                              johnpozJ 1 Reply Last reply Reply Quote 0
                              • johnpozJ
                                johnpoz LAYER 8 Global Moderator @guile
                                last edited by

                                @guile again that would be a work around.. Let me try and duplicate and then create a redmine so they can correct it. dhcp server should reuse expired leases.. You shouldn't have to create a cron to clear them, etc.

                                An intelligent man is sometimes forced to be drunk to spend time with his fools
                                If you get confused: Listen to the Music Play
                                Please don't Chat/PM me for help, unless mod related
                                SG-4860 24.11 | Lab VMs 2.8, 24.11

                                G 1 Reply Last reply Reply Quote 0
                                • G
                                  guile @johnpoz
                                  last edited by

                                  @johnpoz i understand.. but im developer, the workaround its in my veins 😊

                                  johnpozJ 1 Reply Last reply Reply Quote 0
                                  • johnpozJ
                                    johnpoz LAYER 8 Global Moderator @guile
                                    last edited by johnpoz

                                    @guile so seems I don't even have to change my scope - clearly all of my IPs from that scope are expired already..

                                    So I just need to fire up something on that vlan and see if it gets one of those expired leases. I don't normally fire up stuff on that vlan - other than to just temp get it on the network, then I assign it a reservation (outside the scope).

                                    expired.jpg

                                    I don't recall having any issues recently - and from looking at the dates of the expired, does seem that some have been reused since they are active.. see like 105, 106 and 107.. Hmmm have I not given something a reservation?

                                    But this should make it easy to try and duplicate the problem he is seeing.

                                    edit: from what I see on my leases - it does seem to be handing out expired ones already.. But when I get back I will test and document.. And we can put in a redmine about it to see if anyone else is having the issue. And should be simple enough to force a example by just using a small lease and scope - and then letting them expire and fire up something with a different mac, ec.

                                    An intelligent man is sometimes forced to be drunk to spend time with his fools
                                    If you get confused: Listen to the Music Play
                                    Please don't Chat/PM me for help, unless mod related
                                    SG-4860 24.11 | Lab VMs 2.8, 24.11

                                    G 1 Reply Last reply Reply Quote 0
                                    • G
                                      guile @johnpoz
                                      last edited by

                                      @johnpoz try to fire up some smartphone with randomize MAC active. But first forget the wifi and rejoin.

                                      S 1 Reply Last reply Reply Quote 0
                                      • S
                                        SteveITS Galactic Empire @guile
                                        last edited by

                                        @guile Since you said December, are you on an old version or does it persist across reboots/version upgrades?

                                        Some sort of odd file corruption?

                                        Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                                        When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                                        Upvote 👍 helpful posts!

                                        G johnpozJ S 3 Replies Last reply Reply Quote 0
                                        • G
                                          guile @SteveITS
                                          last edited by

                                          @SteveITS not me. -> @sdugoten

                                          1 Reply Last reply Reply Quote 0
                                          • johnpozJ
                                            johnpoz LAYER 8 Global Moderator @SteveITS
                                            last edited by johnpoz

                                            @SteveITS said in DHCP server is not releasing expired lease:

                                            Some sort of odd file corruption?

                                            Maybe because I can not duplicate the problem - as you saw before my dhcp scope is used.. All the IP in the scope have been handed out.. So I know just phone to that vlan, letting it use a different mac (private stuff)..

                                            And you can see it grabbed an old expired lease .104, and assigned it to my phone connection..

                                            noissue.jpg

                                            What specific version of pfsense are you on? I am on 23.05.1 - I could try and duplicate the problem on my old 2.6 vm, or 2.7 vm - but take me a bet to test it out..

                                            An intelligent man is sometimes forced to be drunk to spend time with his fools
                                            If you get confused: Listen to the Music Play
                                            Please don't Chat/PM me for help, unless mod related
                                            SG-4860 24.11 | Lab VMs 2.8, 24.11

                                            S 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.