The Best Ad Blocking Method with dnsmasq is doing exactly as what you are asking for.
The urlblacklist config file is under /etc/dnsmasq.d/
: /etc/dnsmasq.d/dbab.adblock.conf
, exactly in the format of
address=/101com.com/192.168.2.101 address=/101order.com/192.168.2.101 ...
For details refer to
https://sfxpt.wordpress.com/2015/11/22/dbab-from-start-to-finish/
In the section "Faq: How to blacklist those bad sites".
From the blog:
- Block accessing to the ad sites from the DNS level.
- All ads will be replaced by a 1×1 pixel gif image served locally by the Pixelserv server