关键字: openwrt, smartdns, adguardhome, openclash, 分流, 缓存, 去广告
目的: openclash 分流, smartdns 缓存DNS, adguardhome 去广告
设备及系统信息:

实现效果:


思路: smartdns 作为 openclash 上游服务器, openclash 作为 adguardhome 上游服务器
smartdns:
第一服务器


第二服务器

上游服务器 分组 CHINA

上游服务器 分组 GW

openclash:
全局设置 - 运行模式

全局设置 - DNS 设置

自定义 DNS 服务器

adguardhome
使用 53 端口 代替 dnsmasq

DNS 设置




DHCP and DNS 高级设置
Network -> DHCP and DNS -> Advanced Settings

附录
smartdns 配置
file: /etc/config/smartdns
config smartdns
option server_name 'CHINA'
option port '6913'
option tcp_server '1'
option ipv6_server '1'
option dualstack_ip_selection '1'
option serve_expired '1'
option resolve_local_hostnames '1'
option force_aaaa_soa '0'
option force_https_soa '0'
option rr_ttl_min '172800'
option rr_ttl_max '345600'
option seconddns_port '7913'
option seconddns_tcp_server '1'
option seconddns_force_aaaa_soa '0'
option coredump '0'
option seconddns_server_group 'GW'
option auto_set_dnsmasq '0'
option seconddns_no_rule_ipset '0'
option seconddns_no_rule_soa '0'
option cache_size '2000000'
option seconddns_no_speed_check '1'
option seconddns_no_dualstack_selection '0'
option seconddns_no_rule_addr '1'
option seconddns_no_rule_nameserver '0'
option seconddns_no_cache '0'
option prefetch_domain '1'
option enabled '1'
option seconddns_enabled '1'
option old_port '6913'
option old_enabled '1'
option old_auto_set_dnsmasq '0'
config server
option enabled '1'
option name 'DNSPod DNS'
option ip '119.29.29.29'
option type 'udp'
option server_group 'CHINA'
option blacklist_ip '0'
config server
option enabled '1'
option name 'DNSPod DNS'
option ip '182.254.116.116'
option type 'udp'
option server_group 'CHINA'
option blacklist_ip '0'
config server
option enabled '1'
option name '114DNS'
option ip '114.114.114.114'
option type 'udp'
option server_group 'CHINA'
option blacklist_ip '0'
config server
option enabled '1'
option name '114DNS'
option ip '114.114.114.115'
option type 'udp'
option server_group 'CHINA'
option blacklist_ip '0'
config server
option enabled '1'
option name '阿里 AliDNS'
option ip '223.5.5.5'
option type 'udp'
option server_group 'CHINA'
option blacklist_ip '0'
config server
option enabled '1'
option name '阿里 AliDNS'
option ip '223.6.6.6'
option type 'udp'
option server_group 'CHINA'
option blacklist_ip '0'
config server
option enabled '1'
option name '腾讯 TenDNS'
option ip '119.29.29.29'
option type 'udp'
option blacklist_ip '0'
option server_group 'CHINA'
config server
option enabled '1'
option name '腾讯 TenDNS'
option ip '182.254.116.116'
option type 'udp'
option server_group 'CHINA'
option blacklist_ip '0'
config server
option enabled '1'
option ip '8.8.8.8'
option server_group 'GW'
option blacklist_ip '0'
option name 'Google DNS'
option port '853'
option type 'tls'
option no_check_certificate '0'
config server
option enabled '1'
option name 'Google DNS'
option ip '8.8.4.4'
option server_group 'GW'
option blacklist_ip '0'
option port '853'
option type 'tls'
option no_check_certificate '0'
config server
option enabled '1'
option name 'V2EX DNS'
option ip '199.91.73.222'
option server_group 'GW'
option blacklist_ip '0'
option port '853'
option type 'tls'
option no_check_certificate '0'
config server
option enabled '1'
option name 'V2EX DNS'
option ip '178.79.131.110'
option server_group 'GW'
option blacklist_ip '0'
option port '853'
option type 'tls'
option no_check_certificate '0'
config server
option enabled '1'
option name 'Cloudflare DNS'
option ip '1.1.1.1'
option server_group 'GW'
option blacklist_ip '0'
option port '853'
option type 'tls'
option no_check_certificate '0'
config server
option enabled '1'
option name 'Cloudflare DNS'
option ip '1.0.0.1'
option server_group 'GW'
option blacklist_ip '0'
option port '853'
option type 'tls'
option no_check_certificate '0'
config server
option enabled '1'
option name 'Open DNS'
option ip '208.67.222.222'
option server_group 'GW'
option blacklist_ip '0'
option port '853'
option type 'tls'
option no_check_certificate '0'
config server
option enabled '1'
option name 'Open DNS'
option ip '208.67.220.220'
option server_group 'GW'
option blacklist_ip '0'
option port '853'
option type 'tls'
option no_check_certificate '0'
config server
option enabled '1'
option name '威瑞信 DNS'
option ip '64.6.64.6'
option server_group 'GW'
option blacklist_ip '0'
option port '853'
option type 'tls'
option no_check_certificate '0'
config server
option enabled '1'
option name '威瑞信 DNS'
option ip '64.6.65.6'
option server_group 'GW'
option blacklist_ip '0'
option port '853'
option type 'tls'
option no_check_certificate '0'
config server
option enabled '1'
option name 'Google DNS'
option ip '2001:4860:4860::8888'
option type 'udp'
option server_group 'GW'
option blacklist_ip '0'
config server
option enabled '1'
option name 'Google DNS'
option ip '2001:4860:4860::8844'
option type 'udp'
option server_group 'GW'
option blacklist_ip '0'
config server
option enabled '1'
option name 'Cloudflare DNS'
option ip '2606:4700:4700::1111'
option type 'udp'
option server_group 'GW'
option blacklist_ip '0'
config server
option enabled '1'
option name 'Cloudflare DNS'
option ip '2606:4700:4700::1001'
option type 'udp'
option server_group 'GW'
option blacklist_ip '0'
adguardhome 配置:
file: /etc/AdGuardHome.yaml
用户名: admin 密码: adminadmin
bind_host: 0.0.0.0
bind_port: 3000
beta_bind_port: 0
users:
- name: admin
password: $2a$10$tK6Zv2oPzAm.IyqSBXmhNu2VALRNGO/FaiFqfEV60Ne9t.MHygUse
auth_attempts: 5
block_auth_min: 15
http_proxy: ""
language: ""
debug_pprof: false
web_session_ttl: 720
dns:
bind_hosts:
- 0.0.0.0
port: 53
statistics_interval: 7
querylog_enabled: true
querylog_file_enabled: true
querylog_interval: 168h
querylog_size_memory: 1000
anonymize_client_ip: false
protection_enabled: true
blocking_mode: nxdomain
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:7874
upstream_dns_file: ""
bootstrap_dns:
- 127.0.0.1:6913
all_servers: true
fastest_addr: false
fastest_timeout: 1s
allowed_clients: []
disallowed_clients: []
blocked_hosts:
- version.bind
- id.server
- hostname.bind
trusted_proxies:
- 127.0.0.0/8
- ::1/128
cache_size: 0
cache_ttl_min: 0
cache_ttl_max: 0
cache_optimistic: false
bogus_nxdomain: []
aaaa_disabled: false
enable_dnssec: false
edns_client_subnet: false
max_goroutines: 300
handle_ddr: true
ipset: []
ipset_file: ""
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:
- tiktok
upstream_timeout: 10s
private_networks: []
use_private_ptr_resolvers: true
local_ptr_upstreams: []
serve_http3: false
use_http3_upstreams: false
tls:
enabled: false
server_name: ""
force_https: false
port_https: 443
port_dns_over_tls: 853
port_dns_over_quic: 853
port_dnscrypt: 0
dnscrypt_config_file: ""
allow_unencrypted_doh: false
certificate_chain: ""
private_key: ""
certificate_path: ""
private_key_path: ""
strict_sni_check: false
filters:
- enabled: true
url: https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt
name: AdGuard DNS filter
id: 1628750870
- enabled: true
url: https://anti-ad.net/easylist.txt
name: 'CHN: anti-AD'
id: 1628750871
- enabled: true
url: https://adaway.org/hosts.txt
name: AdAway Default Blocklist
id: 1666183470
- enabled: true
url: https://someonewhocares.org/hosts/zero/hosts
name: Dan Pollock's List
id: 1666183471
- enabled: true
url: https://raw.githubusercontent.com/DandelionSprout/adfilt/master/GameConsoleAdblockList.txt
name: Game Console Adblock List
id: 1666183472
- enabled: true
url: https://abp.oisd.nl/basic/
name: OISD Blocklist Basic
id: 1666183473
- enabled: true
url: https://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus&showintro=1&mimetype=plaintext
name: Peter Lowe's List
id: 1666183474
- enabled: true
url: https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt
name: Perflyst and Dandelion Sprout's Smart-TV Blocklist
id: 1666183475
- enabled: true
url: https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareAdGuardHome.txt
name: Dandelion Sprout's Anti-Malware List
id: 1666183476
- enabled: true
url: https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt
name: NoCoin Filter List
id: 1666183477
- enabled: true
url: https://raw.githubusercontent.com/durablenapkin/scamblocklist/master/adguard.txt
name: Scam Blocklist by DurableNapkin
id: 1666183478
- enabled: true
url: https://raw.githubusercontent.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites/master/hosts
name: The Big List of Hacked Malware Web Sites
id: 1666183479
- enabled: true
url: https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-agh-online.txt
name: Online Malicious URL Blocklist
id: 1666183480
- enabled: true
url: https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/abpindo.txt
name: 'IDN: ABPindo'
id: 1666183481
- enabled: true
url: https://raw.githubusercontent.com/DRSDavidSoft/additional-hosts/master/domains/blacklist/unwanted-iranian.txt
name: 'IRN: Unwanted Iranian domains'
id: 1666183482
- enabled: true
url: https://filtri-dns.ga/filtri.txt
name: 'ITA: Filtri-DNS'
id: 1666183483
- enabled: true
url: https://raw.githubusercontent.com/yous/YousList/master/hosts.txt
name: 'KOR: YousList'
id: 1666183484
- enabled: true
url: https://raw.githubusercontent.com/cchevy/macedonian-pi-hole-blocklist/master/hosts.txt
name: 'MKD: Macedonian Pi-hole Blocklist'
id: 1666183485
- enabled: true
url: https://easylist-downloads.adblockplus.org/easylistdutch.txt
name: 'NLD: Easylist'
id: 1666183486
- enabled: true
url: https://raw.githubusercontent.com/DandelionSprout/adfilt/master/NorwegianExperimentalList%20alternate%20versions/NordicFiltersAdGuardHome.txt
name: 'NOR: Dandelion Sprouts nordiske filtre'
id: 1666183487
- enabled: true
url: https://raw.githubusercontent.com/MajkiIT/polish-ads-filter/master/polish-pihole-filters/hostfile.txt
name: 'POL: Polish filters for Pi hole'
id: 1666183488
- enabled: true
url: https://raw.githubusercontent.com/lassekongo83/Frellwits-filter-lists/master/Frellwits-Swedish-Hosts-File.txt
name: 'SWE: Frellwit''s Swedish Hosts File'
id: 1666183489
- enabled: true
url: https://abpvn.com/android/abpvn.txt
name: 'VNM: ABPVN List'
id: 1666183490
- enabled: true
url: https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt
name: WindowsSpyBlocker - Hosts spy rules
id: 1666183491
- enabled: true
url: https://gitee.com/xinggsf/Adblock-Rule/raw/master/rule.txt
name: AdGuard Rule
id: 1666188951
- enabled: true
url: https://gitee.com/xinggsf/Adblock-Rule/raw/master/mv.txt
name: AdGuard MV
id: 1666188952
- enabled: true
url: http://sub.adtchrome.com/adt-chinalist-easylist.txt
name: China Eazy List
id: 1666188954
- enabled: true
url: https://www.i-dont-care-about-cookies.eu/abp/
name: I don't Care About Cookies
id: 1666188955
- enabled: true
url: https://gist.githubusercontent.com/Ewpratten/a25ae63a7200c02c850fede2f32453cf/raw/b9318009399b99e822515d388b8458557d828c37/hosts-yt-ads
name: Youtube Ads List
id: 1666188956
- enabled: true
url: https://malware-filter.gitlab.io/malware-filter/phishing-filter-agh.txt
name: Phishing URL Blocklist (PhishTank and OpenPhish)
id: 1668442517
- enabled: true
url: https://raw.githubusercontent.com/AssoEchap/stalkerware-indicators/master/generated/hosts
name: Stalkerware Indicators List
id: 1668442518
- enabled: true
url: https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-agh.txt
name: Malicious URL Blocklist (URLHaus)
id: 1668442519
- enabled: true
url: https://raw.githubusercontent.com/bkrucarci/turk-adlist/master/hosts
name: 'TUR: turk-adlist'
id: 1668442521
- enabled: true
url: https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/aghome.txt
name: 'IDN: ABPindo'
id: 1668442522
- enabled: true
url: https://raw.githubusercontent.com/MasterKia/PersianBlocker/main/PersianBlockerHosts.txt
name: 'IRN: PersianBlocker list'
id: 1668442523
- enabled: true
url: https://raw.githubusercontent.com/Cats-Team/AdRules/main/dns.txt
name: 'CHN: AdRules DNS List'
id: 1668442524
- enabled: true
url: https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
name: Steven Black's List
id: 1668442525
- enabled: true
url: https://abp.oisd.nl/
name: OISD Blocklist Full
id: 1668442526
- enabled: true
url: https://badmojr.gitlab.io/1hosts/Lite/adblock.txt
name: 1Hosts (Lite)
id: 1668442527
- enabled: true
url: https://block.energized.pro/spark/formats/filter
name: Energized Spark
id: 1668442528
- enabled: true
url: https://raw.githubusercontent.com/notracking/hosts-blocklists/master/adblock/adblock.txt
name: The NoTracking blocklist
id: 1668442529
- enabled: true
url: https://easylist-downloads.adblockplus.org/easylist.txt
name: EasyList
id: 1669274963
- enabled: true
url: https://easylist-downloads.adblockplus.org/easylistchina.txt
name: EasyList China
id: 1669274964
- enabled: true
url: https://easylist-downloads.adblockplus.org/easyprivacy.txt
name: EasyPrivacy
id: 1669274965
- enabled: true
url: https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-easylist.txt
name: Anti-AD
id: 1669274967
- enabled: true
url: https://raw.githubusercontent.com/adbyby/xwhyc-rules/master/lazy.txt
name: AdbybyLazy
id: 1669274968
- enabled: true
url: https://raw.githubusercontent.com/adbyby/xwhyc-rules/master/video.txt
name: AdbybyVideo
id: 1669274969
- enabled: true
url: https://raw.githubusercontent.com/banbendalao/ADgk/master/ADgk.txt
name: ADgk
id: 1669274971
- enabled: true
url: https://raw.githubusercontent.com/banbendalao/ADgk/master/kill-baidu-ad.txt
name: BaiduBaiJia
id: 1669274972
- enabled: true
url: https://raw.githubusercontent.com/zsakvo/AdGuard-Custom-Rule/master/rule/zhihu.txt
name: ZhihuStandard
id: 1669274973
- enabled: true
url: https://raw.githubusercontent.com/zsakvo/AdGuard-Custom-Rule/master/rule/zhihu-strict.txt
name: ZhihuStrict
id: 1669274974
- enabled: true
url: https://raw.githubusercontent.com/jdlingyu/ad-wars/master/hosts
name: Dasheng
id: 1669274976
- enabled: true
url: https://raw.githubusercontent.com/BlueSkyXN/AdGuardHomeRules/master/all.txt
name: BlueSkyXN
id: 1669274977
- enabled: true
url: https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-annoyance.txt
name: CJX's Annoyance List
id: 1669274978
- enabled: true
url: http://winhelp2002.mvps.org/hosts.txt
name: Mvps
id: 1669362850
- enabled: true
url: https://hblock.molinero.dev/hosts
name: Hblock
id: 1669362852
- enabled: true
url: https://raw.githubusercontent.com/VeleSila/yhosts/master/hosts.txt
name: yhosts
id: 1669363016
whitelist_filters:
- enabled: true
url: https://raw.githubusercontent.com/Tunglies/TorrentTracker/main/domains.txt
name: qBbittorrentTrackersDomain
id: 1667976469
user_rules:
- '@@||www.bing.com^$importan'
- '@@||apple.com'
- '@@||www.bing.com^$important'
- '@@||cn.bing.com^$important'
- '@@||t.co^'
- '@@||supes.top^$important'
dhcp:
enabled: false
interface_name: br-lan
local_domain_name: lan
dhcpv4:
gateway_ip: 192.168.1.1
subnet_mask: 255.255.255.0
range_start: 192.168.1.200
range_end: 192.168.1.254
lease_duration: 7200
icmp_timeout_msec: 1000
options: []
dhcpv6:
range_start: 2001::1
lease_duration: 7200
ra_slaac_only: false
ra_allow_slaac: false
clients:
runtime_sources:
whois: true
arp: true
rdns: true
dhcp: true
hosts: true
persistent: []
log_file: ""
log_max_backups: 0
log_max_size: 100
log_max_age: 3
log_compress: false
log_localtime: false
verbose: false
os:
group: ""
user: ""
rlimit_nofile: 0
schema_version: 14
我试过重新启动apache,缓存的页面仍然出现,所以一定有一个文件夹在某个地方。我没有“公共(public)/缓存”,那么我还应该查看哪些其他地方?是否有一个URL标志也可以触发此效果? 最佳答案 您需要触摸一个文件才能清除phusion,例如:touch/webapps/mycook/tmp/restart.txt参见docs 关于ruby-如何在Ubuntu中清除RubyPhusionPassenger的缓存?,我们在StackOverflow上找到一个类似的问题:
尝试在我的RoR应用程序中实现计数器缓存列时出现错误Unknownkey(s):counter_cache。我在这个问题中实现了模型关联:Modelassociationquestion这是我的迁移:classAddVideoVotesCountToVideos0Video.reset_column_informationVideo.find(:all).eachdo|p|p.update_attributes:videos_votes_count,p.video_votes.lengthendenddefself.downremove_column:videos,:video_vot
当我尝试进行bundle安装时,我的gem_path和gem_home指向/usr/local/rvm/gems/我没有写入权限,并且由于权限无效而失败。因此,我已将两个路径都更改为我具有写入权限的本地目录。这样做时,我进行了bundle安装,我得到:bruno@test6:~$bundleinstallFetchinggemmetadatafromhttps://rubygems.org/.........Fetchinggemmetadatafromhttps://rubygems.org/..Bundler::GemspecError:Couldnotreadgemat/afs/
我一直在Heroku上尝试不同的缓存策略,并添加了他们的memcached附加组件,目的是为我的应用程序添加Action缓存。但是,当我在我当前的应用程序上查看Rails.cache.stats时(安装了memcached并使用dalligem),在执行应该缓存的操作后,我得到current和total_items为0。在Controller的顶部,我想缓存我有的Action:caches_action:show此外,我修改了我的环境配置(对于在Heroku上运行的配置)config.cache_store=:dalli_store我是否可以查看其他一些统计数据,看看它是否有效或我做错
我有一个具有页面缓存的ControllerAction,我制作了一个清扫程序,它使用Controller和指定的Action调用expire_page...Controller操作呈现一个js.erb模板,所以我试图确保expire_page删除public/javascripts中的.js文件,但它没有这样做。classJavascriptsController"javascripts",:action=>"lol",:format=>'js')endend...所以,我访问javascripts/lol.js并呈现我的模板。我验证了public/javascripts/lol.js
我的Controller有这个:caches_action:render_ticker_for_channel,:expires_in=>30.seconds在我的路由文件中我有这个:match'/render_c_t/:channel_id'=>'render#render_ticker_for_channel',:as=>:render_channel_ticker在日志文件中我看到了这个:Writefragmentviews/mcr3.dev/render_c_t/63(11.6ms)我如何手动使它过期?我需要从与渲染Controller不同的Controller使它过期,但即使
我在开发和生产中都使用docker,真正困扰我的一件事是docker缓存的简单性。我的ruby应用程序需要bundleinstall来安装依赖项,因此我从以下Dockerfile开始:添加GemfileGemfile添加Gemfile.lockGemfile.lock运行bundleinstall--path/root/bundle所有依赖项都被缓存,并且在我添加新gem之前效果很好。即使我添加的gem只有0.5MB,从头开始安装所有应用程序gem仍然需要10-15分钟。由于依赖项文件夹的大小(大约300MB),然后再花10分钟来部署它。我在node_modules和npm上遇到了
我正在使用Capybara2.1和Ruby1.9.3,使用selenium驱动程序(带有Minitest和测试单元)来测试网络应用程序。我正在努力解决StaleElementReferenceException问题。我已经看到很多关于该主题的讨论,但我无法找到解决我所面临问题的方法。所以基本上,我试图使用以下代码在我的页面上找到所有分页元素:pagination_elements=page.all('.paginationa')然后我对这些元素做一些断言,例如:pagination_elements.first.must_have_content('1')在这些断言之后,我通过单击下一
HTTP缓存是指浏览器或者代理服务器将已经请求过的资源保存到本地,以便下次请求时能够直接从缓存中获取资源,从而减少网络请求次数,提高网页的加载速度和用户体验。缓存分为强缓存和协商缓存两种模式。一.强缓存强缓存是指浏览器直接从本地缓存中获取资源,而不需要向web服务器发出网络请求。这是因为浏览器在第一次请求资源时,服务器会在响应头中添加相关缓存的响应头,以表明该资源的缓存策略。常见的强缓存响应头如下所述:Cache-ControlCache-Control响应头是用于控制强制缓存和协商缓存的缓存策略。该响应头中的指令如下:max-age:指定该资源在本地缓存的最长有效时间,以秒为单位。例如:Ca
我正在构建一个Rails应用程序,该应用程序将基本上包含一组SOAP命令。我不想每次都获取WSDL来实现某种缓存方法,尽管我不太确定从哪里开始执行此操作。是否有特定于Rails的东西可以帮助我,或者我应该通过Ruby下载文件并加载它?只是在寻找某种总体方向...... 最佳答案 如果您使用savon然后是remoteWSDLwillbedownloadedonceperclientinstance:the(remote)WSDLhastobedownloadedandparsedonceforeveryclientandsocome