clash
clash copied to clipboard
[Bug] Premium 2023.02.16 开始不能使用自己本地 127.0.0.1 DNS
Verify steps
- [X] 确保你使用的是本仓库最新的的 clash 或 clash premium 版本 Ensure you are using the latest version of Clash or Clash Premium from this repository.
- [X] 如果你可以自己 debug 并解决的话,提交 PR 吧 Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
- [X] 我已经在 Issue Tracker 中找过我要提出的问题 I have searched on the issue tracker for a related issue.
- [X] 我已经使用 dev 分支版本测试过,问题依旧存在 I have tested using the dev branch, and the issue still exists.
- [X] 我已经仔细看过 Documentation 并无法自行解决问题 I have read the documentation and was unable to solve the issue.
- [X] 这是 Clash 核心的问题,并非我所使用的 Clash 衍生版本(如 OpenClash、KoolClash 等)的特定问题 This is an issue of the Clash core per se, not to the derivatives of Clash, like OpenClash or KoolClash.
Clash version
premium 2023.03.04 (0310)
测试直接通过 clash-premium 可执行文件命令行,未使用 GUI 客户端
What OS are you seeing the problem on?
macOS 10.14
DNS 配置: mosdns 监听在 127.0.0.1:53053。 AdGuardHome 监听在 127.0.0.1:53, mosdns 作为其上游。
TUN 启用期间 dig 代理域名是有结果的。
Clash config
最小配置
# vim: ft=yaml fdm=marker foldmarker=[[[,]]] foldlevel=0 sw=2 ts=2 et
port: 8888
socks-port: 8889
external-controller: '127.0.0.1:9090'
external-ui: ui
allow-lan: false
mode: rule
log-level: debug
ipv6: false
# interface-name: en0
profile:
store-selected: true
store-fake-ip: false
dns:
ipv6: false
use-hosts: true
fake-ip-range: 198.18.0.1/16
fake-ip-filter:
- '*.lan'
- '*.test'
- 'localhost.ptlogin2.qq.com'
- '*.*.*.*.srv.nintendo.net'
- '*.*.*.stun.playstation.net'
- 'xbox.*.microsoft.com'
- '*.*.*.xboxlive.com'
enable: true
# enhanced-mode: redir-host
enhanced-mode: fake-ip
nameserver:
- 127.0.0.1:53
tun:
enable: true
stack: system
auto-route: true
auto-detect-interface: true
dns-hijack:
- 198.18.0.2:53
proxies:
- type: trojan
name: ☁️ 🇭🇰 Hong Kong | 04
server: oss-cn-guangzhou.westdatacloud.xyz
port: xxxxx
password: xxxxxxxx
udp: true
sni: xxxxx
skip-cert-verify: true
proxy-groups:
- type: select
name: HK
proxies: ["☁️ 🇭🇰 Hong Kong | 04"]
rules:
- GEOIP,CN,DIRECT
- MATCH,HK
Clash log
❯ sudo clash-darwin -d . -f Test.yaml
15:12:28 INF [Config] initial compatible provider name=HK
15:12:28 INF [API] listening addr=127.0.0.1:9090
15:12:28 INF [Inbound] HTTP proxy listening addr=127.0.0.1:8888
15:12:28 INF [Inbound] SOCKS proxy listening addr=127.0.0.1:8889
15:12:28 INF [Inbound] TUN listening iface=utun1 gateway=198.18.0.1
15:12:28 DBG [TUN] packet received failed error=route ip+net: no such network interface
15:12:28 DBG [UDP] accept session lAddr=198.18.0.1:61081 rAddr=94.140.14.140:784 inbound=TUN
15:12:28 WRN [UDP] dial failed error=oss-cn-guangzhou.westdatacloud.xyz:20004 connect error: all DNS requests failed, first error: write udp4 127.0.0.1:57314->127.0.0.1:53: write: can't assign requested address proxy=HK lAddr=198.18.0.1:61081 rAddr=94.140.14.140:784 rule=Match rulePayload=
15:12:30 DBG [UDP] accept session lAddr=198.18.0.1:61081 rAddr=94.140.14.140:784 inbound=TUN
15:12:30 WRN [UDP] dial failed error=oss-cn-guangzhou.westdatacloud.xyz:20004 connect error: all DNS requests failed, first error: write udp4 127.0.0.1:51970->127.0.0.1:53: write: can't assign requested address proxy=HK lAddr=198.18.0.1:61081 rAddr=94.140.14.140:784 rule=Match rulePayload=
15:12:30 DBG [TCP] accept connection lAddr=198.18.0.1:55090 rAddr=157.148.54.34:993 inbound=TUN
15:12:30 INF [TCP] connected lAddr=198.18.0.1:55090 rAddr=157.148.54.34:993 mode=rule rule=GeoIP(CN) proxy=DIRECT
15:12:30 DBG [TCP] accept connection lAddr=198.18.0.1:55094 rAddr=157.148.54.34:993 inbound=TUN
15:12:30 INF [TCP] connected lAddr=198.18.0.1:55094 rAddr=157.148.54.34:993 mode=rule rule=GeoIP(CN) proxy=DIRECT
15:12:31 DBG [UDP] accept session lAddr=198.18.0.1:60377 rAddr=192.18.0.2:53 inbound=TUN
15:12:31 DBG [UDP] accept session lAddr=198.18.0.1:53936 rAddr=192.18.0.2:53 inbound=TUN
15:12:31 DBG [UDP] accept session lAddr=198.18.0.1:60240 rAddr=192.18.0.2:53 inbound=TUN
15:12:31 WRN [UDP] dial failed error=oss-cn-guangzhou.westdatacloud.xyz:20004 connect error: all DNS requests failed, first error: write udp4 127.0.0.1:54722->127.0.0.1:53: write: can't assign requested address proxy=HK lAddr=198.18.0.1:60377 rAddr=192.18.0.2:53 rule=Match rulePayload=
15:12:31 WRN [UDP] dial failed error=oss-cn-guangzhou.westdatacloud.xyz:20004 connect error: all DNS requests failed, first error: write udp4 127.0.0.1:54722->127.0.0.1:53: write: can't assign requested address proxy=HK lAddr=198.18.0.1:53936 rAddr=192.18.0.2:53 rule=Match rulePayload=
Description
本地使用了 mosdns,以往都是让 clash premium dns 指向本地 127.0.0.1:53。网卡 DNS 设置为 192.18.0.2:53,通过 dns-hijack 192.18.0.2 拦截全部 DNS 请求(类似 ClashX 逻辑)。 但从 2023.01.29 升级到 2023.02.16,这个方案不行了。尽管这个过程中直接 dig @127.0.0.1 DNS 解析是没问题的。