DHCP Leases Slow to Update

OpenWRT/LuCl OpenWrt 19.07.4 r11208-ce6496d796 running on Linksys WRT3200ACM. I have about 25 devices connected to the network DHCP but for some reason the Status-Overview screen only starts out showing a couple of them. Slowly, VERY slowly, over a period of hours, it will display more devices. Not very acceptable, I am accustomed to real time displays of my router's DHCP leases. Any troubleshooting leads? Any add-on that will show me all the devices on my network in real time?

No real troubleshooting leads unfortunately, other than to mention that on the rare occasion mine populates slowly going to another tab and then coming back in a few seconds usually shows all the devices listed.

Just because you've rebooted the router does not mean the clients in your network lose their lease. Unless the link really goes physically down, the clients retain their existing IP address and won't contact the dhcpd about it until (half of-) the lease time has run out - only then the router has a chance to take note of them, grant them a new lease lease (respectively renew the existing one) and add it to the list.

4 Likes

Or set up extroot and change the DHCP lease file location to a persistent one.

3 Likes

Somehow I don't think persistent memory is an issue, the WRT3200ACM has plenty of it.. As I write this the router has been up a little over 5 hours since last reboot, and it looks like all devices have finally shown up in the list (23 devices). As a test I connected to the wireless network with a laptop and it appeared virtually instantly at the top of the list.

So then I rebooted, and when it first came up the Active DHCP leases was empty, nada, even though all 23 devices were still connected. I waited 3 minutes before submitting this forum post, hit refresh for the webpage, and it's still empty. So I assume it will take another 5 hours to populate again. This has GOT to be a bug don't you think?

Which is in line with the 12h leasetime handed out by the dhcpd (dnsmasq) by default, which implies that clients ought to renew their lease after 6h (but are technically allowed to retain it up to 12h). And no, there is no bug here - routers are still coming with 'small' (for whatever definition thereof) and 'fragile' persistent storage, which doesn't handle being written to lightly. Read up on the average life expectancy of a sdhc card in a RaspberryPi, for a rough idea (those are both in a worse (the normal operating systems not trying to avoid writing to /) and a better situation (much more space available for wear leveling and hardware wear-leveling existing in the first place) about that situation.

3 Likes

Writing this about 20 minutes later, 3 devices have appeared. Maybe I don't know what I'm talking about, but I just replaced a Netgear R7000 router that had Tomato firmware, it always showed at least most of the connected devices shortly after boot. I certahinly have no issue with plugging some memory into one of the USB ports on this WRT3200ACM--are you saying that would make the difference? USB and flash memory is cheap, what capacity would you suggest? Is that extroot process the way to add it, or can it be done in the GUI? Thanks!

Have you actually read the overview page?
It says "Active DHCP Leases", not "ARP cache".

Options to make the DHCPd state (albeit admittedly not DHCPv6 state) permanent have been raised as well, but the defaults are not a bug, but behaving as designed - and chosen this way for a reason.

3 Likes

Correct , but that is not the problem.

The problem you are observing is that the lease file is not stored in flash but a temporary filesystem (RAM). This is done to protect the flash.

When you reboot the lease file is lost and is populated as new leases are handed out.

If you follow the suggestion to "Or set up extroot"

Then you don't need to worry about protecting USB flash drive and the lease file is always fresh after a reboot.

4 Likes

Maybe I should slightly redirect this thread--is there a way to simply see what devices are connected to my network? Virtually every wireless home router I have ever used has had a tab that showed connected devices, and further showed whether they were connected by wire or wireless. Perhaps an add-on package that would do this?

You can see wireless devices that are directly connected by going to Network > Wireless in LuCI. For wired devices (and wireless devices whether connected directly or through a different AP) you can look at the ARP table under Status > Routes, or if the router has been up long enough then the DHCP leases table will be populated. However, both of these may contain stale entries (and the DHCP leases table won't show devices that haven't requested an address) so aren't a 100% accurate list.

You could alternatively use something like nmap, but that doesn't have a corresponding LuCI app and would need to be run from the command line.

4 Likes

I guess it would have helped if I had spent more time RTFM, but I'm grateful for your help @krazeh! Maybe at some point the nmap utility will be added to the available packages for LuCl. Meanwhile, the Status-Routes is very useful--I had never looked at that screen because I didn't realize it was the ARP table....