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

    DHCP lease screen not loading

    Scheduled Pinned Locked Moved DHCP and DNS
    123 Posts 30 Posters 55.1k 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.
    • GertjanG
      Gertjan @karlfife
      last edited by

      Great write-up.
      This is what is needed to find the issue.

      I just looked am my /var/dhcpd/var/db/dhcpd.leases file.
      About 72 Kbytes - 196 leases, and (only) 19 leases have a "client-hostname".
      177 lease entries have no client-hostname at all.
      Still : I never had any issues looking at Status > DHCP leases.

      So, is it ok to think that the presence of absence of a "client-hostname" line in a lease is not the issue ?

      This file : /usr/local/www/status_dhcp_leases.php

      When you place a // in front line 91, like this :

      // $leases = system_get_dhcpleases();
      

      ( do the same thing for the next line 95 - just to be sure )

      Status >> DHCP should show an empty page like this :

      c082c6a1-ddb5-4005-bb8c-e2752cbbde03-image.png

      If still nothing shows up, the issue is not "DHCP" related at all.

      No "help me" PM's please. Use the forum, the community will thank you.
      Edit : and where are the logs ??

      1 Reply Last reply Reply Quote 0
      • C
        chance
        last edited by chance

        I've not reported this, I've actually abandoned ship after 2.5.0 gave me fits with IPSec and GRE tunnels.

        I'm glad you guys are making progress though.

        I would recommend going to the spot where system_get_dhcpleases() is and find the DNS lookup lines. Add an IF the hostname is null (in php obviously) then skip it.

        That should solve the issue.

        I checked in the source on github and this is the file.

        https://github.com/pfsense/pfsense/blob/0f03681f9b16583ac0f6a6b98272ab9b2d11d79e/src/etc/inc/system.inc#L675

        It's already checking for empty, so I assume it's getting a false positive. (or maybe it's not the current version.)

        I think it should be something like this:

        if (preg_match('/}$/', $line)) {
        			if ($lease) {
        				if (empty($item['hostname'])) {
        					$hostname = gethostbyaddr($item['ip']);
        					if (!empty($hostname) &$ empty($hostname) != "") {
        						$item['hostname'] = $hostname;
        					}
        				}
        				$leases['lease'][] = $item;
        				$lease = false;
        				$dedup_lease = true;
        			} else if ($failover) {
        				$leases['failover'][] = $item;
        				$failover = false;
        				$dedup_failover = true;
        			}
        			continue;
        		}
        

        Relevant line I added (&& $hostname != "")
        if (!empty($hostname) && $hostname != "") {

        No idea if it will work or not.

        Nevermind, just comment out the gethostbyaddr line and live without it I guess...

        K GertjanG 2 Replies Last reply Reply Quote 0
        • K
          karlfife @chance
          last edited by karlfife

          @chance
          I believe this is covered in this bug report:
          https://redmine.pfsense.org/issues/11512

          Parallel discussion can be found here:
          https://forum.netgate.com/topic/161121/after-upgrade-to-2-5-status_dhcp_leases-php-nor-diag_arp-php-will-load/13

          1 Reply Last reply Reply Quote 0
          • Z
            zarteg @pette_rsson
            last edited by zarteg

            Turns out I had the same issue.
            Kill your DNS Resolver and try again.

            1 Reply Last reply Reply Quote 0
            • GertjanG
              Gertjan @chance
              last edited by Gertjan

              @chance said in DHCP lease screen not loading:

              Nevermind, just comment out the gethostbyaddr line and live without it I guess...

              The definition of gethostbyaddr is https://www.php.net/manual/fr/function.gethostbyaddr.php

              Look somewhat down n on that page, you find :

              The problem of broken DNS servers.....

              So is this a 'broken DNS issue' after all ?

              No "help me" PM's please. Use the forum, the community will thank you.
              Edit : and where are the logs ??

              1 Reply Last reply Reply Quote 0
              • D
                drumnbisco
                last edited by

                Can confirm, had my primary dns set to 9.9.9.9 for dnssec, switched it to googles and clicked save, dhcp leases status page loaded fine. Switched it back and pages loads fine a 2nd time.

                GertjanG 1 Reply Last reply Reply Quote 0
                • GertjanG
                  Gertjan @drumnbisco
                  last edited by

                  @drumnbisco said in DHCP lease screen not loading:

                  had my primary dns set to 9.9.9.9

                  That means you're forwarding.
                  When forwarding, DNSSEC is meaningless.
                  Stop forwarding, and "dhcp leases status page" loads fine right out of the box.

                  No "help me" PM's please. Use the forum, the community will thank you.
                  Edit : and where are the logs ??

                  D 1 Reply Last reply Reply Quote 0
                  • D
                    drumnbisco @Gertjan
                    last edited by drumnbisco

                    @gertjan
                    I never had an issue loading the DHCP leases page on the previous version. This only happened after I upgraded.

                    I followed this guide https://linuxincluded.com/configuring-quad9-on-pfsense/ which recommended having it checked.

                    GertjanG 1 Reply Last reply Reply Quote 0
                    • GertjanG
                      Gertjan @drumnbisco
                      last edited by

                      @drumnbisco said in DHCP lease screen not loading:

                      This only happened after I upgraded.

                      Most probably, the upgrade just exposed an issue : pfSense itself has no DNS any more.
                      This situation is often experiences by users that have no LAN issues (DNS issues for LAN clients) but wonder why pfSense doesn't propose updates any more.

                      No working DNS for pfSense itself also means that the DHCP status generation page doesn't work any more, as every DNS request fails after 'many seconds'. If you have many DHCP leases, the page construction will takes minutes, or far more : the page takes forever to get generated, the browser or web server will finally bail out.

                      Yet another good reason NOT to forward or NOT to change any DNS settings.
                      Because the ones with default DNS settings do never experience " DHCP status page' " issues.
                      And if you forward : ok, but be ready to do some testing every time there is an issue. Even if the issue doesn't seem to be DNS related.
                      Like : can I load and update the list with proposed pfSense packages ?
                      Is this

                      03e939d7-a1c8-4758-b669-117d320c6e5d-image.png

                      actual ?

                      check system logs.
                      check DNS logs.

                      I've just checked this myself :
                      I 'killed' unbound by pressing :

                      310bfaa0-4a67-46d7-8a88-13199273c358-image.png

                      Then I visited the Status DHCP Leases page.
                      It wouldn't load any more - that is : it loads partially. The "wheel" kept on spinning turning for minutes .....
                      When I started unbound, the page loaded instantly.

                      No "help me" PM's please. Use the forum, the community will thank you.
                      Edit : and where are the logs ??

                      P 1 Reply Last reply Reply Quote 0
                      • P
                        plague311 @Gertjan
                        last edited by plague311

                        @gertjan said in DHCP lease screen not loading:

                        @drumnbisco said in DHCP lease screen not loading:

                        This only happened after I upgraded.

                        Most probably, the upgrade just exposed an issue : pfSense itself has no DNS any more.
                        This situation is often experiences by users that have no LAN issues (DNS issues for LAN clients) but wonder why pfSense doesn't propose updates any more.

                        No working DNS for pfSense itself also means that the DHCP status generation page doesn't work any more, as every DNS request fails after 'many seconds'. If you have many DHCP leases, the page construction will takes minutes, or far more : the page takes forever to get generated, the browser or web server will finally bail out.

                        Yet another good reason NOT to forward or NOT to change any DNS settings.
                        Because the ones with default DNS settings do never experience " DHCP status page' " issues.
                        And if you forward : ok, but be ready to do some testing every time there is an issue. Even if the issue doesn't seem to be DNS related.
                        Like : can I load and update the list with proposed pfSense packages ?
                        Is this

                        03e939d7-a1c8-4758-b669-117d320c6e5d-image.png

                        actual ?

                        check system logs.
                        check DNS logs.

                        I've just checked this myself :
                        I 'killed' unbound by pressing :

                        310bfaa0-4a67-46d7-8a88-13199273c358-image.png

                        Then I visited the Status DHCP Leases page.
                        It wouldn't load any more - that is : it loads partially. The "wheel" kept on spinning turning for minutes .....
                        When I started unbound, the page loaded instantly.

                        I'm not really sure what most of this means, mind you I'm a network\systems administrator that has a degree in this, but this doesn't make a lot of sense.

                        In my situation, which I believe is much like drumnbisco's issue, there was never an issue with DNS. I was able to get the proposed upgrade button, that's how I upgraded to 2.5 in the first place. The button continued to work as that's how I got upgraded to 2.5.1 while having issues with the DHCP screen. The two weren't connected at all. My pfsense handles DHCP (still) but hands out a DNS to the PiHole, which then handles all of the requests. That configuration is what I've used at my house for over a year or 2, since I installed the PiHole.

                        I'm not sure this is related to the issue anyone here is seeing.

                        GertjanG 1 Reply Last reply Reply Quote 0
                        • GertjanG
                          Gertjan @plague311
                          last edited by

                          @plague311
                          Ah, didn't know about the PiHole ...

                          I rephrase my last (above) post :
                          Stop the DNS - unbound on pfSense, or your PiHole, and you see that the the DHCP lease page doesn't show up any more : it won't come to completion.
                          Because it can't 'resolve' host names any more. And that would explain the issue.

                          You can check easily if 'DNS' is the explication of your issue : "DHCP Lease page not loading " :
                          Disable line https://github.com/pfsense/pfsense/blob/f528b6a9cba18d7f299fdeed8c84f22abb16fcf1/src/etc/inc/system.inc#L742 by putting a
                          //
                          in front of the line.

                          Or make it look like

                          /* $hostname = gethostbyaddr($item['ip']); */
                          

                          if the issue is gone, you know that the issue is that pfSense has no access to a 'DNS'.

                          No "help me" PM's please. Use the forum, the community will thank you.
                          Edit : and where are the logs ??

                          P 1 Reply Last reply Reply Quote 0
                          • P
                            plague311 @Gertjan
                            last edited by

                            @gertjan My issue is already resolved with whatever netgate did with 2.5.1. My DHCP leases screen works without issue now. I didn't have to change anything. Just updated and it started working again.

                            K 1 Reply Last reply Reply Quote 0
                            • K
                              karlfife @plague311
                              last edited by karlfife

                              @plague311
                              Incorrect. v2.5.1 did not resolve the problem.
                              The upgrade temporarily masks the problem.

                              P 1 Reply Last reply Reply Quote 0
                              • P
                                plague311 @karlfife
                                last edited by

                                @karlfife Oh that might be. It's been slow, but worked the few times I've needed to use it. Admittedly I use pfsense on a VM at my home. It doesn't get a lot of attention since I built it. One of those set it and forget it type of things. Every few weeks I check for updates, that's about it.

                                1 Reply Last reply Reply Quote 0
                                • M
                                  maraun
                                  last edited by

                                  I found the error :-)
                                  The timeout comes by /etc/inc/system.inc
                                  line 735 $hostname = gethostbyaddr($item['ip']);

                                  1 Reply Last reply Reply Quote 2
                                  • B
                                    bobby_hill1983
                                    last edited by bobby_hill1983

                                    I updated to 5.1 the other day and bam my DHCP Leases page stopped working.

                                    I have a pihole and wanted to try some new config options to make it the logging better so I turned on Conditional Forwarding in the pihole for hostname resolution.

                                    I also took the pihole's IP out of "System > General Setup > DNS Servers field."

                                    Once I put the IP back in to the DNS Servers field under General Setup the DHCP page started working again instantly. Up until this point which coincides with my upgrade of pfsense I never had this issue and I always had the IP of my DNS server (pihole) in that field. EDIT: I also turned off Conditional Forwarding on the pihole before this so thought it was this but it was actually CF. Removing the DNS from General Setup did not cause it since it was set under DHCP Server settings as well.

                                    I also had the IP of the pihole in "Services > DHCP Server > LAN" under Servers > DNS Servers. So in conclusion for my setup that existed this way for many years, removing the DNS IP from General Setup borked my DHCP page. Don't know why and I did that in an attempt to make the logging more accurate on the pihole.

                                    EDIT: Use Conditional Forwarding is the issue actually on the pihole settings. I was tinkering and ultimately it was only this causing it. Some sort of loopback thing?
                                    Leaving this message for future self-researchers. I am stupid to not just use pfBlockerNG but I love my little pi with LCD screen and PADD.

                                    1 Reply Last reply Reply Quote 1
                                    • E
                                      easpem
                                      last edited by

                                      Same problem here after upgrading to 2.5.0 and keeps happening after upgrading to 2.5.1
                                      Deleting dchp.leases works for a short time, then fails to load again.

                                      Same goes when opening /diag_arp.php.
                                      Our setup is quite standard, just openvpn-client-export package.

                                      K GertjanG 2 Replies Last reply Reply Quote 0
                                      • K
                                        karlfife @easpem
                                        last edited by

                                        @easpem Not fixed in the 2.5.2 update just pushed.
                                        I'm surprised that this hasn't been fixed yet because it's a crippling regression. There's been a ticket open accurately describing the issue since early this year. I haven't had time to fix it myself, or I would have done so, but still I'm surprised that more of the user base isn't complaining about it, thus pushing it up the priority list for the normal developers (who could fix it in a fraction of the time it would take an outsider like me).

                                        A 1 Reply Last reply Reply Quote 0
                                        • GertjanG
                                          Gertjan @easpem
                                          last edited by

                                          @easpem said in DHCP lease screen not loading:

                                          after upgrading to 2.5.1

                                          You mean 2.5.2 ?

                                          If the issue is still the same, that is, (see above) "gethostbyaddr()" times out, then it means that pfSense itself can't resolve. There is a DNS issue on pfSense.
                                          Disable the function.
                                          Or, undo whatever you did with DNS. I propose that you use the default settings.
                                          Also, just to be sure : when you install pfSense using the default settings, then it uses the settings present when it came out of the box, then it works, right ? So now you're able to create the moment when it stops working.
                                          This step is important.

                                          Btw "gethostbyaddr()" is a standard C language kernel function. It exists for every operating system. It uses the IP address as an argument, and asks the local DNS (accessible by 127.0.0.1 or localhost) to reverse resolve that IP, so it's gets a host name back.
                                          For whatever reasoon this doesn't work any more.
                                          So I think, as I never saw this issue myself, that there is something wrong with the 'DNS setup'.

                                          No "help me" PM's please. Use the forum, the community will thank you.
                                          Edit : and where are the logs ??

                                          1 Reply Last reply Reply Quote 0
                                          • A
                                            ANRt @karlfife
                                            last edited by

                                            @karlfife The ultimate fix that I settled on was migrating to Opnsense. That was the only thing that completely resolved this issue.

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