Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 打开Openclash以后,网络变得很慢,确定是Openclash开启导致 #4348

Open
5 of 7 tasks
NasserGo opened this issue Feb 26, 2025 · 9 comments
Open
5 of 7 tasks
Labels
bug Something isn't working

Comments

@NasserGo
Copy link

Verify Steps

  • Tracker 我已经在 Issue Tracker 中找过我要提出的问题
  • Branch 我知道 OpenClash 的 Dev 分支切换开关位于插件设置-版本更新中,或者我会手动下载并安装 Dev 分支的 OpenClash
  • Latest 我已经使用最新 Dev 版本测试过,问题依旧存在
  • Relevant 我知道 OpenClash 与 内核(Core)、控制面板(Dashboard)、在线订阅转换(Subconverter)等项目之间无直接关系,仅相互调用
  • Definite 这确实是 OpenClash 出现的问题
  • Contributors 我有能力协助 OpenClash 开发并解决此问题
  • Meaningless 我提交的是无意义的催促更新或修复请求

OpenClash Version

0.46.075

Bug on Environment

Other

OpenWrt Version

Powered by LuCI istoreos-22.03 branch (git-24.339.46321-5f9267c) / ArgonTheme v2.2.10.10 / iStoreOS 22.03.7 2024120615

Bug on Platform

Other

Describe the Bug

开启openclash 规则模式和直连模式时,网络变慢,特别慢。

  • 全局模式不会。

To Reproduce

连接背景

当前openwrt显示连接数在13000左右。

组网环境

  1. 三条宽带通过ikuai路由器接入,负载均衡 1:1:1
  2. iStoreOS(openwrt)直连ikuai
  3. 设置通过交换机或者直连iStoreOS
  4. iStoreOS中安装openclash

测试背景

  • 当局域网设备数增加到一定程度的时候,才会出现,一开始不会出现这种问题。

测试方式

测试流程和表现

  • 测试1:打开openclash(规则模式),电脑通过网线连接上级(ikuai)路由, 快速打开很多网页,可快速打开。 排除上级网络问题。
  • 测试2:打开openclash(规则模式),电脑通过网线直接openclash所在openwrt路由, 快速打开多个百度网页,网页一直大圈儿,甚至无法打开------这也是主要问题。
  • 测试3:打开openclash(直连模式),表现同测试2,依旧存在。
  • 测试4:打开openclash(全局模式,线路选择日本,韩国,美国等),由于是国外线路访问百度,速度稍慢,但是可以打开,而且浏览器转圈儿不明显,很快就加载完成了。
  • 测试5:关闭openclash,速度比测试4快,快速打开多个网页,都很快可以加载。

认真查了一个issue

是这个:#300
这个issue的问题是:路由器开启OpenClash国内访问变慢。
但是我的表现是,整体都很慢。不只是国内还是国外,
而且只有在规则和直连模式存在,全局模式不存在问题。

这个issue中告诉了一个办法:使用工具httpstat来测试,我在Mac中安装了此工具brew install httpstat
通过这个工具可以发现在哪一段儿耗时。

httpstat测试结果

测试1:openclash开启-规则和直连 - DNS Lookup很快 - TCP Connection很慢 - Server Processing不慢
测试2:openclash开启-全局模式 - DNS Lookup很快 - TCP Connection不慢 - Server Processing不慢
测试3:openclash关闭 - DNS Lookup很快 - TCP Connection很快- Server Processing不慢

我自己的结论:

  • DNS查询没问题

  • 开启openclash 规则和直连的时候,TCP Connection特别慢,甚至超时,超过十秒。

  • 关闭openclash或者使用全局模式时, TCP Connection不慢,全局的时候服务器相应可能慢点儿。

  • 测试1:openclash开启-规则和直连(单独测试的,效果一样,就一起说)
    Image

  • 测试2:openclash开启-全局模式
    Image

  • 测试3:openclash关闭
    Image

OpenClash Log

OpenClash Config

---
port: 7890
socks-port: 7891
allow-lan: true
bind-address: "*"
ipv6: false
mode: rule
log-level: silent
external-controller: 0.0.0.0:9090
dns:
  enable: true
  ipv6: false
  default-nameserver:
  - 180.184.1.1
  - 119.29.29.29
  fake-ip-range: 198.18.0.1/16
  use-hosts: true
  nameserver:
  - https://doh.pub/dns-query
  - https://dns.alidns.com/dns-query
  fallback:
  - https://1.12.12.12/dns-query
  - https://dns.alidns.com/dns-query
  - https://doh.pub/dns-query
  - tls://8.8.4.4:853
  fallback-filter:
    geoip: true
    ipcidr:
    - 240.0.0.0/4
    - 0.0.0.0/32
  enhanced-mode: fake-ip
  listen: 0.0.0.0:7874
