Azure虚拟网络指向站点(例如Azure Connect)autoconnect

Bas*_*sum 4 networking azure

虽然Azure Connect正在退役,而Azure虚拟网络提供类似功能且速度更快,但我注意到了一些缺点.

Azure Connect能够自动维护连接,用户甚至无需登录.然而,Azure Virtual Network要求用户以交互方式连接/重新连接到VPN.这使得它在生产环境中非常不可用.有没有办法克服这个障碍?

Bas*_*sum 11

要解决此问题,您可以使用rasdial.我第一次使用rasdial遇到了这个问题: 这个系统不支持这个功能.不要被这条消息所迷惑,因为它只是你没有给出正确的语法.

rasdial "Your VPN name" /phonebook:%userprofile%\AppData\Roaming\Microsoft\Network\Connections\Cm\Your-VPN\Your-VPN.pbk"
Run Code Online (Sandbox Code Playgroud)
  • %userprofile%是用于安装Azure vpn的de user profiel.
  • Your-VPN是azure vpn连接的名称.

simpel方法是制作批处理脚本:

SET VPN_NAME=azureVPN
:loop
rasdial %VPN_NAME% /PHONEBOOK:C:\Users\bas\AppData\Roaming\Microsoft\Network\Connections\Cm\%VPN_NAME%\%VPN_NAME%.pbk
timeout 10
goto loop
Run Code Online (Sandbox Code Playgroud)

结果将是:

Connecting to test...
Verifying username and password...
Registering your computer on the network...
Successfully connected to test.
Command completed successfully.
Run Code Online (Sandbox Code Playgroud)

10秒后:

You are already connected to test.
Command completed successfully.
Run Code Online (Sandbox Code Playgroud)

要在计算机启动时启动此脚本,请使用taskscheduler.

这里描述了一个更好的方法: http ://blog.degree.no/2011/10/permanent-vpn-connection-in-windows/(如上所述使用rasdial)

  • 我可以使用此方法获得连接,但我需要使用我的“Azure 网络 ID”,它是一长串随机字符串,而不是“虚拟网络名称”。但是连接不正确,不允许我进入网络。当我尝试使用我的“VPN 名称”时,它说找不到此连接的电话簿条目。有任何想法吗? (2认同)
  • 这篇文章很有帮助,但非常复杂.http://www.diaryofaninja.com/blog/2013/11/27/deconstructing-the-azure-point-to-site-vpn-for-command-line-usage (2认同)