[Dnsmasq-discuss] How may is too many CNAME references?

Simon Kelley simon at thekelleys.org.uk
Mon Sep 27 19:42:47 UTC 2021


On 26/09/2021 20:06, Ercolino de Spiacico wrote:
> I have a working script to block ads via ads-blocker public-lists based
> on dnsmasq.
> 
> The dnsmasq.additional file is populated with a long list of
> address=/baddomain/0.0.0.0
> 
> It works fine but I was trying to improve speed/RAM usage so I've tried
> for a test to switch to a CNAME format, so:
> 
> host-record=no,0.0.0.0
> cname=baddomain,no
> cname=baddomain2,no
> etc
> 
> If the list of cnames is relatively short (say 300 references) it works
> no problem and dnsmasq restart (needed to reload the config) is almost
> instant; but if the cname list grows big a restart takes really long
> time. I always run dnsmasq --test before restarting and the syntax is
> reported to be OK.
> 
> Is there a limit on how many cname you can have in a config file?
> Why a difference in behaviour between ADDRESS and CNAME?
> 

As others have said, CNAME processing checks for duplicates in the naive
manner.


ad-blocking using host-record= or address= is the recommended way to do
it, and the newest release of dnsmasq (2.87) has significant
enhancements top both speed and memory for address=



Using host-record in place of your cnames, or upgrading to 2.87 and
going back to using address=

Cheers,


Simon.

> Thanks!
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
> 




More information about the Dnsmasq-discuss mailing list