事情起因

一直看网上说AdGuardHome很好用,但是总【担心】设置完成后,无法访问网络,所以一直没有尝试。
趁着周末,没有去加班,所以就折腾了下AdGuardHome。

一、编译固件

修改feeds.conf.default,然后添加src-git xiaoxiao https://github.com/xiaoxiao29/luci-app-adguardhome.git
在源码中编译luci-app-AdGuardHome即可。
同时可以去掉luci-app-accesscontrol、luci-app-adbyby两个插件。

二、设置openwrt的配置

  1. 等待在ubuntu系统编译完成。登陆进入openwrt。
  2. 更新AdGuardHome,然后启动AdGuardHome。
  3. 设置web管理端口和AdGuardHome端口比如设置为5553。并记录下来。
  4. 修改【网络】-【防火墙】-【自定义规则】,把53端口转发至5553端口。变为:
1
2
3
4
#iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 5553
#iptables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 5553
#[ -n "$(command -v ip6tables)" ] && ip6tables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 5553
#[ -n "$(command -v ip6tables)" ] && ip6tables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 5553
  1. 点击【AdGuardHome web 3000】进入管理页面。

三、剩下的设置如下

  1. 【上游 DNS 服务器】-勾选【并行请求】
1
2
3
4
5
6
7
8
8.8.8.8
tls://dns.pub
https://dns.pub/dns-query
tls://dns.alidns.com
https://dns.alidns.com/dns-query
tls://dns.google
https://dns.google/dns-query
https://dns11.quad9.net/dns-query
  1. 【Bootstrap DNS 服务器】
1
2
3
4
5
6
7
8
9
119.29.29.29
223.5.5.5
8.8.4.4
9.9.9.11
149.112.112.11
119.29.29.29
119.28.28.28
223.5.5.5
223.6.6.6
  1. 【DNS缓存配置】
1
2
3
缓存大小:194304
覆盖最小TTL值:【300】
覆盖最大TTL值:【3600】
  1. 【过滤DNS列表】:进入【服务】-【AdGuardHome】-【手动设置】复制粘贴:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
filters:
- enabled: true
url: https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt
name: AdGuard DNS filter
id: 1
- enabled: true
url: https://adaway.org/hosts.txt
name: AdAway Default Blocklist
id: 2
- enabled: true
url: https://easylist-downloads.adblockplus.org/easylistchina.txt
name: EasyList China
id: 1668217899
- enabled: true
url: https://easylist-downloads.adblockplus.org/fanboy-annoyance.txt
name: 去除页面弹窗广告规则
id: 1668217900
- enabled: true
url: https://easylist-downloads.adblockplus.org/easyprivacy.txt
name: EasyPrivacy 是隐私保护
id: 1668217901
- enabled: true
url: https://www.i-dont-care-about-cookies.eu/abp/
name: 屏蔽网站的 cookies 相关的警告
id: 1668217902
- enabled: true
url: https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-easylist.txt
name: 中文区命中率最高的广告过滤列表Anti-AD
id: 1668217903
- enabled: true
url: https://gitee.com/xinggsf/Adblock-Rule/raw/master/mv.txt
name: 乘风广告过滤规则-去视频广告
id: 1668217904
- enabled: true
url: https://raw.githubusercontent.com/Goooler/1024_hosts/master/hosts
name: 1024网站及澳门皇家赌场及恶意广告主机列表
id: 1668217905
- enabled: true
url: https://raw.githubusercontent.com/zsakvo/AdGuard-Custom-Rule/master/rule/zhihu-strict.txt
name: 知乎(探索版)
id: 1668217906
- enabled: true
url: https://raw.githubusercontent.com/banbendalao/ADgk/master/ADgk.txt
name: ADgk(针对安卓手机推荐)
id: 1668217907
- enabled: true
url: https://raw.githubusercontent.com/jdlingyu/ad-wars/master/hosts
name: 大圣净化(主要针对国内视频网站)
id: 1668217908
  1. 回到web界面,就可以看到路由器下的设备过滤情况了。

  2. 并且发现nas疯狂的访问【downloadtpt.qqlive.qq.com】这个域名。
     上网一查来源,原来是群晖安装的【玩物下载】导致的。卸载了玩物下载之后就停了。

  3. 配置密码:

1
htpasswd -B -n -b <USERNAME> <PASSWORD>

五、屏蔽ios更新检查

adguardhome-过滤器-自定义过滤规则:

1
2
3
4
5
6
||mesu.apple.com^
||appldnld.apple.com^
||xp.apple.com^
||gdmf.apple.com^
||ns.itunes.apple.com^
||gg.apple.com^