When I was in school, our university had a Class B public IP address space. They used public IPs for EVERYTHING and were constantly running out of addresses as more people connected more devices to WiFi. Terribly managed network, but it sounds like the same problem you're having.
The way it works with DHCP is that a device will send out DHCP request packets upon connecting to the network. If a DHCP server responds, it will give out the next available address to the device (if no server responds the device gets a 169.254.x.x address). However - when the device
disconnects, that address is still reserved for the device based on the dhcp lease time, which is configurable on the server. It won't go back into the DHCP "pool" until it hits a timeout. Once the timeout is reached, the DHCP server will see if the device is still connected, and if it isn't, it
will put the address back in the pool to be re-used by another device.
You have a couple of options to solve it:
1. Lower the lease time for DHCP leases - this will ensure that old addresses that are no longer in use are freed back into the DHCP pool sooner (this is the solution our university used)
2. Use a different private IP address space - if you're using a /24 you're limited to 254 addresses (excluding gateway/broadcast address for the subnet). Assuming you're on a 192.168.x.x address, you could change your subnet to a larger mask like /23 (510 addresses) or /22 (1022 address) and
have more space available.
3. Use IPv6 - I know IPv4 is easier, but IPv6 exists for the larger address space. I explicitly disable it on my home network since I don't need it, but it was invented to solve exactly this problem of running out of addresses. You'll need to enable a 6to4 tunnel of some kind at your gateway if
your network's public IP is IPv4, which it probably is, so this is the most pain-in-the-ass option you can go with.
Looking at the source code of DD-WRT is entirely unnecessary with proper network configuration and management. You should really be doing it more as a hobbiest/enthusiast, or contributer since its open source. Here are some wikipedia links that explain some of the basic networking concepts I
mentioned in more detail:
---
class EOSERV {
Programmer | Oldbie
Open source EO Client: https://github.com/ethanmoffat/EndlessClient
};