[Dnsmasq-discuss] ignoring unknown devices ..

Ben abnormaliti at clivepeeters.com.au
Sun Nov 25 22:36:29 GMT 2007


Simon Kelley wrote:
> 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.
>   

Thanks for the reply Simon, it is appreciated.

The MAC of the host, 'tc01',  that requires a static is not put into the 
'#hostsfile#', but i have tried it both ways.  The only entry that 
should match is the "dhcp-host=tc01,10.7.5.13" in the main config file.

So the order "client-id, then by MAC address and finally by hostname" 
should be honored, right? 

I will re-test because it has been a while.

Ben




More information about the Dnsmasq-discuss mailing list