proxies:
-------- 仅仅删除线路 -----------
proxy-groups:
- name: "\U0001F680 节点选择"
  type: select
  proxies:
  - "\U0001F52F 故障转移"
  - "\U0001F3AF 自动选择"
  - 香港 01
  - 香港 02
  - 香港 03
  - 新加坡 01
  - 新加坡 02
  - 新加坡 03
  - 台湾 01
  - 台湾 02
  - 台湾 03
  - 美国 01
  - 美国 02
  - 美国 03
  - 日本 01
  - 日本 02
  - 日本 03
  - IPLC(HW) 香港HKT家宽
  - IPLC(HW) 新加坡
  - IPLC(HW) 日本Sonet家宽
  - IPLC(HW) 美国ATT家宽
  - IPLC(HW) 台湾Hinet家宽
  - Base 美国Frontier家宽
  - Base 马来西亚TMNet家宽
  - Base 马来西亚
  - Base 泰国
  - Base 越南
  - Base 印度尼西亚
  - Base 澳大利亚 悉尼
  - Base 菲律宾 02
  - Base 印度
  - Base 新西兰
  - Base 阿根廷
  - Base 尼日利亚
  - Base 瑞典
  - Base 意大利
  - Base 巴西
  - Base 英国
  - Base 德国
  - Base 巴基斯坦
  - Base 芬兰
  - Base 加拿大
  - Base 哈萨克斯坦
  - Base 乌拉圭
  - Plus 广港 Game 限速5M
  - Plus 沪日 Game 限速5M
- name: "\U0001F4F9 Youtube"
  type: select
  proxies:
  - "\U0001F1ED\U0001F1F0 香港节点"
  - "\U0001F1F8\U0001F1EC 新加坡节点"
  - "\U0001F1FA\U0001F1F8 美国节点"
  - "\U0001F30E 其他国家"
- name: "\U0001F3A5 Netflix"
  type: select
  proxies:
  - "\U0001F1ED\U0001F1F0 香港节点"
  - "\U0001F1F8\U0001F1EC 新加坡节点"
  - "\U0001F1FA\U0001F1F8 美国节点"
  - "\U0001F30E 其他国家"
- name: "\U0001F5A5️ ChatGPT/NewBing"
  type: select
  proxies:
  - "\U0001F1FA\U0001F1F8 美国节点"
  - "\U0001F1F8\U0001F1EC 新加坡节点"
  - "\U0001F30E 其他国家"
- name: "\U0001F1ED\U0001F1F0 香港节点"
  type: select
  proxies:
  - 香港 01
  - 香港 02
  - 香港 03
  - IPLC(HW) 香港HKT家宽
- name: "\U0001F1F8\U0001F1EC 新加坡节点"
  type: select
  proxies:
  - 新加坡 01
  - 新加坡 02
  - 新加坡 03
  - IPLC(HW) 新加坡
- name: "\U0001F1FA\U0001F1F8 美国节点"
  type: select
  proxies:
  - 美国 01
  - 美国 02
  - 美国 03
  - IPLC(HW) 美国ATT家宽
  - Base 美国Frontier家宽
- name: "\U0001F30E 其他国家"
  type: select
  proxies:
  - 台湾 01
  - 台湾 02
  - 台湾 03
  - 日本 01
  - 日本 02
  - 日本 03
  - IPLC(HW) 日本Sonet家宽
  - IPLC(HW) 台湾Hinet家宽
  - Base 马来西亚TMNet家宽
  - Base 马来西亚
  - Base 泰国
  - Base 越南
  - Base 印度尼西亚
  - Base 澳大利亚 悉尼
  - Base 菲律宾 02
  - Base 印度
  - Base 新西兰
  - Base 阿根廷
  - Base 尼日利亚
  - Base 瑞典
  - Base 意大利
  - Base 巴西
  - Base 英国
  - Base 德国
  - Base 巴基斯坦
  - Base 芬兰
  - Base 加拿大
  - Base 哈萨克斯坦
  - Base 乌拉圭
  - Plus 广港 Game 限速5M
  - Plus 沪日 Game 限速5M
