MetaCubeX / ClashX.Meta

GNU Affero General Public License v3.0
3.1k stars 398 forks source link

[Bug]macOS 15下无法开启TUN模式 #96

Open LGuangming opened 2 months ago

LGuangming commented 2 months ago

问题

在macOS 15下TUN模式完全不可用,控制台的connection处也收到不到任何请求,系统代理可以正常使用。同样的Yaml配置文件换用Verge的TUN模式是可用的,查看网络的DNS也已经被自动修改为198.18.0.2。

clashX config

redir-port: 7892
tproxy-port: 7895
port: 7890
socks-port: 7891
mixed-port: 7893
mode: rule
log-level: silent
allow-lan: true
external-controller: 0.0.0.0:9090
secret: '123456'
bind-address: "*"
#external-ui: "/usr/share/openclash/ui"
ipv6: true
geodata-mode: false
geodata-loader: memconservative
tcp-concurrent: true
dns:
  enable: true
  ipv6: true
  prefer-h3: true
  listen: :1053
  enhanced-mode: fake-ip
# enhanced-mode: redir-host
  fake-ip-range: 198.18.0.1/8
  fake-ip-filter:
    - "*"
    - "+.lan"
    - "+.local"
  nameserver:
    - https://8.8.8.8/dns-query
    - https://1.1.1.1/dns-query
    - tls://8.8.4.4
    - tls://208.67.222.222
  nameserver-policy:
  "geosite:cn,private":
    - https://223.5.5.5/dns-query
    - https://223.6.6.6/dns-query
sniffer:
  enable: true
  force-dns-mapping: true
  parse-pure-ip: true
tun:
  enable: true
  stack: system
  device: utun
  auto-route: false
  auto-detect-interface: false
  dns-hijack:
  - tcp://any:53
profile:
  store-selected: true
  store-fake-ip: true

clashX LOG

2024/09/13 19:25:04.132  [info] AppDelegate.swift applicationDidFinishLaunching(_:) Appversion: v1.3.18 522
2024/09/13 19:25:04.177  [info] AppDelegate.swift postFinishLaunching() postFinishLaunching
2024/09/13 19:25:04.233  [info] RemoteConfigManager.swift setupAutoUpdateTimer() set up autoUpateTimer
2024/09/13 19:25:04.233  [info] RemoteConfigManager.swift autoUpdateCheck() Tigger config auto update check
2024/09/13 19:25:04.235  [info] RemoteConfigManager.swift saveConfigs() Saving Remote Config Setting
2024/09/13 19:25:04.259  [info] PrivilegedHelperManager.swift getHelperStatus(callback:) check helper using time: 0.07463598251342773
2024/09/13 19:25:04.259  [info] ClashProcess.swift launchPath Get launchPath
2024/09/13 19:25:04.347  [info] ClashProcess.swift verifyCoreFile(_:) verify core path: /Users/Guangming/Library/Application Support/com.metacubex.ClashX.meta/com.metacubex.ClashX.ProxyConfigHelper.meta
2024/09/13 19:25:04.347  [info] ClashProcess.swift verifyCoreFile(_:) -v out: Mihomo Meta alpha-e33d4a4 darwin arm64 with go1.23.1 Thu Sep 12 03:20:24 UTC 2024
Use tags: with_gvisor
2024/09/13 19:25:04.670  [info] ClashProcess.swift verifyCoreFile(_:) verify core path: /Users/Guangming/Library/Application Support/com.metacubex.ClashX.meta/.private_core/com.metacubex.ClashX.ProxyConfigHelper.meta
2024/09/13 19:25:04.670  [info] ClashProcess.swift verifyCoreFile(_:) -v out: Mihomo Meta v1.18.8 darwin arm64 with go1.23.0 Mon Sep  2 08:35:10 UTC 2024
Use tags: with_gvisor
2024/09/13 19:25:04.671  [info] ClashProcess.swift launchPath version: v1.18.8
2024/09/13 19:25:04.878  [info] ClashProcess.swift checkHelperVersion() Helper, check status success 1.12
2024/09/13 19:25:04.878  [info] ClashProcess.swift startProxy() Trying start meta core
2024/09/13 19:25:04.958  [info] ClashProcess.swift startProxy() 
########  Clash Meta Start Log  #########
[info] Start initial configuration in progress
[info] Geodata Loader mode: memconservative
[info] Geosite Matcher implementation: succinct
[info] Initial configuration complete, total time: 0ms
[info] RESTful API listening at: 127.0.0.1:9090
########  END  #########
2024/09/13 19:25:04.958  [info] ClashProcess.swift pushInitConfig() Push init config file: OpenClash
2024/09/13 19:25:05.146  [info] ClashProcess.swift start() Init config file success.
2024/09/13 19:25:05.159  [info] AppDelegate.swift setupData() port config updated,new: 7893,7893
2024/09/13 19:25:12.617  [info] AppDelegate.swift checkMenuIconVisable() checkMenuIconVisable: (1234.0, 1087.5, 72.0, 22.0) 0.0, hidden: false, coverd by notch:false
2024/09/13 19:25:25.464  [info] AppDelegate.swift syncConfigWithTun(_:_:) tun state updated, new: false
2024/09/13 19:25:27.717  [warning] AppDelegate.swift didGetLog(log:level:) [TUN] Unsupported tunName(utun) in darwin, force regenerate by ourselves.
2024/09/13 19:25:27.745  [info] AppDelegate.swift syncConfigWithTun(_:_:) tun state updated, new: true
2024/09/13 19:25:27.747  [info] AppDelegate.swift didGetLog(log:level:) [TUN] Tun adapter listening at: utun5([198.18.0.1/30],[]), mtu: 9000, auto route: false, auto redir: false, ip stack: System
2024/09/13 19:26:29.072  [info] AppDelegate.swift syncConfigWithTun(_:_:) tun state updated, new: false
2024/09/13 19:26:31.621  [warning] AppDelegate.swift didGetLog(log:level:) [TUN] Unsupported tunName(utun) in darwin, force regenerate by ourselves.
2024/09/13 19:26:31.644  [info] AppDelegate.swift didGetLog(log:level:) [TUN] Tun adapter listening at: utun5([198.18.0.1/30],[]), mtu: 9000, auto route: false, auto redir: false, ip stack: System
2024/09/13 19:26:31.649  [info] AppDelegate.swift syncConfigWithTun(_:_:) tun state updated, new: true

环境 Environment

LGuangming commented 2 months ago

参考谷歌添加了DNS信息,已经可以正常使用TUN了

vvanglro commented 2 months ago

设置里启用ipv6能打开吗

vistao commented 2 months ago

在 Clash 配置文件中添加 DNS 配置: dns: enable: true listen: :53 enhanced-mode: redir-host nameserver:

vstar37 commented 2 months ago

需要开启alpha内核以支持新的规则,然而swiftUI版本没法下载alpha内核 可以先切换到别的ui下载启用,再切换回来

LGuangming commented 1 month ago

设置里启用ipv6能打开吗

我这边已经好了,原来还是因为配置文件的DNS设置不太对。

vvanglro commented 1 month ago

设置里启用ipv6能打开吗

我这边已经好了,原来还是因为配置文件的DNS设置不太对。

能贴一下你的配置文件嘛

lslqtz commented 2 weeks ago

macOS 15, 确认原因可能是因为设定了 stack: 'system' 导致, 现象为“无法与 xx 建立安全连接”. (默认: gvisor)