Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 .NET 中编写一个 VPN 程序。我不确定如何创建所需的虚拟网络适配器。我查看了 OpenVPN 使用的 tuntap 驱动程序,但它的 .NET 绑定很差,甚至不存在。我还听说微软的内置 Loopback 驱动程序可能能够做到这一点,但我不知道如何“连接”到它,以便我的应用程序可以管理通过适配器发送的数据包。
如何从 .NET 创建和使用虚拟网络适配器?
如果您在 Windows 中配置了 VPN,则可以使用以下命令连接到它:
Process.Start("rasdial.exe", "YOUR_VPN YOUR_Username YOUR_Password");
然后断开它:
Process.Start("rasdial.exe", "YOUR_VPN /d");