[Dnsmasq-discuss] dnsmasq DHCP timing?

Simon Kelley simon@thekelleys.org.uk
Thu, 16 Dec 2004 09:52:41 +0000

Gordon Croft wrote:
> Hello List…
> We have a small LAN connected to the rest of the corporate network 
> through a single router and have just got dnsmasq running on an Alpha 
> box with Debian.  It seems to work great except for one thing.  When we 
> enable the DHCP part and a client sends a DHCP Discover, the offers come 
> back from other DHCP servers past our router before the offer comes from 
> dnsmasq.  We would prefer the offer came from the Alpha box first so we 
> could take advantage of the dnsmasq’s ability to cache DNS queries and 
> lookup host names in the /etc/hosts file, ETC.  The offer from dnsmasq 
> seems to take about one second whereas the offer from the other servers 
> is seen in milliseconds.

The delay is because dnsmasq checks to see is an address is in use 
before offering it. This is a last-ditch check to catch machines which 
have have addresses assigned manually, or misconfiguration of DHCP 
server(s). The check involves sending an ICMP echo request (a "ping") 
and waiting for a reply. The wait is about 1.5 seconds, which is the 
delay you are seeing. It's not possible to configure dnsmasq not to do this.

Note that you can't in general have multiple DHCP servers on a network 
unless they know about each other; otherwise there's nothing to stop 
each server allocating the same address to a different machine. The ISC 
dhcp server supports failover pairs which communicate with each other: 
dnsmasq doesn't. (It's not reaaly in dnsmasq's small, easy to configure 

It's also worth noting that DHCP server outages are not normally very 
critical, unless you use very short lease lengths. When a DHCP server 
goes away, nothing at all will happen to configured clients for half the 
lease length, and if the DHCP server comes back before then, everything 
will recover automatically and transparently.

> Is there some sort of configuration that tells dnsmasq to wait before it 
> sends the offer?  We could, of course, go into the router and turn off 
> the DHCP ‘helper’ function which is sending the DHCP offer to the other 
> servers, but I’d rather not do that – I’d like to have the ‘insurance’ 
> that comes from multiple DHCP servers.

In your position, I would just shut down the DHCP helper.

> Any help appreciated.