Connect a VPN gateway to multiple on-premises policy-based VPN devices
Article
This article helps you configure an Azure route-based VPN gateway to connect to multiple on-premises policy-based VPN devices leveraging custom IPsec/IKE policies on S2S VPN connections. The steps in this article use Azure PowerShell.
About policy-based and route-based VPN gateways
Policy-based vs. route-based VPN devices differ in how the IPsec traffic selectors are set on a connection:
Policy-based VPN devices use the combinations of prefixes from both networks to define how traffic is encrypted/decrypted through IPsec tunnels. It's typically built on firewall devices that perform packet filtering. IPsec tunnel encryption and decryption are added to the packet filtering and processing engine.
Route-based VPN devices use any-to-any (wildcard) traffic selectors, and let routing/forwarding tables direct traffic to different IPsec tunnels. It's typically built on router platforms where each IPsec tunnel is modeled as a network interface or VTI (virtual tunnel interface).
The following diagrams highlight the two models:
Policy-based VPN example
Route-based VPN example
Azure support for policy-based VPN
Currently, Azure supports both modes of VPN gateways: route-based VPN gateways and policy-based VPN gateways. They're built on different internal platforms, which result in different specifications. For more information about gateways, throughput, and connections, see About VPN Gateway settings.
Gateway VPN type
Gateway SKU
IKE versions supported
Policy-based gateway
Basic
IKEv1
Route-based gateway
Basic
IKEv2
Route-based gateway
VpnGw1, VpnGw2, VpnGw3, VpnGw4, VpnGw5
IKEv1 and IKEv2
Route-based gateway
VpnGw1AZ, VpnGw2AZ, VpnGw3AZ, VpnGw4AZ, VpnGw5AZ
IKEv1 and IKEv2
Previously, when working with policy-based VPNs, you were limited to using the policy-based VPN gateway Basic SKU and could only connect to 1 on-premises VPN/firewall device. Now, using custom IPsec/IKE policy, you can use a route-based VPN gateway and connect to multiple policy-based VPN/firewall devices. To make a policy-based VPN connection using a route-based VPN gateway, configure the route-based VPN gateway to use prefix-based traffic selectors with the option "PolicyBasedTrafficSelectors".
Considerations
To enable this connectivity, your on-premises policy-based VPN devices must support IKEv2 to connect to the Azure route-based VPN gateways. Check your VPN device specifications.
The on-premises networks connecting through policy-based VPN devices with this mechanism can only connect to the Azure virtual network; they cannot transit to other on-premises networks or virtual networks via the same Azure VPN gateway.
The configuration option is part of the custom IPsec/IKE connection policy. If you enable the policy-based traffic selector option, you must specify the complete policy (IPsec/IKE encryption and integrity algorithms, key strengths, and SA lifetimes).
The following diagram shows why transit routing via VPN gateway doesn't work with the policy-based option:
As shown in the diagram, the Azure VPN gateway has traffic selectors from the virtual network to each of the on-premises network prefixes, but not the cross-connection prefixes. For example, on-premises site 2, site 3, and site 4 can each communicate to VNet1 respectively, but can't connect via the Azure VPN gateway to each other. The diagram shows the cross-connect traffic selectors that aren't available in the Azure VPN gateway under this configuration.
To enable connectivity, use the following workflow:
Create the virtual network, VPN gateway, and local network gateway for your cross-premises connection.
Create an IPsec/IKE policy.
Apply the policy when you create a S2S or VNet-to-VNet connection, and enable the policy-based traffic selectors on the connection.
If the connection is already created, you can apply or update the policy to an existing connection.
Enable policy-based traffic selectors
This section shows you how to enable policy-based traffic selectors on a connection. Make sure you have completed Part 3 of the Configure IPsec/IKE policy article. The steps in this article use the same parameters.
Create the virtual network, VPN gateway, and local network gateway
Connect to your subscription. If you're running PowerShell locally on your computer, sign in using the Connect-AzAccount cmdlet. Or, instead, use Azure Cloud Shell in your browser.
Declare your variables. For this exercise, we use the following variables:
Use the following example to create the virtual network TestVNet1 with three subnets, and the VPN gateway. If you want to substitute values, it's important that you always name your gateway subnet specifically 'GatewaySubnet'. If you name it something else, your gateway creation fails.
Create the S2S VPN connection with policy-based traffic selectors and IPsec/IKE policy and apply the IPsec/IKE policy created in the previous step. Be aware of the additional parameter "-UsePolicyBasedTrafficSelectors $True", which enables policy-based traffic selectors on the connection.
After completing the steps, the S2S VPN connection will use the IPsec/IKE policy defined, and enable policy-based traffic selectors on the connection. You can repeat the same steps to add more connections to additional on-premises policy-based VPN devices from the same Azure VPN gateway.
To update policy-based traffic selectors
This section shows you how to update the policy-based traffic selectors option for an existing S2S VPN connection.
Tìm hiểu về các tùy chọn cổng kết nối mạng riêng ảo (VPN) trong Azure và các trường hợp điển hình để sử dụng VPN. Tạo và kiểm tra VPN để kết nối bảo mật các trang web với Azure.
Learn about VPN devices and IPsec parameters for Site-to-Site cross-premises connections. Links are provided to configuration instructions and samples.