使用AdGuardHome自建了一个自用的DNS服务用于抗污染,同时为上游设置国内DNS分流

先决条件

安装好AdGuardHome后,编辑AdGuardHome.yaml设置upstream_dns_file = "/usr/share/adguardhome.upstream",设置all_servers = true,设置cache_optimistic = true

预览

AdGuardHome配置

分流规则

# 安装脚本
curl -o "/usr/local/bin/upstream.sh" "https://raw.githubusercontent.com/TTT-TD/AGH_SELF/main/DNS/upsteam.sh"
chmod +x /usr/local/bin/upstream.sh
/usr/local/bin/upstream.sh

# 创建systemd服务定时更新
curl -o "/etc/systemd/system/upstream.service" "https://raw.githubusercontent.com/TTT-TD/AGH_SELF/main/DNS/upsteam.service"
curl -o "/etc/systemd/system/upstream.timer" "https://raw.githubusercontent.com/TTT-TD/AGH_SELF/main/DNS/upsteam.timer"
systemctl daemon-reload
systemctl enable upstream.timer
systemctl start upstream.timer
systemctl status upstream