因为业务需要,需要在公司,AWS和Azure之间都搭建IPSec的连接。主要挑战在于:
解决方法如下 限于篇幅 我就不写具体的操作 可以从相关链接进行查询,更多的是提供一个思路
AWS使用自带的IPSEC 网关便可直接和路由器搭建连接。不同的路由器配置界面不太一样,不过基本思路是一样的。我之前已经写过一个博文记录操作
https://blog.51cto.com/beanxyz/2177992
微软提供了一个解决方案,针对那些不支持BGP的路由器也可以使用route-based的IPSEC连接,这样可以绕过1个连接的限制。需要用户自定义IPSEC/IKE的标准,这个操作图形界面不支持,只能通过PowerShell实现
https://docs.microsoft.com/en-us/azure/***-gateway/***-gateway-connect-multiple-policybased-rm-ps
#Connect to Azure
Connect-AzureRmAccount
$Sub1 = "Free Trial"
$RG1 = "MyResourceGroup"
$Location1 = "australiaeast"
$VNetName1 = "TestVNet1"
$FESubName1 = "FrontEnd"
$BESubName1 = "Backend"
$GWSubName1 = "GatewaySubnet"
$VNetPrefix11 = "10.11.0.0/16"
$VNetPrefix12 = "10.12.0.0/16"
$FESubPrefix1 = "10.11.0.0/24"
$BESubPrefix1 = "10.12.0.0/24"
$GWSubPrefix1 = "10.12.255.0/27"
$DNS1 = "8.8.8.8"
$GWName1 = "VNet1GW"
$GW1IPName1 = "VNet1GWIP1"
$GW1IPconf1 = "gw1ipconf1"
$ConnectionIT = "VNet1toSiteIT"
$LNGNameIT = "SiteIT"
$LNGPrefixIT = "10.2.13.0/24"
$LNGIPIT = "19.12.127.94"
# Create subnets
$fesub1 = New-AzureRmVirtualNetworkSubnetConfig -Name $FESubName1 -AddressPrefix $FESubPrefix1
$besub1 = New-AzureRmVirtualNetworkSubnetConfig -Name $BESubName1 -AddressPrefix $BESubPrefix1
$gwsub1 = New-AzureRmVirtualNetworkSubnetConfig -Name $GWSubName1 -AddressPrefix $GWSubPrefix1
#Create VNet
New-AzureRmVirtualNetwork -Name $VNetName1 -ResourceGroupName $RG1 -Location $Location1 -AddressPrefix $VNetPrefix11,$VNetPrefix12 -Subnet $fesub1,$besub1,$gwsub1
#Create a public IP and associate it to the gateway subnet
$gw1pip1 = New-AzureRmPublicIpAddress -Name $GW1IPName1 -ResourceGroupName $RG1 -Location $Location1 -AllocationMethod Dynamic
$vnet1 = Get-AzureRmVirtualNetwork -Name $VNetName1 -ResourceGroupName $RG1
$subnet1 = Get-AzureRmVirtualNetworkSubnetConfig -Name "GatewaySubnet" -VirtualNetwork $vnet1
$gw1ipconf1 = New-AzureRmVirtualNetworkGatewayIpConfig -Name $GW1IPconf1 -Subnet $subnet1 -PublicIpAddress $gw1pip1
#Create route-based Virtual Gateway
New-AzureRmVirtualNetworkGateway -Name $GWName1 -ResourceGroupName $RG1 -Location $Location1 -IpConfigurations $gw1ipconf1 -GatewayType *** -***Type RouteBased -GatewaySku ***Gw1
#Create local Gateway
New-AzureRmLocalNetworkGateway -Name $LNGNameIT -ResourceGroupName $RG1 -Location $Location1 -GatewayIpAddress $LNGIPIT -AddressPrefix $LNGPrefixIT
#Define IPSEC/IKE
$ipsecpolicy6 = New-AzureRmIpsecPolicy -IkeEncryption AES256 -IkeIntegrity SHA256 -DhGroup DHGroup2 -IpsecEncryption AES256 -IpsecIntegrity SHA256 -PfsGroup None
$vnet1gw = Get-AzureRmVirtualNetworkGateway -Name $GWName1 -ResourceGroupName $RG1
$lng6 = Get-AzureRmLocalNetworkGateway -Name $LNGNameIT -ResourceGroupName $RG1
#Create new Connection
New-AzureRmVirtualNetworkGatewayConnection -Name $Connectionit -ResourceGroupName $RG1 -VirtualNetworkGateway1 $vnet1gw -LocalNetworkGateway2 $lng6 -Location $Location1 -ConnectionType IPsec -IpsecPolicies $ipsecpolicy6 -SharedKey 'AzurepassWord'
执行上面的代码,替换自己的IP地址就行了。注意创建Virtual Network Gateway会花20分钟,耐心等待即可。(鄙视一下Azure,AWS里面创建一个同样功能的网关就一分钟)
公司路由器上根据自己定义的标准,选择配置对应的IKE标准就是了
因为AWS支持IKEv1 而 Azure支持IKEv2,因为解决方案只能是在AWS上搭建一个新的实例来充当软路由。
豆子尝试了Vyos 不过不太好使,最后发现用Windows 服务器自带的路由服务就可以实现了。 具体操作参见
http://awsfeed.com/post/165181537929/connecting-clouds-aws-to-azure-site-to-site-***
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。