[Dnsmasq-discuss] Is there any way to return NXDOMAIN from hosts file (not config file)?

Terry Carmen terry at bupkis.org
Thu May 14 16:23:14 BST 2015


On 05/14/2015 10:20 AM, Maciej Soltysiak wrote:
> Hi Terry,
>
> On Thu, May 14, 2015 at 3:34 PM, Terry Carmen <terry at bupkis.org 
> <mailto:terry at bupkis.org>> wrote:
>
>     I'm running dnsmasq with a large hosts file that contains entries
>     like:
>
>     127.0.0.1 001.adsenser.cn <http://001.adsenser.cn>
>
>     Is there a way to get dnsmasq to return NXDOMAIN instead of
>     127.0.0.1 for these entries?
>
> Absolutely! I also believe that is a far better solution to return 
> NXDOMAIN.
>
> Simon responded to a similar question of mine a while ago [1]
>
> Basically you add:
> server=/double-click.net/ <http://double-click.net/>
>
> You can have multiple domains in one line, remember to end with a /
> server=/double-click.net/other.evil.domain/ 
> <http://double-click.net/other.evil.domain/>
>
> Remember to remove the entries from hosts afterwards.
> Also, I'm not sure if this is a limitation in dnsmasq or somewhere 
> else, but I had a situation where a 'server' line was too long and I 
> had to split it up. I don't have that many domains I filter out. 
> Mostly biggest trackers and place my SmartTV calls.
>
> [1] 
> http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2013q3/007512.html
>

Thanks for the quick response!

I saw your original message, but it seems to be targeted for a config 
file in /etc/dnsmasq.d/, not a hosts file.

Right now my list format is in "hosts" file format of "127.0.0.1 
www.baddomain.com"

I could reformat the file, but was wondering if there was something I 
could substitute for the 127.0.0.1 so dnsmasq would return NXDOMAIN?

Thanks!

Terry






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20150514/10474b6e/attachment.html>


More information about the Dnsmasq-discuss mailing list