有没有办法将 dnsmasq 与流行的 urlblacklist.com 列表整合起来?
我考虑过用 -A 标志添加所有条目,但那是很多dnsmasq 要处理的主机数量,特别是在低功耗 ARM 设备上,每次需要更新黑名单时我都需要编写一个脚本来解析黑名单,所以我希望总体上有一个更好的方法。
为了阐明 -A 标志,取自 dnsmasq 的手册页:
-A, --address=/<domain>/[domain/]<ipaddr>
Specify an IP address to return for any host in the given domains.
Queries in the domains are never forwarded and always replied to with
the specified IP address which may be IPv4 or IPv6. To give both IPv4
and IPv6 addresses for a domain, use repeated -A flags. Note that
/etc/hosts and DHCP leases override this for individual names. A
common use of this is to redirect the entire doubleclick.net domain to
some friendly local web server to avoid banner ads. The domain
specification works in the same was as for --server, with the
additional facility that /#/ matches any domain. Thus
--address=/#/1.2.3.4 will always return 1.2.3.4 for any query not
answered from /etc/hosts or DHCP and not sent to an upstream
nameserver by a more specific --server directive.
答案1
这最佳广告拦截方法:dnsmasq完全按照您的要求进行操作。
urlblacklist 配置文件位于/etc/dnsmasq.d/
:/etc/dnsmasq.d/dbab.adblock.conf
,格式如下
address=/101com.com/192.168.2.101
address=/101order.com/192.168.2.101
...
有关详细信息,请参阅
https://sfxpt.wordpress.com/2015/11/22/dbab-from-start-to-finish/
在“常见问题解答:如何将这些不良网站列入黑名单“。
来自博客:
- 阻止访问广告网站从 DNS 级别。
- 所有广告将被 1×1 像素的 gif 图像取代本地服务由 Pixelserv 服务器
答案2
听起来您正在寻找的是 pihole-FTL,它是 dnsmasq 的修改版本,专为基于 DNS 的 URL/域名阻止而设计。