2dust / v2rayN

A GUI client for Windows, support Xray core and v2fly core and others
https://1.2345345.xyz
GNU General Public License v3.0
64.81k stars 10.96k forks source link

[Bug]: 启用Tun模式后,提示DNS问题! #4513

Closed CharlieVSAngel closed 3 months ago

CharlieVSAngel commented 7 months ago

预期情况

设置错误

实际情况

启动服务(2023/12/15 11:56:33)... 2023/12/15 11:56:34 系统代理设置改变ForcedChange 2023/12/15 11:56:38 当前服务的真连接延迟: 550 ms +0800 2023-12-15 11:56:48 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: write tcp 192.168.1.136:13974->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: write tcp 192.168.1.136:13974->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: write tcp 192.168.1.136:13974->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for twitter.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for twitter.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for twitter.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:56 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:56 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:56 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:56:57 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:57 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:57 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:56:57 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for lh3.googleusercontent.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for yt3.ggpht.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for i1.ytimg.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for twitter.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for twitter.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for lh3.googleusercontent.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for lh3.googleusercontent.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for yt3.ggpht.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for yt3.ggpht.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for i1.ytimg.com. IN A: write tcp 192.168.1.136:13994->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for i1.ytimg.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for clients2.google.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled

复现方法

启动服务(2023/12/15 11:56:33)... 2023/12/15 11:56:34 系统代理设置改变ForcedChange 2023/12/15 11:56:38 当前服务的真连接延迟: 550 ms +0800 2023-12-15 11:56:48 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: write tcp 192.168.1.136:13974->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: write tcp 192.168.1.136:13974->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: write tcp 192.168.1.136:13974->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for twitter.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for twitter.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for twitter.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:56 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:56 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:56 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:56:57 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:57 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:57 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:56:57 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for lh3.googleusercontent.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for yt3.ggpht.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for i1.ytimg.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for twitter.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for twitter.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for lh3.googleusercontent.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for lh3.googleusercontent.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for yt3.ggpht.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for yt3.ggpht.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for i1.ytimg.com. IN A: write tcp 192.168.1.136:13994->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for i1.ytimg.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for clients2.google.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled

日志信息

启动服务(2023/12/15 11:56:33)... 2023/12/15 11:56:34 系统代理设置改变ForcedChange 2023/12/15 11:56:38 当前服务的真连接延迟: 550 ms +0800 2023-12-15 11:56:48 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: write tcp 192.168.1.136:13974->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: write tcp 192.168.1.136:13974->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:54 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: write tcp 192.168.1.136:13974->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for twitter.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for twitter.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:55 ERROR dns: exchange failed for twitter.com. IN A: write tcp 192.168.1.136:13977->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:56:56 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:56 ERROR dns: exchange failed for beacons5.gvt3.com. IN A: context canceled +0800 2023-12-15 11:56:56 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:56:57 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:57 ERROR dns: exchange failed for v10.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:57 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:56:57 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for lh3.googleusercontent.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for yt3.ggpht.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for i1.ytimg.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for twitter.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for twitter.com. IN A: context canceled +0800 2023-12-15 11:56:58 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for lh3.googleusercontent.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for lh3.googleusercontent.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for yt3.ggpht.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for yt3.ggpht.com. IN A: context canceled +0800 2023-12-15 11:56:59 ERROR dns: exchange failed for i1.ytimg.com. IN A: write tcp 192.168.1.136:13994->172.67.77.173:2086: use of closed network connection +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for i1.ytimg.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for clients2.google.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for clients4.google.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled +0800 2023-12-15 11:57:00 ERROR dns: exchange failed for self.events.data.microsoft.com. IN A: context canceled

额外信息

No response

我确认已更新至最新版本

我确认已查询历史issues

Ackites commented 7 months ago

一样的问题

zazitufu commented 7 months ago

把sing-box改回1.7x版本试试看。

udbyygyt commented 7 months ago

我也是一样的问题

CharlieVSAngel commented 7 months ago

把sing-box改回1.7x版本试试看。

试了,没用!

zazitufu commented 7 months ago

把sing-box改回1.7x版本试试看。

试了,没用!

你本机安装V2后是否第一次运行tun模式?如果是的话,在 设置-DNS设置-singbox DNS设置,导入一下默认DNS设置

udbyygyt commented 7 months ago

把sing-box改回1.7x版本试试看。

试了,没用!

你本机安装V2后是否第一次运行tun模式?如果是的话,在 设置-DNS设置-singbox DNS设置,导入一下默认DNS设置

我也试过这个,也是不行

good-bay commented 7 months ago

windows 10系统开启Tun模式,什么参数都调试了,在v2rayN和nekoray客户端都不能使用,使用系统代理就一点问题没有。

2dust commented 6 months ago

6.32重新下载到另外文件夹,重新测试一次反馈

udbyygyt commented 6 months ago

6.32重新下载到另外文件夹,重新测试一次反馈 还是不行,已经导入了默认dns image

good-bay commented 6 months ago

6.32重新下载到另外文件夹,已经导入了默认dns

[Hysteria2] United States_hysteria2_3(108***155:27710) 启动服务(2024/01/01 23:23:31)... +0800 2024-01-01 23:23:31 INFO router: loaded geoip database: 259 codes +0800 2024-01-01 23:23:31 INFO router: loaded geosite database: 1393 codes +0800 2024-01-01 23:23:31 INFO router: updated default interface 本地网络, index 6 2024/01/01 23:23:32 系统代理设置改变ForcedChange +0800 2024-01-01 23:23:36 INFO clash-api: restful api listening at 127.0.0.1:9090 2024/01/01 23:23:44 当前服务的真连接延迟: -1 ms FATAL[0020] start service: initialize inbound/tun[tun-in]: configure tun interface: Cannot create a file when that file already exists.

good-bay commented 6 months ago

6.32重新下载到另外文件夹,已经导入了默认dns

[Hysteria2] United States_hysteria2_3(108***155:27710) 启动服务(2024/01/01 23:23:31)... +0800 2024-01-01 23:23:31 INFO router: loaded geoip database: 259 codes +0800 2024-01-01 23:23:31 INFO router: loaded geosite database: 1393 codes +0800 2024-01-01 23:23:31 INFO router: updated default interface 本地网络, index 6 2024/01/01 23:23:32 系统代理设置改变ForcedChange +0800 2024-01-01 23:23:36 INFO clash-api: restful api listening at 127.0.0.1:9090 2024/01/01 23:23:44 当前服务的真连接延迟: -1 ms FATAL[0020] start service: initialize inbound/tun[tun-in]: configure tun interface: Cannot create a file when that file already exists.

我的问题与后面帖子相同,谁有处理办法吗? https://github.com/SagerNet/sing-box/issues/716

2dust commented 6 months ago

FATAL[0020] start service: initialize inbound/tun[tun-in]: configure tun interface: Cannot create a file when that file already exists.

提示这样的,请重启几次tun模式,如果还是不行,那就是暂时没有办法用sing-box 的tun了,试一试其他的app

good-bay commented 6 months ago

FATAL[0020] start service: initialize inbound/tun[tun-in]: configure tun interface: Cannot create a file when that file already exists.

提示这样的,请重启几次tun模式,如果还是不行,那就是暂时没有办法用sing-box 的tun了,试一试其他的app

这个问题的原因我找到了,开启tun模式时windows会建立虚拟网卡,并将信息储存在系统中,v2rayN关闭tun模式时并没有删除windows建立的虚拟网卡(隐身的),再次启动tun模式时,系统认为虚拟网卡重复建立(虚拟网卡参数相同),这是windows系统不允许的。我已经找到方法删除隐身的虚拟网卡,但是重新开启tun模式后会出现DNS无法解析问题! 我还试过nekoray,hiddify在tun模式下也存在DNS解析的问题。 我想知道tun模式下DNS解析机制是怎么样的,我找了全网也没有看到tun模式机制系统说明。

NEXWX commented 6 months ago

+1+1我也有这个问题,如果是像楼上说的那样的话,那就还是v2ray的TUN写的有问题,只能等他更新解决了吧

2dust commented 5 months ago

FATAL[0020] start service: initialize inbound/tun[tun-in]: configure tun interface: Cannot create a file when that file already exists. 提示这样的,请重启几次tun模式,如果还是不行,那就是暂时没有办法用sing-box 的tun了,试一试其他的app

这个问题的原因我找到了,开启tun模式时windows会建立虚拟网卡,并将信息储存在系统中,v2rayN关闭tun模式时并没有删除windows建立的虚拟网卡(隐身的),再次启动tun模式时,系统认为虚拟网卡重复建立(虚拟网卡参数相同),这是windows系统不允许的。我已经找到方法删除隐身的虚拟网卡,但是重新开启tun模式后会出现DNS无法解析问题! 我还试过nekoray,hiddify在tun模式下也存在DNS解析的问题。 我想知道tun模式下DNS解析机制是怎么样的,我找了全网也没有看到tun模式机制系统说明。

sing-box 的DNS你可以看ta的文档,然后在自定义DNS中设置并测试是否达到你的目标 如果解决了,请反馈下 参考下 https://github.com/chika0801/sing-box-examples

zhkaiang commented 4 months ago

确实存在这个问题

2576168920 commented 4 months ago

这个问题解决了没有? 我现在遇到同样的问题,提示ERROR dns: exchange failed,但当我连接别人的机场就没有问题,使用v2rayN连接我自己用v2ray搭建的梯子就会出现这个问题,所以问题是在服务器端,服务器端是否需要配置dns

2dust commented 3 months ago

试一试替换下面的dns设置

{
  "servers": [
    {
      "tag": "remote",
      "address": "tcp://8.8.8.8",
      "strategy": "ipv4_only",
      "detour": "proxy"
    },
    {
      "tag": "local",
      "address": "223.5.5.5",
      "strategy": "ipv4_only",
      "detour": "direct"
    },
    {
      "tag": "block",
      "address": "rcode://success"
    }
  ],
  "rules": [
    {
      "geosite": [
        "geolocation-!cn"
      ],
      "server": "remote"
    },
    {
      "geosite": [
        "category-ads-all"
      ],
      "server": "block"
    }
  ]
}

{
    "servers": [
        {
            "tag": "local",
            "address": "https://dns.alidns.com/dns-query",
            "address_resolver": "dns-resolver",
            "detour": "direct"
        },
        {
            "tag": "remote",
            "address": "https://cloudflare-dns.com/dns-query",
            "address_resolver": "dns-resolver",
            "detour": "proxy"
        },
        {
            "tag": "block",
            "address": "rcode://success"
        },
        {
            "tag": "dns-resolver",
            "address": "223.5.5.5",
            "detour": "direct"
        }
    ],
    "rules": [
        {
            "geosite": [
                "geolocation-!cn"
            ],
            "server": "remote"
        },
        {
            "outbound": "any",
            "server": "local"
        }
    ],
    "final": "remote",
    "strategy": "prefer_ipv4"
}