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

MacOS 14.4 下 Tun 模式无法自动设置 DNS #26

Open
5 of 6 tasks
EXHades opened this issue Mar 23, 2024 · 4 comments
Open
5 of 6 tasks

MacOS 14.4 下 Tun 模式无法自动设置 DNS #26

EXHades opened this issue Mar 23, 2024 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@EXHades
Copy link

EXHades commented Mar 23, 2024

复现步骤 / Step to reproduce

macOS14.4 下仅连接 Wi-Fi

配置:

tun:
  enable: true
  stack: mixed
  dns-hijack:
    - any:53
  auto-route: true
  auto-detect-interface: true

dns:
  enable: true
  listen: 127.0.0.1:1053
  ipv6: false
  use-hosts: true
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16

预期行为 / Expected behaviour

GUI 启用 Tun 模式时应自动寻找当前出口网卡为其设置 DNS (198.18.0.2),使 fake-ip 正常生效

实际行为 / Actual Behaviour

启动后网卡 DNS 未修改

应用日志 / App logs

{"timestamp":"2024-03-23T19:29:19.613156Z","level":"DEBUG","fields":{"message":"try to set system dns","log.target":"app","log.module_path":"clash_verge::core::clash::core","log.file":"tauri/src/core/clash/core.rs","log.line":126},"target":"app","filename":"tauri/src/core/clash/core.rs","line_number":126}
{"timestamp":"2024-03-23T19:29:19.643285Z","level":"DEBUG","fields":{"message":"Some(Stdout(\"** Error: Command requires admin privileges.\\n\"))","log.target":"app","log.module_path":"clash_verge::core::clash::core","log.file":"tauri/src/core/clash/core.rs","log.line":134},"target":"app","filename":"tauri/src/core/clash/core.rs","line_number":134}

备注 / Addition details

试着手动执行 networksetup, 14.3+ 开始似乎需要 sudo 才能修改 DNS 了?

networksetup -setdnsservers "Wi-Fi" 192.168.0.2
# ** Error: Command requires admin privileges.

Clash Nyapasu 版本号 / Clash Nyapasu

1.5.1-alpha+1afa4c4_x64

Clash 核心及其版本号 / Clash core and version

V1.18.1 Meta

是否为 Pre-release / Is pre-release version

1afa4c4

操作系统及版本 / OS version

macOS 14.4

自查步骤 / Verify steps

  • 如果您有足够的时间和能力,并愿意为此提交 PR ,请勾上此复选框 / Pull request is welcome. Check this if you want to start a pull request
  • 您已知悉如果没有提供正确的系统信息,以及日记,您的 Issue 会直接被关闭 / You have known that if you don't provide correct system information and logs, your issue will be closed directly
  • 您已仔细查看并知情 Q&AFAQ 中的内容 / You have read and understood the contents of Q&A and FAQ.
  • 您已搜索过 Issue Tracker,没有找到类似内容 / I have searched on Issue Tracker, No duplicate or related open issue has been found
  • 您确保这个 Issue 只提及一个问题。如果您有多个问题报告,烦请发起多个 Issue / Ensure there is only one bug report in this issue. Please make mutiply issue for mutiply bugs
  • 您确保已使用最新 Pre-release 版本测试,并且该问题在最新 Pre-release 版本中并未解决 / This bug have not solved in latest Pre-release version
@EXHades
Copy link
Author

EXHades commented Mar 23, 2024

不止 DNS 无法设置, 设置系统代理 也不行。

日志里没有告警也没有报错,看了下源码,似乎没输出 set_system_proxy 相关的日志

看样子也是通过 networksetup,手动执行命令发现都是权限问题

@EXHades
Copy link
Author

EXHades commented Mar 23, 2024

也许需要一个类似 ClashX Proxy Helper 去负责设置网络配置?

image

@greenhat616
Copy link
Collaborator

这可能得依赖我们计划在 1.6.x 中引入的跨平台服务模式。
#4

@greenhat616 greenhat616 transferred this issue from libnyanpasu/clash-nyanpasu Jul 16, 2024
@greenhat616
Copy link
Collaborator

greenhat616 commented Jul 20, 2024

目前跨平台的最小化提权服务已经实现。

现在的问题是修改 DNS 需要主动探测用户活跃的网卡。
以 Windows 为例,用户侧可能使用了 WiFi 连接,又存在 Ethernet 连接,同时还安装一对加速器服务,比如说 UU;亦使用了虚拟机,例如 Hyper-V,他们都创建了网络设备,而且都有可能 Up(在线)。
我们需要找到一个策略来探测出默认的出站设备,然后给他应用 DNS。
此外,假设用户使用拨号连接,可能情况又会有所不同。

因为没有确切的思路,因此 1.6.0 不会包含此功能。

如果有思路的话,欢迎交流

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
No open projects
Status: Todo
Development

No branches or pull requests

2 participants