教程分享——Openwrt使用Smartdns+ADGuard进行DNS组网

2020-09-06 22:11:15 37点赞 256收藏 20评论

前言

本教程的目的是介于目前市面上还有很多使用了垃圾宽带导致日常上网体验及其不稳定的情况下,使用开源服务SmartDns搭配ADGuard进行全套的上网加速功能。本教程适用于各种固件,请自行解决安装问题,文章中示范固件为OpenWrt。

一:SmartDns

1、启用smartdns,端口默认「6053」,开启「域名预加载」,「过期缓存服务」,重定向选择「无」,缓存大小可根据需求填入,这里填入「1024」,域名TTL可根据需求填入,这里填入「30」、域名TTL最小值填入「30」、域名TTL最大值填入「300」.

教程分享——Openwrt使用Smartdns+ADGuard进行DNS组网

2、上游dns服务器可以选择几个公共dns,还可以选配自己带宽自带dns。但是为了减少dns查询次数和时间,一般不建议超过10个,在这里我们只选择1个国内的,例如:

教程分享——Openwrt使用Smartdns+ADGuard进行DNS组网

而且不需要详细设置。

不用怀疑,这里不需要添加国外的DNS,因为在后面会一次性完善。

3、启用第二DNS服务器,端口默认「6553」,开启「TCP服务器」,服务器组填入GLOBAL。

4、自定义设置里填入以下规则:

speed-check-mode ping

server 114.114.114.114 -group CN -check-edns #国内

server 180.76.76.76 -group CN -check-edns #国内

server 223.5.5.5 -group CN -check-edns #国内

server 119.29.29.29 -group CN -check-edns #国内

server 61.132.163.68 -group CN -check-edns #国内

server-tcp 1.1.1.1 -group GLOBAL -check-edns -exclude-default-group #国外

server-tcp 8.8.8.8 -group GLOBAL -check-edns -exclude-default-group #国外

server-tcp 9.9.9.9 -group GLOBAL -check-edns -exclude-default-group #国外

server-tcp 208.67.222.222 -group GLOBAL -check-edns -exclude-default-group #国外

注意:以上自定义规则中的IP都可以自由搭配,根据自己当地运营商情况以及网络自由选择。

二:AdGuard Home

1、首先更新核心版本,然后点击「详细日志」、「开机后网络准备好时重启」、「在关机时备份工作目录文件」所有的√。

重定向方式任选以下其一:

一:「作为dnsmasq的上游服务器」

二:「重定向53端口到ADGuardHome」

教程分享——Openwrt使用Smartdns+ADGuard进行DNS组网

2、打开「手动设置」,把以下的模板文件全部替换进去,然后点击保存并应用。

注:不要点使用模板。

bind_host: 0.0.0.0

bind_port: 3000

users:

- name: root

password: $2a$10$R823NIDOLRWukfXH8L5yRewC8bahsXtjfM/0Pqt6rCdR37dZllveO

http_proxy: ""

language: ""

rlimit_nofile: 0

debug_pprof: false

web_session_ttl: 720

dns:

bind_host: 0.0.0.0

port: 5553

statistics_interval: 7

querylog_enabled: true

querylog_interval: 1

querylog_size_memory: 1000

anonymize_client_ip: false

protection_enabled: true

blocking_mode: default

blocking_ipv4: ""

blocking_ipv6: ""

blocked_response_ttl: 10

parental_block_host: family-block.dns.adguard.com

safebrowsing_block_host: standard-block.dns.adguard.com

ratelimit: 0

ratelimit_whitelist: []

refuse_any: true

upstream_dns:

- 127.0.0.1:6053

- 127.0.0.1:6553

bootstrap_dns:

- 114.114.114.114

- 1.1.1.1

- 2620:fe::10

- 2620:fe::fe:10

all_servers: false

fastest_addr: false

allowed_clients: []

disallowed_clients: []

blocked_hosts: []

cache_size: 4194304

cache_ttl_min: 0

cache_ttl_max: 0

bogus_nxdomain: []

aaaa_disabled: false

enable_dnssec: false

edns_client_subnet: false

filtering_enabled: true

filters_update_interval: 24

parental_enabled: false

safesearch_enabled: false

safebrowsing_enabled: false

safebrowsing_cache_size: 1048576

safesearch_cache_size: 1048576

parental_cache_size: 1048576

cache_time: 30

rewrites: []

blocked_services: []

tls:

enabled: false

server_name: ""

force_https: false

port_https: 443

port_dns_over_tls: 853

allow_unencrypted_doh: false

strict_sni_check: false

certificate_chain: ""

private_key: ""

certificate_path: ""

private_key_path: ""

filters:

- enabled: true

url: https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt

name: uBlock filters

id: 1587388244

- enabled: true

url: https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/badware.txt

name: uBlock filters – Badware risks

id: 1587388245

- enabled: true

url: https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/privacy.txt

name: uBlock filters – Privacy

id: 1587394825

