Windows 上的 Wireguard:无法设置接口地址、路由、dns、

Windows 上的 Wireguard:无法设置接口地址、路由、dns、

我已经在 Windows 7-32 位上安装了 Wireguard 并设置了配置:

[Interface]
PrivateKey = *********
Address = 172.22.2.2/24
DNS = 172.22.2.1

[Peer]
PublicKey = *******
AllowedIPs = 0.0.0.0/0
Endpoint = ******:8755
PersistentKeepalive = 45

非常确定 DNS 设置无关紧要,因为我已将其“#”并设置为“8.8.8.8”,而其他一切都相同。AllowedIPs 也不重要,因为它已设置为“172.22.2.1”和“172.22.2.1/24”

一开始确实连接上了,但很快就失败了。弹出窗口提示一切都出错了

无法设置接口地址、路由、dns 和/或接口设置

以下是一次连接尝试的完整日志:

2020-10-11 14:00:12.436200: [TUN] [OneVPS] Starting WireGuard/0.1.1 (Windows 6.1.7601; 386)
2020-10-11 14:00:12.437200: [TUN] [OneVPS] Watching network interfaces
2020-10-11 14:00:12.445200: [TUN] [OneVPS] Resolving DNS names
2020-10-11 14:00:12.445200: [TUN] [OneVPS] Creating Wintun interface
2020-10-11 14:00:13.938200: [TUN] [OneVPS] Warning: unable to determine Wintun version: The system cannot find the file specified.
2020-10-11 14:00:13.939200: [TUN] [OneVPS] Enabling firewall rules
2020-10-11 14:00:13.998200: [TUN] [OneVPS] Dropping privileges
2020-10-11 14:00:13.998200: [TUN] [OneVPS] Creating interface instance
2020-10-11 14:00:13.999200: [TUN] [OneVPS] Routine: encryption worker - started
2020-10-11 14:00:14.000200: [TUN] [OneVPS] Routine: encryption worker - started
2020-10-11 14:00:14.001200: [TUN] [OneVPS] Routine: decryption worker - started
2020-10-11 14:00:14.001200: [TUN] [OneVPS] Routine: handshake worker - started
2020-10-11 14:00:14.001200: [TUN] [OneVPS] Routine: decryption worker - started
2020-10-11 14:00:14.002200: [TUN] [OneVPS] Routine: event worker - started
2020-10-11 14:00:14.002200: [TUN] [OneVPS] Routine: encryption worker - started
2020-10-11 14:00:14.002200: [TUN] [OneVPS] Routine: decryption worker - started
2020-10-11 14:00:14.002200: [TUN] [OneVPS] Routine: handshake worker - started
2020-10-11 14:00:14.002200: [TUN] [OneVPS] Routine: encryption worker - started
2020-10-11 14:00:14.002200: [TUN] [OneVPS] Routine: decryption worker - started
2020-10-11 14:00:14.002200: [TUN] [OneVPS] Routine: handshake worker - started
2020-10-11 14:00:14.002200: [TUN] [OneVPS] Routine: encryption worker - started
2020-10-11 14:00:14.002200: [TUN] [OneVPS] Routine: decryption worker - started
2020-10-11 14:00:14.003200: [TUN] [OneVPS] Routine: handshake worker - started
2020-10-11 14:00:14.003200: [TUN] [OneVPS] Routine: TUN reader - started
2020-10-11 14:00:14.003200: [TUN] [OneVPS] Routine: encryption worker - started
2020-10-11 14:00:14.003200: [TUN] [OneVPS] Routine: handshake worker - started
2020-10-11 14:00:14.003200: [TUN] [OneVPS] Routine: handshake worker - started
2020-10-11 14:00:14.003200: [TUN] [OneVPS] Routine: encryption worker - started
2020-10-11 14:00:14.003200: [TUN] [OneVPS] Routine: decryption worker - started
2020-10-11 14:00:14.003200: [TUN] [OneVPS] Routine: decryption worker - started
2020-10-11 14:00:14.004200: [TUN] [OneVPS] Routine: handshake worker - started
2020-10-11 14:00:14.004200: [TUN] [OneVPS] Routine: handshake worker - started
2020-10-11 14:00:14.004200: [TUN] [OneVPS] Routine: encryption worker - started
2020-10-11 14:00:14.004200: [TUN] [OneVPS] Routine: decryption worker - started
2020-10-11 14:00:14.004200: [TUN] [OneVPS] Setting interface configuration
2020-10-11 14:00:14.005200: [TUN] [OneVPS] UAPI: Updating private key
2020-10-11 14:00:14.005200: [TUN] [OneVPS] UAPI: Removing all peers
2020-10-11 14:00:14.006200: [TUN] [OneVPS] UAPI: Transition to peer configuration
2020-10-11 14:00:14.006200: [TUN] [OneVPS] peer(WrUw…B4VY) - UAPI: Created
2020-10-11 14:00:14.006200: [TUN] [OneVPS] peer(WrUw…B4VY) - UAPI: Updating endpoint
2020-10-11 14:00:14.007200: [TUN] [OneVPS] peer(WrUw…B4VY) - UAPI: Updating persistent keepalive interval
2020-10-11 14:00:14.008200: [TUN] [OneVPS] peer(WrUw…B4VY) - UAPI: Removing all allowedips
2020-10-11 14:00:14.008200: [TUN] [OneVPS] peer(WrUw…B4VY) - UAPI: Adding allowedip
2020-10-11 14:00:14.008200: [TUN] [OneVPS] Bringing peers up
2020-10-11 14:00:14.015200: [TUN] [OneVPS] Routine: receive incoming IPv6 - started
2020-10-11 14:00:14.016200: [TUN] [OneVPS] Routine: receive incoming IPv4 - started
2020-10-11 14:00:14.016200: [TUN] [OneVPS] UDP bind has been updated
2020-10-11 14:00:14.016200: [TUN] [OneVPS] peer(WrUw…B4VY) - Starting...
2020-10-11 14:00:14.016200: [TUN] [OneVPS] peer(WrUw…B4VY) - Routine: sequential receiver - started
2020-10-11 14:00:14.016200: [TUN] [OneVPS] peer(WrUw…B4VY) - Routine: nonce worker - started
2020-10-11 14:00:14.017200: [TUN] [OneVPS] peer(WrUw…B4VY) - Routine: sequential sender - started
2020-10-11 14:00:14.017200: [TUN] [OneVPS] peer(WrUw…B4VY) - Sending keepalive packet
2020-10-11 14:00:14.017200: [TUN] [OneVPS] Monitoring default v6 routes
2020-10-11 14:00:14.017200: [TUN] [OneVPS] peer(WrUw…B4VY) - Sending handshake initiation
2020-10-11 14:00:14.018200: [TUN] [OneVPS] Binding v6 socket to interface 23 (blackhole=false)
2020-10-11 14:00:14.019200: [TUN] [OneVPS] peer(WrUw…B4VY) - Awaiting keypair
2020-10-11 14:00:14.019200: [TUN] [OneVPS] Setting device v6 addresses
2020-10-11 14:00:14.418200: [TUN] [OneVPS] Monitoring default v4 routes
2020-10-11 14:00:14.418200: [TUN] [OneVPS] Binding v4 socket to interface 23 (blackhole=false)
2020-10-11 14:00:14.419200: [TUN] [OneVPS] Setting device v4 addresses
2020-10-11 14:00:14.546200: [TUN] [OneVPS] Listening for UAPI requests
2020-10-11 14:00:14.546200: [TUN] [OneVPS] Startup complete
2020-10-11 14:00:14.546200: [TUN] [OneVPS] Unable to set interface addresses, routes, dns, and/or interface settings: runNetsh run - exit status 1
2020-10-11 14:00:14.664200: [TUN] [OneVPS] Device closing
2020-10-11 14:00:14.664200: [TUN] [OneVPS] Routine: TUN reader - stopped
2020-10-11 14:00:15.311200: [TUN] [OneVPS] Routine: event worker - stopped
2020-10-11 14:00:15.311200: [TUN] [OneVPS] Routine: receive incoming IPv4 - stopped
2020-10-11 14:00:15.311200: [TUN] [OneVPS] Routine: receive incoming IPv6 - stopped
2020-10-11 14:00:15.311200: [TUN] [OneVPS] Routine: decryption worker - stopped
2020-10-11 14:00:15.311200: [TUN] [OneVPS] peer(WrUw…B4VY) - Stopping...
2020-10-11 14:00:15.311200: [TUN] [OneVPS] Routine: decryption worker - stopped
2020-10-11 14:00:15.312200: [TUN] [OneVPS] Routine: encryption worker - stopped
2020-10-11 14:00:15.312200: [TUN] [OneVPS] Routine: encryption worker - stopped
2020-10-11 14:00:15.312200: [TUN] [OneVPS] Routine: decryption worker - stopped
2020-10-11 14:00:15.312200: [TUN] [OneVPS] Routine: encryption worker - stopped
2020-10-11 14:00:15.313200: [TUN] [OneVPS] Routine: handshake worker - stopped
2020-10-11 14:00:15.313200: [TUN] [OneVPS] Routine: handshake worker - stopped
2020-10-11 14:00:15.313200: [TUN] [OneVPS] Routine: handshake worker - stopped
2020-10-11 14:00:15.313200: [TUN] [OneVPS] Routine: encryption worker - stopped
2020-10-11 14:00:15.313200: [TUN] [OneVPS] Routine: decryption worker - stopped
2020-10-11 14:00:15.313200: [TUN] [OneVPS] Routine: encryption worker - stopped
2020-10-11 14:00:15.313200: [TUN] [OneVPS] Routine: handshake worker - stopped
2020-10-11 14:00:15.313200: [TUN] [OneVPS] Routine: decryption worker - stopped
2020-10-11 14:00:15.313200: [TUN] [OneVPS] Routine: handshake worker - stopped
2020-10-11 14:00:15.314200: [TUN] [OneVPS] Routine: decryption worker - stopped
2020-10-11 14:00:15.314200: [TUN] [OneVPS] Routine: encryption worker - stopped
2020-10-11 14:00:15.314200: [TUN] [OneVPS] Routine: handshake worker - stopped
2020-10-11 14:00:15.314200: [TUN] [OneVPS] Routine: handshake worker - stopped
2020-10-11 14:00:15.314200: [TUN] [OneVPS] Routine: encryption worker - stopped
2020-10-11 14:00:15.314200: [TUN] [OneVPS] Routine: handshake worker - stopped
2020-10-11 14:00:15.314200: [TUN] [OneVPS] Routine: decryption worker - stopped
2020-10-11 14:00:15.314200: [TUN] [OneVPS] Routine: encryption worker - stopped
2020-10-11 14:00:15.314200: [TUN] [OneVPS] Routine: decryption worker - stopped
2020-10-11 14:00:15.315200: [TUN] [OneVPS] peer(WrUw…B4VY) - Routine: nonce worker - stopped
2020-10-11 14:00:15.315200: [TUN] [OneVPS] peer(WrUw…B4VY) - Routine: sequential receiver - stopped
2020-10-11 14:00:15.315200: [TUN] [OneVPS] peer(WrUw…B4VY) - Routine: sequential sender - stopped
2020-10-11 14:00:15.315200: [TUN] [OneVPS] Interface closed
2020-10-11 14:00:15.315200: [TUN] [OneVPS] Shutting down

答案1

根据您的配置,这不适用于您的情况,但我遇到了完全相同的行为,并认为也许其他人可以使用我的解决方案:在测试了很多不同的事情之后(重新激活 IPv6、从头开始构建客户端、与不同的用户一起运行、多次重启等),结果是Windows 客户端似乎不喜欢隧道配置中的 MTU 值。只需删除该条目即可解决这个问题,因此,如果您删除 keepalive,也许就可以解决这个问题。

相关内容