[Dnsmasq-discuss] Same IP for a range of MAC addresses?

Tom Metro tmetro+dnsmasq at gmail.com
Sat Apr 4 02:03:07 BST 2009


Stephen Lee wrote:
> I have an Ubuntu notebook that is running dnsmasq. It is used to program
> some IP devices. Each device is expecting the same IP to access it and it
> they all need to get the same IP via dhcp. Does that make sense?

So it is effectively a closed network with just the laptop and your IP 
device on it, and the network only exists for the duration of the 
programming session?


> I've read this FAQ but it would be impractical if hundreds or even
> thousands of devices are involved. Currently I've written a script to
> detect when the ethernet cable is unplugged after programming a device and
> to restart dnsmasq. This then allows the same IP to be leased out again
> but to a different MAC. An ugly kludge but it works...

I take it you can't create a dhcp-host line that keys off some other 
attribute that is common to the IP devices, like a client ID?

Given your limited requirements of a DHCP server (seeing as it will only 
be used for these IP devices during a programming session), there are 
probably some easy hacks you could perform on the Dnsmasq source to get 
it to hand out a static IP address to all requests. (Or maybe using an 
even simpler DHCP server, like udhcpd.)

Another option might be using DBus. I don't know the extent of 
information available and settings possible, but you might be able to 
listen for new leases being granted, and immediately purge them.

If you aren't relying on Dnsmasq to provide name lookups of the DHCP 
assigned IP address, another thing that may work is substituting 
/dev/null for the lease file. That way Dnsmasq will have no memory of 
any existing leases (unless it caches that info in memory also).

  -Tom

-- 
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: http://tmetro.venturelogic.com/



More information about the Dnsmasq-discuss mailing list