十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
因为业务需要,需要在公司,AWS和Azure之间都搭建IPSec的连接。主要挑战在于:
创新互联建站是一家业务范围包括IDC托管业务,网站空间、主机租用、主机托管,四川、重庆、广东电信服务器租用,雅安服务器托管,成都网通服务器托管,成都服务器租用,业务范围遍及中国大陆、港澳台以及欧美等多个国家及地区的互联网数据服务公司。
解决方法如下 限于篇幅 我就不写具体的操作 可以从相关链接进行查询,更多的是提供一个思路
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-***