[Dnsmasq-discuss] ignoring unknown devices ..

Simon Kelley simon at thekelleys.org.uk
Fri Nov 23 16:57:51 GMT 2007


Ben wrote:
> I need to setup dnsmasq to ignore unknown devices and I have been able
> to do so with 2.40 but I have a configuration issue that I think may be
> a bug.
> 
> Here is what i want to have.
> 
>    dhcp-range=10.7.5.100,10.7.5.254,24h
>    dhcp-ignore=#known
>    dhcp-hostsfile=/etc/dnsmasq.d/#hostsfile#
> 
>    dhcp-host=tc01,10.7.5.13
>    dhcp-host=tc02,10.7.5.14
> 
> This should, in theory, allocate IPs to devices with  MAC addresses
> listed in the '#hostsfile#' and devices named 'tc01' and 'tc02'.  But
> when "dhcp-ignore=#known" is defined 'tc01' and 'tc02' are ignored.
> 
> This config works, but requires the MAC for 'tc01' to be defined.
> 
>    dhcp-range=10.7.5.100,10.7.5.254,24h
>    dhcp-ignore=#known
>    dhcp-hostsfile=/etc/dnsmasq.d/#hostsfile#
> 
>    dhcp-host=00:20:4a:9c:52:c2,10.7.5.13,tc01
> 
> So what i am looking for is to be able to use "#known" and "hostsfile"
> as well as allocate fixed IPs to devices by name.
> 
> Is this by design or a bug?

It's difficult to classify it as either: it's just a limitation.

If you have a line in /etc/dnsmasq.d/#hostsfile# with am MAC address,
that's precisely equivalent to putting

dhcp-host=<MAC address>

in /etc/dnsmasq.conf.

That doesn't do what you want because the information about a host is
spread over more than one dhcp-host directive. For each DHCP
transaction, dnsmasq searches for exactly one dhcp-host directive (it
searches by client-id, then by MAC address and finally by hostname)

In your case it will find the MAC address but then stops searching and
never finds the IP address and hostname.


Putting everything into one line works, as you found out, another
possibility is to put (MAC address, IP address) or (MAC address,
hostname) pairs in /etc/ethers. These are matched against (and combined
with) dhcp-host lines.


Cheers,

Simon.

> 
> Ben
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 




More information about the Dnsmasq-discuss mailing list