I am a new user of OpenWRT, but have used DD-WRT many years ago. I’m a reasonably tech savvy person, but this issue has me stumped. I’m sure it will be simple to fix for the “experts” here!
Fresh install of OpenWRT v21.02.3 on Linksys R7800. Default settings in OpenWRT except for creating a root password. My laptop connected directly to a router lan port, gets an IP address as expected and always shows in the DHCP client list. However, when connecting wired Lan clients on an unmanaged switch connected to an R7800 lan port, clients will appear in the DHCP client list, but disappear after a router reboot and never re-appear again. When a Raspberry Pi running Pihole with a fixed IP address is connected directly to the router lan port, it never appears in the DHCP client list. However, I can ssh to the Pihole from the laptop and confirm its IP address with ifconfig. All this was done without enabling any wifi radios. The issue with the DHCP client list occurred regardless of whether or not there was a wan connection to the router.
Two other interesting observations:
I installed OpenWRT v21.02.3 on a new TP-Link AC1750 Archer A7 router, and had the identical experience as with the R7800 on OpenWRT.
I returned to using a “stock” Linksys R6700v3 router running Linksys OEM firmware, reconnected to all my wired and wireless devices and everything works as expected with no issues. All DHCP clients show in the client list.
I have searched to see if this has been reported by others, but I found only one post that was similar. It seems as though I must be doing something stupid/wrong, but I just don’t know what to try. I have done multiple factory resets on the OpenWRT routers, but the result is always the same. There is no other device in my network that could be a DHCP server that might cause a conflict other than the Pihole and that DHCP server is off. I have tried all sorts of combinations of network devices (attached/removed) but just can’t get a setup that reliably shows what is connected.
Any suggestions would be much appreciated. Thanks in advance!
This is because the DHCP lease table is stored in RAM. When you reboot the router, the RAM is cleared.
A device will request a DHCP lease under the following circumstances:
The host connects to a network (wired or wireless)
The port/interface on the host bounces (thus making it like a fresh connection)
The DHCP lease expires.
If the computer's port/interface remains active through the reboot (such as when it is connected to an external switch), the computer will not need to request a DHCP lease until it expires. When that happens, the lease will show up again in the DHCP table on your router.
If the PiHole is using a static/fixed IP (configured on the Pi itself), it will never actually request a DHCP lease and therefore will not show up in the DHCP clients list. If you change the Pi to get an IP via DHCP, it will show up in the DHCP leases.
The DHCP server on your router only impacts the LAN side and is not dependent on anything upstream (like a WAN connection).
This is entirely expected behavior.
As explained earlier, the DHCP clients will be available in the table when they request an IP. It is likely that the stock firmware also uses RAM to store the table, so a reboot of the router (with devices connected to an external switch) may result in the same behavior. It is possible, though, that this is written to internal storage (this would be bad form as it will wear out the flash memory over time, but vendor firmware doesn't necessarily always follow best practices).
There are probably other similar posts, but the bottom line is that the answer would be the same and your experience is entirely expected behavior. It is, in fact, by design that you see this happen.
Thanks so much for such a rapid reply! Your explanation makes sense. My confusion seems to be the result of the differences in how "stock/OEM" firmware works vs OpenWRT I guess?
I have never used a router that didn't show all attached devices regardless of when they requested a lease. If I understand correctly, if I put the OpenWRT router back into service and connect all my networked devices, they will all appear in the list, but if I reboot, they will no longer appear in the list until the lease expires which I think is about 12 hours?
It seems like there should be some way to see what is connected without having to wait until all the leases expire, and it would also be nice to see anything attached with a fixed address. Is there a way to do that in the firmware or would that require running some sort of command in a terminal application? Thanks again!
If you reboot (or better yet, power-cycle) your router running the stock firmware while your devices are connected to an external switch, you probably won't see the leases in the DHCP table after it boots up again. If you do, that means it is writing to flash memory. The long term effect is that this will wear out the flash and cause it to fail due to excessive write cycles. This is sacrificing the hardware lifespan for a minimally useful gain in information. I consider it minimally useful because it isn't all that often that normal users will check their DHCP lease tables, and because of the next point...
you can... if you use the arp and/or ip neigh commands, you should see everything.
Or... just don't reboot your router unless you actually need to (such as when running an upgrade or making major configuration changes). All of your active DHCP leases will remain in RAM and visible as long as the router isn't rebooted.
Keep in mind, the fact that the devices aren't showing up in the router's DHCP lease table after a reboot (and until they renew the lease) doesn't impact connectivity to or from those hosts. It is only relevant if you are looking at the table to "find" a device. An alternative way to keep the tables populated is actually to create DHCP reservations -- this is a method by which the host itself uses DHCP but the router has a persistent table that says "when I see this MAC address, I issue this address."
I was relying on the lease table because I was setting up the new OpenWRT router and just wanted to confirm everything was attaching as expected. When devices disappeared on reboot, that was not something I had ever seen before since I typically used OEM firmware, and I got used to how it worked. I found it easier to lookup devices in the table rather than verifying they were attached by using them (like sending a print job to a printer). I might want to create those DHCP reservations, but now that I understand how things are working it might not be needed. Does setting reservations cause any potential issues?
My reason for setting up two OpenWRT routers is to use one as an AP. I need better wifi coverage in my home and I was hoping to setup the AP with fast roaming. I'm hoping I can move forward with that now that I know the router is working correctly (and I understand it LOL!). Hopefully that can be configured without too many issues, or I'll be back here for more support! Thanks again and have a great weekend!