我创建了一个 Wireguard 服务器,但无法在我的个人 Windows 10 PC 上运行它。当我尝试使用该应用程序激活隧道时,我可以看到 Wireguard 网络适配器在设备管理器中短暂出现,然后 Wireguard 失败,并显示“无法创建网络适配器“。
我做了什么:
我尝试从许多不同的设备(iOS、MacOS、Windows 10 笔记本电脑、Windows 8 PC)进行连接,所有配置都运行正常,所以我很确定客户端-服务器配置不是问题,问题出在我的操作系统上。
我尝试使用 wireshark 检查流量,甚至看不到握手,因此 Wireguard 确实在创建连接器之前失败了。
我尝试重置 Windows 网络设置。
我尝试从网络适配器中删除 WAN 微型端口,但不久之后它又出现在列表中。
我还尝试使用 >wireguard /installtunnelservice "C:\config_path.conf" 从提升的控制台启动 wireguard,但出现了同样的错误。
当然,我尝试以管理员用户身份执行所有操作,并且 WG 也在管理员下安装。
我尝试了旧版本的 Wireguard(4.x)
我尝试使用 Revo 和 Ccleaner 清理我的注册表
最后,我在安装其他软件(npcap,如果这很重要)时注意到一个奇怪的错误,这可能表明了一些问题。安装此软件时,我卸载了 wireguard 应用程序。该软件正在查看我系统上可用的驱动程序包。在某个时候,它找到了由 Wireguard LLC 订阅的驱动程序包(我再次认为它已被完全卸载),并失败并显示以下错误日志:
由于 Wireguard 网络适配器驱动程序包导致 NpCap 安装失败
[00004D70] 2023-09-28 14:45:20 <-- executeCommand
[00004D70] 2023-09-28 14:45:20 --> getInfNamesFromPnpUtilOutput
[00004D70] 2023-09-28 14:45:20 <-- getInfNamesFromPnpUtilOutput
[00004D70] 2023-09-28 14:45:20 <-- ClearDriverStore
[00004D70] 2023-09-28 14:45:20 <-- _tmain: succeed, nStatus = 0.
[00001F88] 2023-09-28 14:45:20 --> wmain
[00001F88] 2023-09-28 14:45:20 _tmain: executing, argv[1] = -n.
[00001F88] 2023-09-28 14:45:20 _tmain: executing, argv[2] = -iw.
[00001F88] 2023-09-28 14:45:20 --> InstallWFPCallout
[00001F88] 2023-09-28 14:45:20 --> GetWFPCalloutInfFilePath
[00001F88] 2023-09-28 14:45:20 lpFilename = C:\Program Files\Npcap\NPCAP_wfp.inf
[00001F88] 2023-09-28 14:45:20 <-- GetWFPCalloutInfFilePath
[00001F88] 2023-09-28 14:45:20 --> isFileExist
[00001F88] 2023-09-28 14:45:20 FindFirstFile: succeed, szFileFullPath = C:\Program Files\Npcap\NPCAP_wfp.inf.
[00001F88] 2023-09-28 14:45:20 <-- isFileExist
[00001F88] 2023-09-28 14:45:20 LaunchINFSectionEx: executing, szCmd = C:\Program Files\Npcap\NPCAP_wfp.inf,DefaultInstall,,36,N.
[00001F88] 2023-09-28 14:45:20 <-- InstallWFPCallout
[00001F88] 2023-09-28 14:45:20 <-- _tmain: succeed, nStatus = 0.
[00002E4C] 2023-09-28 14:45:21 --> wmain
[00002E4C] 2023-09-28 14:45:21 _tmain: executing, argv[1] = -n.
[00002E4C] 2023-09-28 14:45:21 _tmain: executing, argv[2] = -i2.
[00002E4C] 2023-09-28 14:45:21 --> InstallDriver
[00002E4C] 2023-09-28 14:45:21 --> GetServiceInfFilePath
[00002E4C] 2023-09-28 14:45:21 lpFilename = C:\Program Files\Npcap\NPCAP.inf
[00002E4C] 2023-09-28 14:45:21 <-- GetServiceInfFilePath
[00002E4C] 2023-09-28 14:45:21 --> InstallSpecifiedComponent
[00002E4C] 2023-09-28 14:45:21 --> HrGetINetCfg
[00002E4C] 2023-09-28 14:45:21 CoCreateInstance: error, hr = 0x8007045a.
[00002E4C] 2023-09-28 14:45:21 <-- HrGetINetCfg
[00002E4C] 2023-09-28 14:45:21 Error 0x8007045a: Couldn't the get notify object interface.
Possible cause:
Failed to initalize DLL (DLL).
除此之外,我在我的机器上能找到的诊断信息非常少,但它们在这里
Wireguard 应用程序日志
2023-10-02 13:48:56.797: [TUN] [koldi-desktop] Starting WireGuard/0.5.3 (Windows 10.0.19045; amd64)
2023-10-02 13:48:56.797: [TUN] [koldi-desktop] Watching network interfaces
2023-10-02 13:48:56.799: [TUN] [koldi-desktop] Resolving DNS names
2023-10-02 13:48:56.799: [TUN] [koldi-desktop] Creating network adapter
2023-10-02 13:48:56.876: [TUN] [koldi-desktop] Using existing driver 0.10
2023-10-02 13:48:56.883: [TUN] [koldi-desktop] Creating adapter
2023-10-02 13:49:11.897: [TUN] [koldi-desktop] Timed out waiting for device query: Operation timeout. (Code 0x00000102)
2023-10-02 13:49:11.897: [TUN] [koldi-desktop] Failed to setup adapter (problem code: 0x38, ntstatus: 0x0): Device not ready. (Code 0x000010DF)
2023-10-02 13:49:11.910: [TUN] [koldi-desktop] Unable to create network adapter: Error creating adapter: The device is not ready for use.
2023-10-02 13:49:11.910: [TUN] [koldi-desktop] Shutting down
2023-10-02 13:49:11.911: [MGR] [koldi-desktop] Tunnel service tracker finished
Windows 事件查看器日志
10/2/2023 1:48:56 PM - Information A service was installed in the system.Service Name: WireGuard Tunnel: koldi-desktop
Service File Name: "C:\Program Files\WireGuard\wireguard.exe" /tunnelservice "C:\Program Files\WireGuard\Data\Configurations\koldi-desktop.conf.dpapi"
10/2/2023 1:48:56 PM - Error The Network Setup service terminated unexpectedly. It has done this 6 time(s).
10/2/2023 1:49:11 PM - Error The WireGuard Tunnel: koldi-desktop service terminated with the following service-specific error:
The system cannot find the path specified.
这是一个重要的更新,似乎让我更接近问题的根源。我尝试安装旧版本的 WireGuard,它为我提供了更完整的应用程序日志,并且我还设法在 Windows/INF/setupapi.dev.log 中跟踪了同样的错误
新的 Wireguard 日志
2023-10-05 14:55:45.568: [MGR] Starting WireGuard/0.4 (Windows 10.0.19045; amd64)
2023-10-05 14:55:45.573: [MGR] Starting UI process for user ‘koldi@DESKTOP-TN3C3LQ’ for session 1
2023-10-05 14:55:46.128: [MGR] An update is available
2023-10-05 14:56:01.655: [TUN] [koldi-desktop] Starting WireGuard/0.4 (Windows 10.0.19045; amd64)
2023-10-05 14:56:01.655: [TUN] [koldi-desktop] Watching network interfaces
2023-10-05 14:56:01.657: [TUN] [koldi-desktop] Resolving DNS names
2023-10-05 14:56:01.657: [TUN] [koldi-desktop] Creating network adapter
2023-10-05 14:56:01.660: [TUN] [koldi-desktop] [Wintun] WintunCreateAdapter: Creating adapter
2023-10-05 14:56:01.751: [TUN] [koldi-desktop] [Wintun] SelectDriver: Installing driver 0.13
2023-10-05 14:56:01.751: [TUN] [koldi-desktop] [Wintun] SelectDriver: Extracting driver
2023-10-05 14:56:01.752: [TUN] [koldi-desktop] [Wintun] SelectDriver: Installing driver
2023-10-05 14:56:12.010: [TUN] [koldi-desktop] [Wintun] RegistryQueryStringWait: Timeout waiting for registry value \REGISTRY\MACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0003\NetCfgInstanceId (status: 0x102)
2023-10-05 14:56:12.010: [TUN] [koldi-desktop] [Wintun] WintunCreateAdapter: Failed to get \REGISTRY\MACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0003\NetCfgInstanceId
2023-10-05 14:56:12.020: [TUN] [koldi-desktop] Unable to create network adapter: Error creating interface: The system cannot find the file specified.
2023-10-05 14:56:12.020: [TUN] [koldi-desktop] Shutting down
2023-10-05 14:56:12.021: [MGR] [koldi-desktop] Tunnel service tracker finished
Windows/INF/setupapi.dev.log
>>> [SetupCopyOEMInf - C:\Windows\Temp\a8cedcbd9cbc2dde94b3b86485a8b9e4adf1ad930f68fbc0c50b62b55965774a\wintun.inf]
>>> Section start 2023/10/05 14:56:01.754
cmd: "C:\Program Files\WireGuard\wireguard.exe" /tunnelservice "C:\Program Files\WireGuard\Data\Configurations\koldi-desktop.conf.dpapi"
inf: Copy style: 0x00000000
sto: {Setup Import Driver Package: C:\Windows\Temp\a8cedcbd9cbc2dde94b3b86485a8b9e4adf1ad930f68fbc0c50b62b55965774a\wintun.inf} 14:56:01.755
inf: Provider: WireGuard LLC
inf: Class GUID: {4D36E972-E325-11CE-BFC1-08002BE10318}
inf: Driver Version: 08/02/2021,0.13.0.0
inf: Catalog File: wintun.cat
ump: Import flags: 0x00000009
pol: {Driver package policy check} 14:56:01.774
pol: {Driver package policy check - exit(0x00000000)} 14:56:01.775
sto: {Stage Driver Package: C:\Windows\Temp\a8cedcbd9cbc2dde94b3b86485a8b9e4adf1ad930f68fbc0c50b62b55965774a\wintun.inf} 14:56:01.775
inf: {Query Configurability: C:\Windows\Temp\a8cedcbd9cbc2dde94b3b86485a8b9e4adf1ad930f68fbc0c50b62b55965774a\wintun.inf} 14:56:01.781
inf: Driver package 'wintun.inf' is configurable.
inf: {Query Configurability: exit(0x00000000)} 14:56:01.782
flq: {FILE_QUEUE_COMMIT} 14:56:01.783
flq: Copying 'C:\Windows\Temp\a8cedcbd9cbc2dde94b3b86485a8b9e4adf1ad930f68fbc0c50b62b55965774a\wintun.cat' to 'C:\Windows\System32\DriverStore\Temp\{64b59a7f-4019-b148-93f6-19c3178c14ce}\wintun.cat'.
flq: Copying 'C:\Windows\Temp\a8cedcbd9cbc2dde94b3b86485a8b9e4adf1ad930f68fbc0c50b62b55965774a\wintun.inf' to 'C:\Windows\System32\DriverStore\Temp\{64b59a7f-4019-b148-93f6-19c3178c14ce}\wintun.inf'.
flq: Copying 'C:\Windows\Temp\a8cedcbd9cbc2dde94b3b86485a8b9e4adf1ad930f68fbc0c50b62b55965774a\wintun.sys' to 'C:\Windows\System32\DriverStore\Temp\{64b59a7f-4019-b148-93f6-19c3178c14ce}\wintun.sys'.
flq: {FILE_QUEUE_COMMIT - exit(0x00000000)} 14:56:01.803
sto: {DRIVERSTORE IMPORT VALIDATE} 14:56:01.804
sig: Driver package catalog is valid.
sig: {_VERIFY_FILE_SIGNATURE} 14:56:01.819
sig: Key = wintun.inf
sig: FilePath = C:\Windows\System32\DriverStore\Temp\{64b59a7f-4019-b148-93f6-19c3178c14ce}\wintun.inf
sig: Catalog = C:\Windows\System32\DriverStore\Temp\{64b59a7f-4019-b148-93f6-19c3178c14ce}\wintun.cat
sig: Success: File is signed in catalog.
sig: {_VERIFY_FILE_SIGNATURE exit(0x00000000)} 14:56:01.824
sto: {DRIVERSTORE IMPORT VALIDATE: exit(0x00000000)} 14:56:01.826
sig: Signer Score = 0x0D000005 (WHQL)
sig: Signer Name = Microsoft Windows Hardware Compatibility Publisher
sig: Submission ID = 58177670_14147300089215136_1152921505693731132
sto: {Core Driver Package Import: wintun.inf_amd64_d97096a68f999890} 14:56:01.828
sto: {DRIVERSTORE IMPORT BEGIN} 14:56:01.828
sto: {DRIVERSTORE IMPORT BEGIN: exit(0x00000000)} 14:56:01.828
cpy: {Copy Directory: C:\Windows\System32\DriverStore\Temp\{64b59a7f-4019-b148-93f6-19c3178c14ce}} 14:56:01.828
cpy: Target Path = C:\Windows\System32\DriverStore\FileRepository\wintun.inf_amd64_d97096a68f999890
cpy: {Copy Directory: exit(0x00000000)} 14:56:01.830
idb: {Register Driver Package: C:\Windows\System32\DriverStore\FileRepository\wintun.inf_amd64_d97096a68f999890\wintun.inf} 14:56:01.831
idb: Created driver package object 'wintun.inf_amd64_d97096a68f999890' in DRIVERS database node.
idb: Created driver INF file object 'oem11.inf' in DRIVERS database node.
idb: Registered driver package 'wintun.inf_amd64_d97096a68f999890' with 'oem11.inf'.
idb: {Register Driver Package: exit(0x00000000)} 14:56:01.833
idb: {Publish Driver Package: C:\Windows\System32\DriverStore\FileRepository\wintun.inf_amd64_d97096a68f999890\wintun.inf} 14:56:01.833
idb: Activating driver package 'wintun.inf_amd64_d97096a68f999890'.
cpy: Published 'wintun.inf_amd64_d97096a68f999890\wintun.inf' to 'oem11.inf'.
idb: Indexed 2 device IDs for 'wintun.inf_amd64_d97096a68f999890'.
sto: Flushed driver database node 'DRIVERS'. Time = 15 ms
sto: Flushed driver database node 'SYSTEM'. Time = 16 ms
idb: {Publish Driver Package: exit(0x00000000)} 14:56:01.857
sto: {DRIVERSTORE IMPORT END} 14:56:01.858
dvi: Flushed all driver package files to disk. Time = 0 ms
sig: Installed catalog 'wintun.cat' as 'oem11.cat'.
sto: {DRIVERSTORE IMPORT END: exit(0x00000000)} 14:56:01.873
sto: {Core Driver Package Import: exit(0x00000000)} 14:56:01.873
sto: {Stage Driver Package: exit(0x00000000)} 14:56:01.874
! dvi: Unable to locate device 'ROOT\NET\0000'. cr = 0x0D
sto: {Setup Import Driver Package - exit (0x00000000)} 14:56:01.920
inf: Driver Store Path: C:\Windows\System32\DriverStore\FileRepository\wintun.inf_amd64_d97096a68f999890\wintun.inf
inf: Published Inf Path: C:\Windows\INF\oem11.inf
<<< Section end 2023/10/05 14:56:01.922
<<< [Exit status: SUCCESS]
>>> [Configure Driver Package - c:\windows\system32\driverstore\filerepository\wintun.inf_amd64_d97096a68f999890\wintun.inf]
>>> Section start 2023/10/05 14:56:01.973
cmd: "C:\Program Files\WireGuard\wireguard.exe" /tunnelservice "C:\Program Files\WireGuard\Data\Configurations\koldi-desktop.conf.dpapi"
sto: Source Filter = Wintun.Install
sto: Target Filter = ROOT\NET\0000
inf: Class GUID = {4d36e972-e325-11ce-bfc1-08002be10318}
inf: Class Options = Configurable
inf: {Configure Driver: Wintun Userspace Tunnel}
inf: Section Name = Wintun.Install
inf: {Configure Device: ROOT\NET\0000}
inf: {Configure Device: exit(0x00000000)}
inf: {Configure Driver: exit(0x00000000)}
<<< Section end 2023/10/05 14:56:01.978
<<< [Exit status: SUCCESS]
>>> [Restart Device - ROOT\NET\0000]
>>> Section start 2023/10/05 14:56:01.979
cmd: "C:\Program Files\WireGuard\wireguard.exe" /tunnelservice "C:\Program Files\WireGuard\Data\Configurations\koldi-desktop.conf.dpapi"
dvi: Device Status: 0x01802001
dvi: {Restarting Devices} 14:56:01.979
dvi: Start: ROOT\NET\0000
! dvi: Device 'ROOT\NET\0000' pending start: Device has problem: 0x38 (CM_PROB_NEED_CLASS_CONFIG), problem status: 0x00000000.
dvi: {Restarting Devices exit} 14:56:02.001
<<< Section end 2023/10/05 14:56:02.001
<<< [Exit status: SUCCESS]
>>> [Delete Device - ROOT\NET\0000]
>>> Section start 2023/10/05 14:56:12.010
cmd: "C:\Program Files\WireGuard\wireguard.exe" /tunnelservice "C:\Program Files\WireGuard\Data\Configurations\koldi-desktop.conf.dpapi"
dvi: Query-and-Remove succeeded
<<< Section end 2023/10/05 14:56:12.019
<<< [Exit status: SUCCESS]
如您所见,它似乎成功创建了 WinTun 网络适配器,但无法在注册表中找到它(ROOT\NET\0000
据我所知,设备对应于未知设备)或类似的东西。也许可以以某种方式手动重新安装 wintun。
我开始失去希望,任何帮助都将不胜感激。
答案1
需要进入regedit来修改权限,可以看看这个帖子,解决了我的问题: https://www.reddit.com/r/WireGuard/comments/1161mvw/unable_to_configure_adapter_network_settings/