How does DHCP distribute or choose which IP to give within the scope?
There is something strange happening with my OpenWrt firmware. The scope for my DHCP is 100 to 250 in the 192.168.1.*
range but the first IP it gave is 192.168.1.189
.
Is there any reason it started from 189? Can it be random? I'm sure I have some static IPs configured but only 3 or 4 in the 100 - 200 range.
How does DHCP distribute or choose which IP to give within the scope?
Note: I am using the Gargoyle firmware based on OpenWrt (which works pretty well).
I realize this is an old question, but...
I believe Gargoyle (and many other third-party firwares for routers) use dnsmasq for their DNS/DHCP service, which by default gives an IP based on a hash of the device's MAC address. The documentation gives a little more detail:
--dhcp-sequential-ip
Dnsmasq is designed to choose IP addresses for DHCP clients using a hash of the client's MAC address. This normally allows a client's address to remain stable long-term, even if the client sometimes allows its DHCP lease to expire. In this default mode IP addresses are distributed pseudo-randomly over the entire available address range. There are sometimes circumstances (typically server deployment) where it is more convenient to have IP addresses allocated sequentially, starting from the lowest available address, and setting this flag enables this mode. Note that in the sequential mode, clients which allow a lease to expire are much more likely to move IP address; for this reason it should not be generally used.
The client can request to use the ip it had last.