[Dnsmasq-discuss] Safe to use static DHCP allocations within dynamic range?

Simon Kelley simon at thekelleys.org.uk
Tue Oct 20 21:51:40 BST 2015


On 15/10/15 12:39, Ed W wrote:
> Hi, I'm not quite clear from the manual pages, so can I please get a
> definitive answer:
> 
> - Am I safe to use to assign a static IP allocation using --dhcp-host
> options, *within* an IP range allocated using --dhcp-range ?
> 
> Specifically, whilst I realise that dnsmasq will first ping to see if an
> IP is unused:
> - Will there be a hard mask on the IP being handed out dynamically as a
> result of the --dhcp-host option?
> - ie if the static allocated device is missing from the network for some
> long period of time, am I "safe" from having a dynamic device "pinch" my
> static IP?

Yes. Addresses withing the dynamic range which appear as static
allocations are protected from being handed out to other clients.
> 
> Corner case:
> - What happens if there is currently a lease allocated to IP w.x.y.z,
> and I setup a static --dhcp-host allocation for that IP and a
> *different* mac, ie this lease needs to be booted off.  Assuming the
> lease is technically not expired, and I disconnect the (now errant)
> device from the network and reconnect it, will it be able to regain it's
> (technically still not expired) lease, or will dnsmasq observe the
> static allocation, expire the lease and allocate a new dynamic allocation?

For the duration of the existing lease, the existing owner will get to
keep it. If the address is set as static for a MAC and that MAC asks for
a lease, it will be offered a different address, and a message logged
about why. Once the lease expires, the existing owner will not be able
to renew the lease, and will move address. Once that's happened, the
static-MAC will also not be able to renew its lease, and will move
address to the originally allocated static address.

> 
> 
> Background:
> - I do realise it's best practice to have a separate static range
> outside of the dynamic allocation range
> - For various technical reasons this environment would be massively
> simpler if it were possible to safely allocate static allocations
> *inside* the dynamic range and have them protected and always available
> (ie even if the machine is offline for a long period)
> 
> 

exec-summary. If you have static allocations in the dynamic range, all
will be fine. If you add a new allocation in the dynamic range for an
unused address, all will be fine. If you add a new allocation for an
address that's already in use, all will eventually be fine, but clients
will be move addresses to make it so.

Cheers,

Simon.



Cheers,

Simon.





More information about the Dnsmasq-discuss mailing list