路由器使用dnsmasq实现广告过滤

  • 简介

路由器上广告过滤可以通过dnsmasq配置实现,dnsmasq是路由器的DNS域名缓存与DHCP服务器二合一,通过DNS域名重定向把广告的地址重定向即可实现广告过滤。dnsmasq的配置文件是/etc/dnsmasq.conf.

  • 方法

编辑/etc/dnsmasq.conf,加入下面一条配置:

[html]  view plain  copy
  1. #add dnsmasq.ads rule list  
  2. conf-file=/etc/dnsmasq.ads  


更新/etc/dnsmasq.ads文件,获取最新的广告域名列表:

[html]  view plain  copy
  1. wget --no-check-certificate -qO - https://easylist-downloads.adblockplus.org/chinalist+easylist.txt | grep ^\|\|[^\*]*\^$ | sed -e 's:||:address\=\/:' -e 's:\^:/127\.0\.0\.1:' > /etc/dnsmasq.ads  
 


重启dnsmasq服务

/etc/init.d/dnsmasq restart
Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