[Dnsmasq-discuss] Detecting when a DHCP client disconnects

Chris Wilson chris+dnsmasq at aptivate.org
Sun Dec 23 15:10:54 GMT 2012


Hi James,

On Sun, 23 Dec 2012, James Harvey wrote:

> I'm trying to detect when a DHCP client state changes, and invoke a script. 
> The dchp-script option works great for new/old leases, but I need to know 
> when client is not longer connected/reachable. Lease duration is 12h 
> currently. 
> 
> I'm keen to avoid having a heartbeat ping out to the client list, but can't 
> think of an alternative. 
> 
> Any suggestions of how to do this would be appreciated. 

There is no protocol at the IP level that can communicate a client 
disconnection. If the client disconnects unexpectedly, it has disconnected, it 
has no way to send any more packets until it's reconnected.

The closest you can get at the IP level is when the client disconnects in an 
expected way, e.g. switching wireless networks or suspending, in which case it 
may choose to release its IP address to the DHCP server, but this is optional, 
not required.

Your best bet if you want to avoid polling individual end stations is to poll 
the switches/access points using DHCP, looking for ports whose links go down or 
wireless clients disassociating (disappearing), and matching their leases using 
the MAC address.

Cheers, Chris.
-- 
Aptivate | http://www.aptivate.org | Phone: +44 1223 967 838
Future Business, Cam City FC, Milton Rd, Cambridge, CB4 1UY, UK

Aptivate is a not-for-profit company registered in England and Wales
with company number 04980791.


More information about the Dnsmasq-discuss mailing list