How to Configure BGP over IKEv2 IPsec Site-to-Site VPN to an Azure VPN Gateway
To connect to your Azure virtual network with your on-premises CloudGen Firewall, Microsoft offers the Azure VPN Gateway in three different versions: basic, standard, and high performance. Only standard and high performance SKUs offer the option to use BGP to learn the routes. It is possible to configure multiple parallel VPN connections up to the peer limit of the Azure VPN Gateway SKU. To connect to the VPN Gateway, configure an IPsec IKEv2 site-to-site VPN tunnel on your CloudGen Firewall and configure BGP to exchange information with the Azure VPN Gateway. The CloudGen Firewall must be configured as the active partner. The following private ASN numbers are reserved by Azure and cannot be used for the Azure VPN Gateway.
Private ASNs: 65515, 65517, 65518, 65519, 65520
Before You Begin
You will need the following information:
Public IP address of your on-premises CloudGen Firewall
(private) ASN number
Install and configure Azure PowerShell 4.1.2 or higher.
For the VPN tunnel interface, you must use a network that contains the gateway subnet.
PowerShell Script to Create Azure VPN Gateway
Use this script to create your Azure VPN gateway with BGP routing.
$RG = 'YOUR_RESOURCE_GROUP_NAME'
$Location = 'West Europe'
$VNetName ='YOUR_VNET_NAME'
$SubNet = 'frontend'
$GWSubName = 'GatewaySubnet'
$VNetPrefix = '172.16.200.0/24'
$SubNetPrefix = '172.16.200.0/25'
$GWSubPrefix = '172.16.200.128/28'
$VNet1ASN = 65513
$GWName = 'VNetGW'
$GWIP = 'VNetGWIP'
$GWIPconf = 'gwipconf'
$LNGFName = 'onpremise'
$LNGFPrefix = '172.16.201.227/23'
$LNGFIP = 'YOUR_ONPREMISES_PUBLIC_IP_ADDRESS'
$LNGFASN = 65514
$BGPPeerIP = '172.16.201.227'
$ConnectionName = 'AzureToHome'
$sharedKey='supersecretpassword'
#To find the SKU that meets your requirements, see https://docs.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-about-vpngateways.
$GatewaySKU = 'VpnGw1'
Write-Host 'Creating Resource Group'
New-AzureRmResourceGroup -Location $Location -Name $RG
Write-Host 'Creating Virtual Networks and Subnets'
$gwpip = New-AzureRmPublicIpAddress -Name $GWIP -ResourceGroupName $RG -Location $Location -AllocationMethod Dynamic
$front = New-AzureRmVirtualNetworkSubnetConfig -Name $SubNet -AddressPrefix $SubNetPrefix
$gwsub1 = New-AzureRmVirtualNetworkSubnetConfig -Name $GWSubName -AddressPrefix $GWSubPrefix
$vnet = New-AzureRmVirtualNetwork -Name $VNetName -ResourceGroupName $RG -Location $Location -AddressPrefix $VNetPrefix -Subnet $front,$gwsub1
#$vnet = Get-AzureRmVirtualNetwork -Name $VNetName -ResourceGroupName $RG
$subnet1 = Get-AzureRmVirtualNetworkSubnetConfig -Name $GWSubName -VirtualNetwork $vnet
$gwipconf = New-AzureRmVirtualNetworkGatewayIpConfig -Name $GWIPconf -Subnet $subnet1 -PublicIpAddress $gwpip
Write-Host 'Creating Azure VPN Gateway. This may take a long time...'
$vnetgw = New-AzureRmVirtualNetworkGateway -Name $GWName -ResourceGroupName $RG -Location $Location -Ipconfigurations $gwipconf -GatewayType Vpn -VpnType RouteBased -GatewaySku HighPerformance -Asn $VNet1ASN
$lnggw = New-AzureRmLocalNetworkGateway -Name $LNGFName -ResourceGroupName $RG -Location $Location -GatewayIpAddress $LNGFIP -AddressPrefix $LNGFPrefix -Asn $LNGFASN -BgpPeeringAddress $BGPPeerIP
Write-Host 'Waiting 10 seconds and then creating the VPN connection...'
Start-Sleep -Seconds 10
$vpnconnection = New-AzureRmVirtualNetworkGatewayConnection -Name $ConnectionName -ResourceGroupName $RG -VirtualNetworkGateway1 $vnetgw -LocalNetworkGateway2 $lnggw -Location $Location -ConnectionType IPsec -SharedKey $sharedkey -EnableBgp $true
Write-Host 'Azure VPN created. Retrieving configuration information... '
Write-Host ('Public IP Address for the Azure VPN Gateway: {0}' -f (Get-AzureRmPublicIpAddress -Name "VNetGWIP" -ResourceGroupName $RG).IpAddress )
$lnggw = Get-AzureRmLocalNetworkGateway -Name $LNGFName -ResourceGroupName $RG
$vnetgw = Get-AzureRmVirtualNetworkGateway -Name $GWName -ResourceGroupName $RG
# Retrieve required configuration settings
Write-Host "`nAzure VPN Gateway BGP Settings:"
Write-Host ("`tASN: {0}" -f $vnetgw.BgpSettings.Asn )
Write-Host ("`tBGP Peering Address: {0}" -f $vnetgw.BgpSettings.BgpPeeringAddress )
Write-Host "`nOnpremises NextGen Firewall BGP Settings:"
Write-Host ("`tASN: {0}" -f $lnggw.BgpSettings.Asn )
Write-Host ("`tBGP Peering Address: {0}" -f $lnggw.BgpSettings.BgpPeeringAddress )
Write-Host ("`nVPN Connection Status: " -f $vpnconnection.ConnectionStatus)Step 1. Create a Dynamic Microsoft Azure VPN Gateway Using Azure Resource Manager and PowerShell
Use Azure PowerShell to create a routed-based VPN gateway.
Open Azure PowerShell.
Connect to your Azure account:
Login-AzureRmAccountEnter your Azure account credentials and click Login.
Edit the PowerShell script to create an Azure VPN Gateway to match your needs.
Execute the PowerShell script to create the Azure VPN Gateway.
This operation requires between 30 and 60 minutes to complete.
Write down the public IP address of the Azure VPN Gateway and BGP information for the local and remote BGP peers from the output of the PowerShell script.
Step 2. (optional) Get the VPN Gateway Public IP Address and BGP Settings
If you did not use the script to retrieve the public IP address and BGP peers, it is also possible to retrieve this information via PowerShell:
Open Azure PowerShell.
Get the IP address assigned to the VPN gateway:
Get-AzureRmPublicIpAddress -Name PUBLIC_IP_NAME -ResourceGroupName YOUR_RESOURCE_GROUP_NAMEGet the BGP settings for the local VPN endpoint:
$lnggw = Get-AzureRmLocalNetworkGateway -Name LOCAL_GATEWAY_NAME -ResourceGroupName YOUR_RESOURCE_GROUP_NAME $lngw.BgpSettingsTextGet the BGP setting for the remote VPN endpoint:
$vnetgw = Get-AzureRmVirtualNetworkGateway -Name AZURE_VPN_GATEWAY_NAME -ResourceGroupName YOUR_RESOURCE_GROUP_NAME $vnetgw.BgpSettingsText
Step 3. Create VPN Next Hop Interfaces
Go to CONFIGURATION > Configuration Tree > Box > Assigned Services > VPN-Service > VPN Settings.
Click Lock.
In the left navigation bar, click Routed VPN.
Click Add in the VPN Next Hop Interface Configuration section.
VPN Interface Index – Enter a number between 0 and 99. Each interface index number must be unique.
MTU – Enter
1398.IP Addresses – Enter the BgpPeeringAddress for the local VPN endpoint retrieved in Step 2.
Click OK.
Click Send Changes and Activate.
Step 4. Add the VPN Next Hop Interface IP Address to the Shared IPs
Add the local BGP peering IP address as a Shared IP address:
Go to CONFIGURATION > Configuration Tree > Box > Network.
Click Lock.
In the left menu, click IP Configuration.
In the Shared Networks and IPs section, click +.
Enter a name for the shared IP address, and click OK....
The Shared Networks and IPs window opens.
Interface – Select other and enter
vpnr10.Network Address