- name: "\U0001F3AF 自动选择"
  type: url-test
  proxies:
  - 香港 01
  - 香港 02
  - 香港 03
  - 新加坡 01
  - 新加坡 02
  - 新加坡 03
  - 台湾 01
  - 台湾 02
  - 台湾 03
  - 美国 01
  - 美国 02
  - 美国 03
  - 日本 01
  - 日本 02
  - 日本 03
  - IPLC(HW) 香港HKT家宽
  - IPLC(HW) 新加坡
  - IPLC(HW) 日本Sonet家宽
  - IPLC(HW) 美国ATT家宽
  - IPLC(HW) 台湾Hinet家宽
  - Base 美国Frontier家宽
  - Base 马来西亚TMNet家宽
  - Base 马来西亚
  - Base 泰国
  - Base 越南
  - Base 印度尼西亚
  - Base 澳大利亚 悉尼
  - Base 菲律宾 02
  - Base 印度
  - Base 新西兰
  - Base 阿根廷
  - Base 尼日利亚
  - Base 瑞典
  - Base 意大利
  - Base 巴西
  - Base 英国
  - Base 德国
  - Base 巴基斯坦
  - Base 芬兰
  - Base 加拿大
  - Base 哈萨克斯坦
  - Base 乌拉圭
  url: http://www.gstatic.com/generate_204
  interval: 86400
- name: "\U0001F52F 故障转移"
  type: fallback
  proxies:
  - 香港 01
  - 香港 02
  - 香港 03
  - 新加坡 01
  - 新加坡 02
  - 新加坡 03
  - 台湾 01
  - 台湾 02
  - 台湾 03
  - 美国 01
  - 美国 02
  - 美国 03
  - 日本 01
  - 日本 02
  - 日本 03
  - IPLC(HW) 香港HKT家宽
  - IPLC(HW) 新加坡
  - IPLC(HW) 日本Sonet家宽
  - IPLC(HW) 美国ATT家宽
  - IPLC(HW) 台湾Hinet家宽
  - Base 美国Frontier家宽
  - Base 马来西亚TMNet家宽
  - Base 马来西亚
  - Base 泰国
  - Base 越南
  - Base 印度尼西亚
  - Base 澳大利亚 悉尼
  - Base 菲律宾 02
  - Base 印度
  - Base 新西兰
  - Base 阿根廷
  - Base 尼日利亚
  - Base 瑞典
  - Base 意大利
  - Base 巴西
  - Base 英国
  - Base 德国
  - Base 巴基斯坦
  - Base 芬兰
  - Base 加拿大
  - Base 哈萨克斯坦
  - Base 乌拉圭
  - Plus 广港 Game 限速5M
  - Plus 沪日 Game 限速5M
  url: http://www.gstatic.com/generate_204
  interval: 7200
rules:
- DOMAIN,www.easysub.net,DIRECT
- DOMAIN,enetsub.egeturl.com,DIRECT
- PROCESS-NAME,aria2c,DIRECT
- PROCESS-NAME,fdm,DIRECT
- PROCESS-NAME,Folx,DIRECT
- PROCESS-NAME,NetTransport,DIRECT
- PROCESS-NAME,Thunder,DIRECT
- PROCESS-NAME,Transmission,DIRECT
- DOMAIN-SUFFIX,booking.com,DIRECT
- DOMAIN-SUFFIX,bstatic.com,DIRECT
- DOMAIN-SUFFIX,cailianpress.com,DIRECT
- DOMAIN-SUFFIX,camera360.com,DIRECT
- DOMAIN-SUFFIX,chinaso.com,DIRECT
- DOMAIN-SUFFIX,chua.pro,DIRECT
- DOMAIN-SUFFIX,chuimg.com,DIRECT
- DOMAIN-SUFFIX,chunyu.mobi,DIRECT
- DOMAIN-SUFFIX,chushou.tv,DIRECT
- DOMAIN-SUFFIX,cmbchina.com,DIRECT
- DOMAIN-SUFFIX,cmbimg.com,DIRECT
- DOMAIN-SUFFIX,ctrip.com,DIRECT
- IP-CIDR,45.255.124.105/32, DIRECT
- IP-CIDR,45.255.124.107/32, DIRECT
- IP-CIDR,45.255.124.108/32, DIRECT
- IP-CIDR,45.255.124.109/32, DIRECT
- IP-CIDR,45.255.124.135/32, DIRECT
- IP-CIDR,50.17.126.121/32, DIRECT
- IP-CIDR,52.52.84.170/32, DIRECT
- IP-CIDR,52.58.56.244/32, DIRECT
- IP-CIDR,164.52.36.228/32, DIRECT
- IP-CIDR,202.226.25.166/32, DIRECT
- IP-CIDR,202.226.25.171/32, DIRECT
- IP-CIDR,202.226.25.195/32, DIRECT
- IP-CIDR,202.226.25.198/32, DIRECT
- GEOIP,CN,DIRECT
- "MATCH,\U0001F680 节点选择"
redir-port: 7892
tproxy-port: 7895
mixed-port: 7893
secret: qjcjeInr
external-ui: "/usr/share/openclash/ui"
keep-alive-interval: 15
keep-alive-idle: 600
profile:
  store-selected: true
