简体   繁体   English

Azure S2S VNet VPN网关

[英]Azure S2S VNet VPN Gateway

we have to setup one VNet Site to Site VPN gateway between: 我们必须在以下之间设置一个VNet站点到站点VPN网关:

VM Azure VNet <-> On premise Site. VM Azure VNet <->内部站点。

At the end of azure gateway configuration we obtain a preshared key to be used in vpn on premise device configuration. 在azure网关配置结束时,我们获得了要在前提设备配置中用于vpn的预共享密钥。

These device are not in our control, so we have asked an other preshared key that we want to set up on azure gateway. 这些设备不在我们的控制范围内,因此我们询问了另一个要在azure网关上设置的预共享密钥。

It's possible do it by web portal? 可以通过门户网站进行吗? and by power-shell? 并通过动力壳? How? 怎么样?

Thanks in advance, Regards 预先感谢,问候

PS: where i can found a complete guide of powershell commands to manipulate the VPN gateway? PS:在哪里可以找到有关操纵VPN网关的powershell命令的完整指南?

For the "Classic" ASM stack ("Classic" VNET) i'm not aware of an API that would allow you to modify the pre-shared key on the Azure Gateway. 对于“经典” ASM堆栈(“经典” VNET),我不知道允许您修改Azure网关上预共享密钥的API。

For ARM, the hint is in Step 8 ( -SharedKey parameter) https://azure.microsoft.com/en-in/documentation/articles/vpn-gateway-create-site-to-site-rm-powershell/ 对于ARM,提示位于步骤8中-SharedKey参数) https://azure.microsoft.com/zh-CN/documentation/articles/vpn-gateway-create-site-to-site-rm-powershell/

Create the VPN connection 创建VPN连接

Next, you'll create the Site-to-Site VPN connection between your virtual network gateway and your VPN device. 接下来,您将在虚拟网络网关和VPN设备之间创建站点到站点VPN连接。 Be sure to replace the values with your own. 确保用您自己的值替换这些值。 The shared key must match the value you used for your VPN device configuration. 共享密钥必须与您用于VPN设备配置的值匹配。 Note that the -ConnectionType for Site-to-Site is IPsec. 请注意,“站点到站点”的-ConnectionType是IPsec。

$gateway1 = Get-AzureRmVirtualNetworkGateway -Name vnetgw1 -ResourceGroupName testrg
$local = Get-AzureRmLocalNetworkGateway -Name LocalSite -ResourceGroupName testrg

New-AzureRmVirtualNetworkGatewayConnection -Name localtovon `
                                           -ResourceGroupName testrg `
                                           -Location 'West US' `
                                           -VirtualNetworkGateway1 $gateway1 `
                                           -LocalNetworkGateway2 $local `
                                           -ConnectionType IPsec `
                                           -RoutingWeight 10 `
                                           -SharedKey 'abc123'

NOTE 注意

You don't have to use PowerShell to create the ARM Gateway. 您不必使用PowerShell创建ARM网关。 You can now do that using the Portal UI. 现在,您可以使用门户网站UI进行操作。 You'll be presented with a pre-shared key input box when following the New "Connection" wizard. 遵循“新建”“连接”向导时,将为您提供一个预共享的密钥输入框。 So first you create the Gateway and then the Site-to-site "Connection". 因此,首先创建网关,然后创建站点到站点的“连接”。

If you already have the ARM Virtual Network Gateway created, just go to https://resources.azure.com/ type in the name of the Site-to-Site "Connection" in the search box, look for the key in the JSON representation, edit, replace and save. 如果您已经创建了ARM虚拟网络网关,只需转到https://resources.azure.com/ ,在搜索框中键入“站点到站点”“连接”的名称,然后在JSON中查找密钥。表示,编辑,替换和保存。 Wait a few minutes for the Gateway to pick up the new key and you're done. 等待几分钟,让网关提取新密钥,您就完成了。

密码

To answer your last question: 要回答您的最后一个问题:

where i can found a complete guide of powershell commands to manipulate the VPN gateway? 在哪里可以找到Powershell命令操纵VPN网关的完整指南?

Resource Explorer ( https://resources.azure.com ) has a neat way of exploring that -- check out its PowerShell tab while browsing through the resources. 资源浏览器https://resources.azure.com )有一种巧妙的浏览方式-在浏览资源时查看其PowerShell选项卡。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM