[Dnsmasq-discuss] Enforcing IP
Simon Kelley
simon at thekelleys.org.uk
Thu May 18 16:45:59 BST 2006
Peter Surda wrote:
> Hello,
>
> under certain circumstances, which I can't describe precisely yet (faulty
> client, packet loss, ...), it may happen that a dhcp client isn't satisfied
> with the IP dnsmasq offers. In that case, dnsmasq sometimes offers a lease
> with a different IP, even if its config files say that the request with that
> specific MAC should get the one originally offered (dhcp-host=blablabla).
> What's worse, it remembers the new ip as a valid lease, and "forgets" about
> the manual definition.
>
> From what I found out, this isn't a bug in dnsmasq, or more precisely, dnsmasq
> doesn't initiate this behaviour. Unfortunately, sometimes the cause isn't
> easy to get rid of. Would it be possible to add a new option to dnsmasq, to
> insist on a manually defined lease even if for some reason the client isn't
> happy with it?
The DHCP protocol doesn't really provide a way for the DHCP server to
"insist" on an IP address if the client doesn't want it. The server
offers an address, and the client can either accept it or reject it. If
the client rejects the address, then offering it again is a bad idea:
most DHCP clients are pretty dumb, and offering the same address will
just get client and server into an endless loop where the server offers
an address, then the client rejects it, then the server offers the same
address and the server rejects it again, and so on forever.
To avoid this, dnsmasq tries very carefully to never offer the same
address after it has been rejected. For "ordinary" hosts without a fixed
address, it changes the address offered, and for hosts with a
dhcp-host=<address> configuration, it disables the address configuration
(and logs that it has done so.) This causes the host to be treated as an
ordinary host instead and allocated a pool address instead.
As far as I can see, the only viable alternative behaviour would be to
fail completely to give an address in this circumstance. That behaviour
can be configured by forcing the host onto a dhcp-range which is static
addresses only. I guess that's what Heinz has.
Cheers,
Simon.
More information about the Dnsmasq-discuss
mailing list