- enabled: true

url: https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/resource-abuse.txt

name: uBlock filters – Resource abuse

id: 1587394826

- enabled: true

url: https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/unbreak.txt

name: uBlock filters -- Unbreak

id: 1587394827

- enabled: true

url: https://filters.adtidy.org/extension/ublock/filters/2_without_easylist.txt

name: AdGuard Base filter

id: 1587394828

- enabled: true

url: https://filters.adtidy.org/extension/chromium/filters/2.txt

name: AdGuard Base filter

id: 1587394829

- enabled: true

url: https://filters.adtidy.org/extension/ublock/filters/11.txt

name: AdGuard Mobile Ads filter

id: 1587394830

- enabled: true

url: https://easylist.to/easylist/easylist.txt

name: EasyList

id: 1587394831

- enabled: true

url: https://easylist.to/easylist/easyprivacy.txt

name: EasyPrivacy

id: 1587394832

- enabled: true

url: https://gitcdn.xyz/cdn/NanoMeow/MDLMirror/d043946ce8ccfdd99a36f224924849616d692c64/hosts.txt

name: Malware Domain List

id: 1587394833

- enabled: true

url: https://mirror.cedia.org.ec/malwaredomains/justdomains

name: justdomains

id: 1587394834

- enabled: true

url: https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext

name: Peter Lowe’s Ad and tracking server list

id: 1587394835

- enabled: true

url: https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjxlist.txt

name: CJX's EasyList Lite

id: 1587394836

- enabled: true

url: https://raw.githubusercontent.com/vokins/yhosts/master/data/tvbox.txt

name: tvbox

id: 1575018007

- enabled: true

url: https://hosts.nfz.moe/full/hosts

name: neoHosts full

id: 1575618240

- enabled: true

url: https://hosts.nfz.moe/basic/hosts

name: neoHosts basic

id: 1575618241

- enabled: true

url: http://sbc.io/hosts/hosts

name: StevenBlack host basic

id: 1575618242

- enabled: true

url: https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD/anti-ad-easylist.txt

name: anti-AD(Adblock+neohosts+yhosts+cjxlist+adhlist)

id: 1577113202

- enabled: true

url: https://gitee.com/xinggsf/Adblock-Rule/raw/master/rule.txt

name: 码云

id: 1592991052

- enabled: true

url: https://gitee.com/xinggsf/Adblock-Rule/raw/master/mv.txt

name: MV

id: 1592991053

- enabled: true

url: http://sub.adtchrome.com/adt-chinalist-easylist.txt

name: ChinaList+EasyList(修正)

id: 1592991058

- enabled: true

url: https://www.daxiaamu.com/wp-content/uploads/files/blocklist.txt

name: blocklist

id: 1592991065

- enabled: true

url: http://git.oschina.net/halflife/list/raw/master/ad.txt

name: My AdFilters

id: 1592991067

- enabled: true

url: https://filters.adtidy.org/extension/chromium/filters/10.txt

name: Filter unblocking search ads and self-promotion

id: 1592991069

- enabled: true

url: https://filters.adtidy.org/extension/chromium/filters/14.txt

name: AdGuard Annoyances filter

id: 1592991070

- enabled: true

url: https://filters.adtidy.org/extension/chromium/filters/3.txt

name: AdGuard Tracking Protection filter

id: 1592991071

- enabled: true

url: https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-annoyance.txt

name: CJX's Annoyance List

id: 1593149805

- enabled: true

url: https://easylist-downloads.adblockplus.org/easylistchina.txt

name: EasyList China

id: 1593149807

whitelist_filters: []

user_rules:

- ""

dhcp:

enabled: false

interface_name: ""

gateway_ip: ""

subnet_mask: ""

range_start: ""

range_end: ""

lease_duration: 86400

icmp_timeout_msec: 1000

clients: []

log_file: ""

verbose: false

schema_version: 6

3、打开AdGuard Home网页,账号密码都是root,点击「过滤器」->「DNS封锁清单」,检查更新即可。

修改密码方法:点击AdGuard Home在OpenWrt的设置页面下方的「更多选项」选择改变网页登录密码点击添加,然后点击载入计算模块,输入你想要的密码,点击计算,最后复制生成的密钥到「手动设置」页面复制进第五行password后面。

4、最新版更新方法:static.adguard.com

教程分享——Openwrt使用Smartdns+ADGuard进行DNS组网

注:lan口设置:设置lan口dns服务器为本机,即127.0.0.1。

碍于某些原因,文章进行了部分删减,太可惜了。

未经授权,不得转载
展开 收起
20评论

发表评论请 登录
  • 最新
  • 最热
评论举报

请选择举报理由

相关好价推荐
查看更多好价

相关文章推荐

更多精彩文章
更多精彩文章
天猫超级红包
距结束::
天猫双11超级红包 每天领3次 金额可叠加
红包按钮
最新文章 热门文章
256
扫一下,分享更方便,购买更轻松