Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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).

share|improve this question
    
Just a note to: I'm sure I have some static IPs configured but only 3 or 4 in the 100 - 200 range. exclude the static addresses from the DHCP range. If the DHCP doesn't check the IP before delivering you will run in problems. –  boboes Dec 9 at 18:28

2 Answers 2

The client can request to use the ip it had last.

share|improve this answer
    
If the ip is example 192.168.1.124 and it lease.. will his next ip gonna be *.125 ? –  Rushino Nov 12 '11 at 3:25
    
When the client sends a DHCPDISCOVER again (instead of DHCPREQUEST directly) should the server offer the same address for the MAC when the lease time is not over and the address is not assigned to another node? –  harper Dec 3 '13 at 18:16

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.