MetaCubeX / mihomo

A simple Python Pydantic model for Honkai: Star Rail parsed data from the Mihomo API.
https://wiki.metacubex.one
MIT License
16.52k stars 2.65k forks source link

[Bug] v1.15.0和v1.15.1在Linux上开启tun无法正常联网 #706

Open athenakia opened 1 year ago

athenakia commented 1 year ago

Verify steps

Clash version

v1.15.0

What OS are you seeing the problem on?

Linux

Clash config

port: 7890
socks-port: 7891
allow-lan: false
mode: Rule
log-level: debug
external-controller: 127.0.0.1:9090
proxies:
# ...
proxy-groups:
# ...
rules:
# ...

tun:
  enable: true
  stack: gvisor # 使用system也有问题
  auto-route: true
  auto-detect-interface: true
  dns-hijack:
    - any:53

Clash log

INFO[2023-08-27T19:56:22.484318283+08:00] Start initial configuration in progress
INFO[2023-08-27T19:56:22.486366703+08:00] Geodata Loader mode: memconservative
INFO[2023-08-27T19:56:22.487199998+08:00] Initial configuration complete, total time: 2ms
INFO[2023-08-27T19:56:22.490706711+08:00] RESTful API listening at: 127.0.0.1:9090
INFO[2023-08-27T19:56:22.500236701+08:00] Sniffer is closed
INFO[2023-08-27T19:56:22.500344053+08:00] HTTP proxy listening at: 127.0.0.1:7890
INFO[2023-08-27T19:56:22.500439382+08:00] SOCKS proxy listening at: 127.0.0.1:7891
WARN[2023-08-27T19:56:22.500767698+08:00] [TUN] default interface changed by monitor,  => eth0
INFO[2023-08-27T19:56:22.51965576+08:00] [TUN] Tun adapter listening at: Meta([198.18.0.1/30],[]), mtu: 9000, auto route: true, ip stack: gVisor
INFO[2023-08-27T19:56:22.520001733+08:00] Start initial compatible provider default
INFO[2023-08-27T19:56:22.520060744+08:00] Start initial compatible provider XXX
DEBU[2023-08-27T19:56:22.536158135+08:00] [DNS] hijack udp:198.18.0.2:53 from 198.18.0.1:46321
DEBU[2023-08-27T19:56:24.537240207+08:00] [DNS] hijack udp:198.18.0.2:53 from 198.18.0.1:47447
DEBU[2023-08-27T19:56:25.26302075+08:00] [DNS] hijack udp:198.18.0.2:53 from 198.18.0.1:36471
DEBU[2023-08-27T19:56:25.263790741+08:00] [DNS] hijack udp:198.18.0.2:53 from 198.18.0.1:59572
WARN[2023-08-27T20:33:03.672795104+08:00] [TCP] dial SELECT (match Match/) 127.0.0.1:36060(firefox, uid=1000) --> detectportal.firefox.com:80 error: xxx.xxx.xxx:xxx connect error: dns resolve failed: lookup xxx.xxx.xxx on 127.0.0.53:53: server misbehaving
WARN[2023-08-27T20:33:03.672795104+08:00] [TCP] dial SELECT (match Match/) 127.0.0.1:36060(firefox, uid=1000) --> detectportal.firefox.com:80 error: xxx.xxx.xxx:xxx connect error: dns resolve failed: lookup xxx.xxx.xxx on 127.0.0.53:53: server misbehaving
WARN[2023-08-27T20:33:03.672795104+08:00] [TCP] dial SELECT (match Match/) 127.0.0.1:36060(firefox, uid=1000) --> detectportal.firefox.com:80 error: xxx.xxx.xxx:xxx connect error: dns resolve failed: lookup xxx.xxx.xxx on 127.0.0.53:53: server misbehaving

Description

目前测试结果主要是v1.15.0和v1.15.1的问题,v1.14.5一切正常。在Ubuntu LTS 22.04和20.04都测试过,amd64和arm64也测试了,可能是Linux通病。

复现方法:

athenakia commented 1 year ago

貌似v1.14.5在arm64的Linux系统上也有问题。

athenakia commented 1 year ago

v1.14.5在Ubuntu 20.04 LTS仍然有问题,不过v1.14.5在Ubuntu 22.04LTS正常。

athenakia commented 1 year ago

v.14.5在Fedora 36也正常。可能v1.14.5的问题只在于不兼容较老的Linux发行版本。

但是v1.15.0和v1.15.1的问题在新旧Linux发行版本上都存在。

Mars160 commented 1 year ago

实测Archlinux上没问题,感觉可能是config.yml里dns配置的问题

athenakia commented 1 year ago

实测Archlinux上没问题,感觉可能是config.yml里dns配置的问题

感谢提醒,我去试试。

athenakia commented 1 year ago

实测Archlinux上没问题,感觉可能是config.yml里dns配置的问题

大佬,DNS相关配置如下,还是不能用,请问该如何修改:

dns:
  enable: true
  ipv6: true
  enhanced-mode: redir-host
  listen: 127.0.0.1:843
  default-nameserver:
    - 114.114.114.114
    - 8.8.8.8
    - tls://1.12.12.12:853
    - tls://223.5.5.5:853
  nameserver:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
  fallback:
    - tls://8.8.4.4
    - tls://1.1.1.1
  proxy-server-nameserver:
    - https://doh.pub/dns-query
  fallback-filter:
    geoip: true
    geoip-code: CN
    ipcidr:
      - 240.0.0.0/4
    domain:
      - +.google.com
      - +.facebook.com
      - +.youtube.com
sniffer:
  enable: true
LevineWoo commented 2 months ago

换fakeip就正常了,redir-host我也用着总是这里那里有问题的。