authentication:
- Clash:aUoy9NsV

Expected Behavior

  • 虽然测试是使用百度、知乎等国内网站。
  • 目标是:让网络正常,因为打开openclash使用直连或者规则也依旧有问题。
  • 同时测试google.com,快速打开很多所有结果,浏览器也一直转圈,很慢。

Additional Context

对于测试流程来说,全程只有两个操作

  • 开启和关闭openclash
  • 调整openclash的规则策略(规则、全局、直连)
  • 线路是使用的机场的线路,全程无修改,同时测试了多个机场配置,问题依旧。

规则设置
Image
直连设置
Image
全局设置
Image

@NasserGo NasserGo added the bug Something isn't working label Feb 26, 2025
@NasserGo NasserGo changed the title [Bug] [Bug] 打开Openclash以后,网络变得很慢,确定是Openclash开启导致 Feb 26, 2025
@NasserGo
Copy link
Author

NasserGo commented Feb 26, 2025

由于需要使用链式代理,将项目中不同的设备的ip使用规则,指定不同的链式线路。

修复方案:
方案1-Openclash使用全局,然后在每个设备上设置动态家庭ip socks5.
方案2-使用ikuai(上级路由)虚拟机,新建多个docker,在docker中安装openwrt做旁路由,然后再安装Openclash,设置规则,链式代理。
最后,将项目设备,按照每50个设备,指向一个docker中的openwrt旁路由。

临时使用了这两个方案来替用。 但是不能直接使用一个openwrt路由器,问题依旧存在。

@NasserGo
Copy link
Author

连接路由器的设备数是:300个设备。
路由器配置是:N100-16G内存-128G硬盘
出题出现的时候,CPU和内存占用率均为超过15%(而且开启全局模式的时候,也是没有问题的)

@vernesong
Copy link
Owner

绕过国内,ikuai是不是限速了

@NasserGo
Copy link
Author

绕过国内,ikuai是不是限速了
ikuai没有限速。
使用“绕过国内”已解决。

@NasserGo
Copy link
Author

NasserGo commented Feb 27, 2025

该问题已解决,设置流程:

插件设置-流量控制-实验性:绕过指定区域IP(选择:绕过大陆)

不过暂时看懂为啥需要这么设置😭

@vernesong
Copy link
Owner

大链接数经过感觉是被ikuai限制了,因为经过clash会NAT,在ikuai那边都是来自一个客户端的流量,可以抓包看看

@NasserGo
Copy link
Author

大链接数经过感觉是被ikuai限制了,因为经过clash会NAT,在ikuai那边都是来自一个客户端的流量,可以抓包看看

收到,我这边看看,谢谢。

@NasserGo
Copy link
Author

@vernesong 经过测试问题依旧,这次使用的是google.com测试。
开启openclash,规则模式和全局模式分别测试,规则也指定内网ip和全局走的一样的线路。
测试结果如下
规则模式:Tcp connect特别耗时,主要就是这个。
Image
全局模式:
测试结果很快。
Image

@love768952693
Copy link

该问题已解决,设置流程:

插件设置-流量控制-实验性:绕过指定区域IP(选择:绕过大陆)

不过暂时看懂为啥需要这么设置😭

我也是多运营商,勾选绕过中国会好点,但是又会出现新的问题,特别是Fake-IP 模式下,必须清理下 Fake-IP 持久化,或者不开启Fake-IP 持久化功能,OpenClash自己缓存的dns线路就会有问题,或者有时识别不准会导致某些应用连接不上服务器等等,目前还没好的解决办法。单运营商或是相同运营商多线路不会有这个问题,只要是多个不同运营商就会头疼。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants