Skip to content

[Bug] Windows 平台 TUN 模式每次启动网卡 GUID 随机变化,导致添加的持久化静态路由表失效 #5810

@codexss

Description

@codexss

完整性要求

  • 我读完了 issue 模板中的所有注释,确保填写符合要求。
  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我提供了完整的配置文件和日志,而不是出于自己的判断只给出截取的部分。
  • 我搜索了 issues, 没有发现已提出的类似问题。
  • 问题在 Release 最新的版本上可以成功复现

描述

在 Windows 平台上使用 Xray 的 TUN 模式时,虚拟网卡(Wintun 适配器)的 GUID (Interface ID) 在每次程序启动时都会发生变化。

重现方式

目前观察到的是启动后ctrl+c停止重复启动后网卡id如下两个来回切换
预期结果为启动后固定为一个网卡id可以在静态路由表中持久生效

C:\Users\lentin>route print
===========================================================================
接口列表
 13...........................Xray Tunnel
C:\Users\lentin>route print
===========================================================================
接口列表
 16...........................Xray Tunnel #2

客户端配置

Details

{
    "log": {
        "loglevel": "warn"
    },
    "inbounds": [
        {
            "protocol": "tun",
            "settings": {
                "name": "Xray"
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "vmess",
            "settings": {
                "address": "example.com",
                "port": 80,
                "id": "udid"
            },
            "streamSettings": {
                "network": "ws"
            }
        }
    ]
}

服务端配置

-略

客户端日志

Details

第一次启动
Xray 26.2.6 (Xray, Penetrates Everything.) 12ee51e (go1.25.7 windows/amd64)
A unified platform for anti-censorship.
2026/03/16 17:01:35.999625 [Info] infra/conf/serial: Reading config: &{Name:home.json Format:json}
2026/03/16 17:01:36.005585 Failed to find matching adapter name: 找不到元素。 (Code 0x00000490)
2026/03/16 17:01:36.008801 [Warning] common/errors: The feature WebSocket transport (with ALPN http/1.1, etc.) is deprecated, not recommended for using and might be removed. Please migrate to XHTTP H2 & H3 as soon as possible.
2026/03/16 17:01:36.008801 [Warning] common/errors: The feature VMess (with no Forward Secrecy, etc.) is deprecated, not recommended for using and might be removed. Please migrate to VLESS Encryption as soon as possible.
2026/03/16 17:01:36.068503 Using existing driver 0.14
2026/03/16 17:01:36.079605 Creating adapter
2026/03/16 17:01:36.301731 [Warning] core: Xray 26.2.6 started
2026/03/16 17:01:36.345055 Removed orphaned adapter "xray0"

第二次启动
Xray 26.2.6 (Xray, Penetrates Everything.) 12ee51e (go1.25.7 windows/amd64)
A unified platform for anti-censorship.
2026/03/16 17:01:50.595596 [Info] infra/conf/serial: Reading config: &{Name:home.json Format:json}
2026/03/16 17:01:50.602138 Failed to find matching adapter name: 找不到元素。 (Code 0x00000490)
2026/03/16 17:01:50.603217 [Warning] common/errors: The feature WebSocket transport (with ALPN http/1.1, etc.) is deprecated, not recommended for using and might be removed. Please migrate to XHTTP H2 & H3 as soon as possible.
2026/03/16 17:01:50.603217 [Warning] common/errors: The feature VMess (with no Forward Secrecy, etc.) is deprecated, not recommended for using and might be removed. Please migrate to VLESS Encryption as soon as possible.
2026/03/16 17:01:50.660712 Using existing driver 0.14
2026/03/16 17:01:50.669367 Creating adapter
2026/03/16 17:01:50.906238 [Warning] core: Xray 26.2.6 started
2026/03/16 17:01:50.938431 Removed orphaned adapter "Xray 1"

服务端日志

-略

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions