[Dnsmasq-discuss] Method to re-acquire client leases after server reboots?

Simon Kelley simon at thekelleys.org.uk
Mon Jan 2 19:02:18 GMT 2006


Dan Flett wrote:
> Hi,
> 
> I use dnsmasq with OpenWRT on the WRT54G router.  These routers store their
> lease files in RAM in /tmp/dhcp.leases.  They do occasionally need rebooting
> when they become unstable.  Is there a way for dnsmasq to re-acquire the
> leases after a reboot?  It's a bit annoying to not be able to ping clients
> by their hostname when the lease file is lost.  Can dnsmasq force clients to
> renew their leases early if they aren't in the lease file?  Or should I just
> give the clients short leases?
> 

There's no way to force all clients to renew, though when they do renew, 
dnsmasq should cope even if it has record of the lease.

The solution here is probably to keep the lease file on the flash 
filesystem: Dnsmasq has a special compile-time flag which enables a mode 
in which

1) The lease file gets written less often (to save wear on the Flash)
2) The lease expiry times don't depend on a battery-backed real-time clock.

and which is meant for just this sort of situation. It looks like the 
OpenWRT aren't enabling it.

Since we've just found another OpenWRT potential misconfiguration in 
another thread here, it looks like it's time to troop off to the OpenWRT 
list and provide some advice.

In the meantime, if you're happy to hack, try changing

#undef HAVE_BROKEN_RTC
#define HAVE_ISC_READER

in src/config.h

to be

#define HAVE_BROKEN_RTC
#undef HAVE_ISC_READER

recompiling, and changing the OpenWRT startup script to save the lease 
file on the flash filesystem.

Cheers,

Simon.






More information about the Dnsmasq-discuss mailing list