[Dnsmasq-discuss] Cannot setup DHCP

Simon Kelley simon@thekelleys.org.uk
Wed, 01 Dec 2004 17:22:13 +0000

Roy Marples wrote:

> I've seen this behaviour too with dhcpcd, but cannot get to the bottom
> of it. I think it's dhcpcd's fault
> If an entry exists for the host in dnsmasq.leases, then dhcpcd gets it's
> address just fine and everything is dandy. If there is not an entry,
> then dhcpcd times out - but still gets its information and an entry
> appears in dnsmasq.leases
> Other dhcp clients (dhclient, pump, udhcpc) do not have this problem
> with dnsmasq. I was hoping to test dhcpcd against another dhcp server
> before reporting this myself though.

The behaviour Roy is describing is something different, which I've seen 
before and understand. It's not the same thing that Ilya is seeing, 
because it doesn't cause dnsmasq to complain about not finding a DHCP range.

Roy, the problem you are seeing is because of the Gentoo patch to dhcpcd 
to add the -z closedown option. That causes dhcpcd to send a DHCPRELEASE 
message to the DHCP server, so it forgets all about the lease, but 
dhcpcd _remembers_ the lease. (Unlike the -k flag, which is in the 
upstream dhcpcd)

When dhcpcd starts up again, it tries to renew the old lease which it 
had, but about which dnsmasq knows nothing (because of the RELEASE). The 
relevant RFC says that under those circumstances, a DHCP server should 
remain silent, since the request is broadcast, and might mean something 
to another DHCP server on the network. In this case there is no other 
DHCP server, so dhcpcd eventually times out and start the DHCP process 
from the start, and everything works.

There's two ways around the problem, either don't use dhcpcd -z to close 
down the network, or add "dhcp-authoritative" to /etc/dnsmasq.conf. That 
tells dnsmasq to assume that it's the only DHCP server around, so it can 
send a DHCPNAK in response to the request for an existing lease it 
doesn't know about, avoiding the need for the timeout.

The dhcp-authoritative option was added to dnsmasq in reposonse to a bug 
report from a Gentoo user, the ISC dhcpd has an analogous option: