HarmonyOS 鸿蒙Next VPN 无法正常工作
HarmonyOS 鸿蒙Next VPN 无法正常工作
VPN 建立时,报错
更多关于HarmonyOS 鸿蒙Next VPN 无法正常工作的实战教程也可以访问 https://www.itying.com/category-93-b0.html
同样的问题,我已经尝试解决这个问题两个星期了,看起来像是一个路由问题,但我无法找出正确的路由或初始化,我希望华为能更新演示
SendRequest 168: failed, handle:13 error:202 desc:.INetworkVpnService
SendRequest 168: failed, handle:13 error:202 desc:. INetworkVpnService
[networkvpn_service_proxy.cpp:210]RegisterVpnEvent proxy SendRequest failed, error code: [202]
更多关于HarmonyOS 鸿蒙Next VPN 无法正常工作的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
有进展吗?
请教一下,如何从虚拟网卡中读取数据?
找HarmonyOS工作还需要会Flutter的哦,有需要Flutter教程的可以学学大地老师的教程,很不错,B站免费学的哦:BV1S4411E7LY/?p=17
没有太大的进展,我正在使用此代码检查路由和虚拟网卡
实际上问题是,在我启动 vpn 服务之前和之后,网络状态是一样的,我猜这与我们上面讨论的错误有关
I Checking final network state after cleanup… I Network properties: {“interfaceName”:“wlan0”,“domains”:"",“mtu”:1500,“linkAddresses”:[{“address”:{“address”:“192.168.8.242”,“family”:1,“port”:0},“prefixLength”:24}],“routes”:[{“interface”:“wlan0”,“destination”:{“address”:{“address”:“0.0.0.0”,“family”:1,“port”:0},“prefixLength”:0},“gateway”:{“address”:“192.168.8.1”,“prefixLength”:0},“hasGateway”:true,“isDefaultRoute”:false}],“dnses”:[{“address”:“192.168.8.1”,“family”:1,“port”:0}]} I Has default network: true I Network capabilities: {“linkUpBandwidthKbps”:0,“linkDownBandwidthKbps”:0,“networkCap”:[12,15,16],“bearerTypes”:[1]} I Checking initial network state… I Network properties: {“interfaceName”:“wlan0”,“domains”:"",“mtu”:1500,“linkAddresses”:[{“address”:{“address”:“192.168.8.242”,“family”:1,“port”:0},“prefixLength”:24}],“routes”:[{“interface”:“wlan0”,“destination”:{“address”:{“address”:“0.0.0.0”,“family”:1,“port”:0},“prefixLength”:0},“gateway”:{“address”:“192.168.8.1”,“prefixLength”:0},“hasGateway”:true,“isDefaultRoute”:false}],“dnses”:[{“address”:“192.168.8.1”,“family”:1,“port”:0}]} I Has default network: true I Network capabilities: {“linkUpBandwidthKbps”:0,“linkDownBandwidthKbps”:0,“networkCap”:[12,15,16],“bearerTypes”:[1]} I Creating UDP socket… I === createUdpSocket called === I Local port: 36602 I UDP socket created: 64 I UDP socket created: 64 I Protecting UDP socket… I [vpn_connection_ext.cpp 45] enter VpnConnectionExt Protect I UDP socket protected I Creating VPN with config: {“addresses”:[{“address”:{“address”:“10.0.0.1”,“family”:1,“port”:0},“prefixLength”:24}],“routes”:[{“interface”:“tun0”,“destination”:{“address”:{“address”:“0.0.0.0”,“family”:1,“port”:0},“prefixLength”:0},“gateway”:{“address”:“10.0.0.1”,“family”:1,“port”:0},“hasGateway”:true,“isDefaultRoute”:true}],“mtu”:1400,“dnsAddresses”:[“10.0.0.53”],“isIPv4Accepted”:true,“isIPv6Accepted”:false,“isBlocking”:true,“trustedApplications”:[],“blockedApplications”:[]} I [vpn_connection_ext.cpp 38] enter VpnConnectionExt SetUp I [setup_context_ext.cpp:99]family: 1 I [setup_context_ext.cpp:99]port: 0 I [setup_context_ext.cpp:210]isIpv6:0, prefixLength: 24 I [setup_context_ext.cpp:87]interface: tun0 I [setup_context_ext.cpp:99]family: 1 I [setup_context_ext.cpp:99]port: 0 I [setup_context_ext.cpp:99]prefixLength: 0 I [setup_context_ext.cpp:99]family: 1 I [setup_context_ext.cpp:99]port: 0 I [setup_context_ext.cpp:111]hasGateway: 1 I [setup_context_ext.cpp:111]isDefaultRoute: 1 I [setup_context_ext.cpp:367]mtu: 1400 I [setup_context_ext.cpp:111]isIPv4Accepted: 1 I [setup_context_ext.cpp:111]isIPv6Accepted: 0 I [setup_context_ext.cpp:111]isBlocking: 1 I [networkvpn_client.cpp:90]enter SetUpVpn 1, 1 I [vpn_interface.cpp:51]connect success. I [vpn_interface.cpp:163]receive tun device fd: [67] E SendRequest 168: failed, handle:13 error:202 desc:*.INetworkVpnService proxy:1426054144 time:856089945992788 E [networkvpn_service_proxy.cpp:210]RegisterVpnEvent proxy SendRequest failed, error code: [202] I TUN interface created with fd: 67 I Protecting TUN interface… I [vpn_connection_ext.cpp 45] enter VpnConnectionExt Protect I TUN interface protected I Starting WireGuard tunnel… I === startVpn called === I VPN tunFd: 67 I Creating new WireGuard instance I WireGuard instance created I === Initializing WireGuard === I Using existing UDP socket: 64 I Local UDP port: <private> I WireGuard initialized successfully I Starting WireGuard tunnel… I === Starting WireGuard === I TUN fd: <private> I UDP socket: <private> I WireGuard tunnel started I WireGuard tunnel started successfully I VPN tunnel started successfully I Checking final network state… I === Tunnel worker started === I TUN fd: <private> I UDP socket: <private> I Initiating aggressive handshake sequence… I WG->NET packet (148 bytes): 01 00 00 00 01 00 00 00… I Sent <private> bytes of handshake data I Initial handshake completed I Network properties: {“interfaceName”:“wlan0”,“domains”:"",“mtu”:1500,“linkAddresses”:[{“address”:{“address”:“192.168.8.242”,“family”:1,“port”:0},“prefixLength”:24}],“routes”:[{“interface”:“wlan0”,“destination”:{“address”:{“address”:“0.0.0.0”,“family”:1,“port”:0},“prefixLength”:0},“gateway”:{“address”:“192.168.8.1”,“prefixLength”:0},“hasGateway”:true,“isDefaultRoute”:false}],“dnses”:[{“address”:“192.168.8.1”,“family”:1,“port”:0}]} I Has default network: true I Network capabilities: {“linkUpBandwidthKbps”:0,“linkDownBandwidthKbps”:0,“networkCap”:[12,15,16],“bearerTypes”:[1]} I Read <private> bytes from UDP I NET->WG packet (64 bytes): 03 00 00 00 01 00 00 00… I Read <private> bytes from TUN
在HarmonyOS鸿蒙Next中,VPN无法正常工作可能是由于系统设置、网络配置或应用兼容性问题导致的。以下是一些可能的原因和解决方法:
-
系统版本问题:确保设备运行的HarmonyOS版本支持VPN功能。某些早期版本可能存在兼容性问题,建议更新到最新版本。
-
VPN配置错误:检查VPN配置是否正确,包括服务器地址、用户名、密码和认证方式。错误的配置会导致连接失败。
-
网络问题:确保设备连接的网络稳定,并且没有防火墙或代理服务器阻止VPN流量。尝试切换到其他网络(如移动数据)进行测试。
-
应用权限:确保VPN应用具有必要的权限,如网络访问权限。可以在系统设置中检查并授予相关权限。
-
VPN协议兼容性:不同的VPN协议可能与HarmonyOS存在兼容性问题。尝试更换VPN协议(如从PPTP切换到L2TP/IPSec)。
-
系统限制:某些企业或教育网络可能限制VPN使用,导致无法正常连接。检查网络是否有相关限制。
-
应用兼容性:确保使用的VPN应用与HarmonyOS兼容。某些第三方VPN应用可能未针对鸿蒙系统进行优化,尝试使用其他VPN应用。
-
系统日志:查看系统日志或VPN应用的日志,获取更多错误信息,帮助定位问题。
如果以上方法无法解决问题,可能需要进一步的技术支持。