You can use an IPsec connection as a backup for an Express Connect link to improve the stability and redundancy of connections between your on-premises and cloud environments.
Example scenario
This topic describes a redundant network architecture that uses an Express Connect link and an IPsec connection as primary and backup links.
In this scenario, the Express Connect link uses Border Gateway Protocol (BGP), and the IPsec connection uses BGP or a static route.
Resource planning
Alibaba Cloud resource plan:
VPC: A VPC with the CIDR block 10.0.0.0/16 in the Germany (Frankfurt) region.
vSwitch 1: 10.0.0.0/24, which contains an ECS instance with the IP address 10.0.0.1 for connectivity tests.
vSwitch 2: 10.0.1.0/24.
TR: A CEN instance and a transit router (TR) with the CIDR block 10.3.0.0/24 are created in the Germany (Frankfurt) region.
ECR: An Express Connect Router (ECR) with Autonomous System Number (ASN) 65001.
VBR: A physical port is created to connect to the on-premises gateway device, and a Virtual Border Router (VBR) is created based on this port.
Alibaba Cloud Side IPv4 Address: 10.1.0.1.
Data Center Side IPv4 Address: 10.1.0.2.
IPv4 Subnet Mask: 255.255.255.252.
IPsec connection:
If you use BGP, the BGP settings are as follows:
Tunnel 1: The tunnel CIDR block is 169.254.10.0/30, and the Alibaba Cloud-side BGP IP address is 169.254.10.1.
Tunnel 2: The tunnel CIDR block is 169.254.20.0/30, and the Alibaba Cloud-side BGP IP address is 169.254.20.1.
Alibaba Cloud-side ASN: 65001.
On-premises IDC resource plan:
On-premises network: 172.16.0.0/16, which contains a server with the IP address 172.16.0.1 for connectivity tests.
On-premises gateway device:
Connects to Alibaba Cloud through an Express Connect link. The IP address of the network interface for the Express Connect link is 10.1.0.2.
Supports the IPsec-VPN feature. If you use BGP, the BGP settings are as follows:
Tunnel 1: The tunnel CIDR block is 169.254.10.0/30, and the on-premises BGP IP address is 169.254.10.2.
Tunnel 2: The tunnel CIDR block is 169.254.20.0/30, and the on-premises BGP IP address is 169.254.20.2.
If the IPsec connection uses static routes, make sure your on-premises gateway device supports static Equal-Cost Multi-Path (ECMP) routing. When you associate the IPsec connection with a TR, the two tunnels automatically form an ECMP link for traffic from the cloud to your on-premises IDC. If your on-premises IDC does not support ECMP for traffic to the cloud, asymmetric routing occurs.
A single public IP address is used for outbound traffic: 3.3.XX.XX. This public IP address is used to establish the IPsec connection.
On-premises ASN: 65002.
Step 1. Create resources
In the Germany (Frankfurt) region, create a dedicated or shared physical port and connect it to the on-premises gateway device.
Create the VPC and vSwitches, ECS instance, CEN instance, TR, ECR, and VBR as defined in the resource plan.
Step 2. Connect the Express Connect link
1. Connect the TR to the VPC
Go to the CEN console. In the Actions column of the TR that you created, click Create Connection > Create Intra-Region Connection, and then create a VPC connection:
Instance Type: VPC
Region: Germany (Frankfurt)
Network Instance: Select the VPC that you created.
Advanced Configurations: Keep the three default options selected.
2. Connect the TR, ECR, and VBR
By default, we recommend that you use an ECR to connect a TR and a VBR to achieve lower latency, higher bandwidth, and more flexible route control capabilities. For more information, see Express Connect Router (ECR).
The procedure varies depending on whether you use an ECR.
ECR (recommended)
Navigate to the ECR list page and click the ID of your ECR instance to open its details page.
On the VBR tab, click Add VBR:
Region: Germany (Frankfurt).
Network Instance: Select the target VBR.
On the TR tab, click Associate TR:
CEN ID: Select the target CEN instance.
Region: Germany (Frankfurt).
Allowed Route Prefixes: Select the default Matching Mode and leave the text box below empty. For more information about prefix routes, see Advertise specified prefix routes through an ECR.
Without ECR
Without an ECR, you connect the TR directly to the VBR. Follow these steps.
In the Actions column of the target TR, click Create Connection > Create Intra-Region Connection:
Network Type: Virtual Border Router (VBR).
Region: Germany (Frankfurt).
Networks: Select the target VBR instance.
Advanced Settings: Keep the three default options enabled.
3. Enable BGP on the VBR
Navigate to the VBR list page, select the Germany (Frankfurt) region, and click the ID of your VBR instance to open its details page.
On the BGP Groups tab, click Create BGP Group, and set Peer ASN to the ASN of the on-premises IDC, which is 65002.
On the BGP Peers tab, click Create BGP Peer. For BGP Group, select the BGP group that you just created. For BGP Peer IP, enter the Data Center Side IPv4 Address, 10.1.0.2.
Wait 1 to 5 minutes, and then verify that the BGP peer BGP Connection Status is The BGP connection is established.
4. Check the routes
After you complete the connections and BGP configurations, routes are automatically propagated between the VPC and the on-premises IDC. Check the route tables of each resource for the following entries:
VPC route table
Destination CIDR block
Next hop
Source
10.0.0.0/8
TR
System-generated when the VPC connection was created (The Auto-add transit router routes to all VPC route tables option was selected.)
172.16.0.0/12
TR
System-generated when the VPC connection was created
192.168.0.0/16
TR
System-generated when the VPC connection was created
TR route table
Destination CIDR block
Next hop
Source
10.0.0.0/24
VPC
10.0.1.0/24
VPC
172.16.0.0/16
ECR (or VBR if an ECR is not used)
ECR route table
Destination CIDR block
Next hop
Source
10.0.0.0/24
TR
10.0.1.0/24
TR
172.16.0.0/16
VBR
Propagated by BGP
VBR route table
Destination CIDR block
Next hop
Source
10.0.0.0/24
ECR
Propagated by ECR
10.0.1.0/24
ECR
Propagated by ECR
172.16.0.0/16
Physical port
Propagated by BGP
If you do not use an ECR, the next hop for routes 10.0.0.0/24 and 10.0.1.0/24 is the TR, and the source is Synced from TR.
On-premises gateway device route table
Destination CIDR block
Next hop
Source
10.0.0.0/24
Network interface for the Express Connect link
Propagated by BGP
10.0.1.0/24
Network interface for the Express Connect link
Propagated by BGP
5. Verify connectivity
Log on to the ECS instance (10.0.0.1) in the VPC and run the ping command to test the connectivity to the on-premises server (172.16.0.1). If you receive a response, the connection is established.
ping 172.16.0.1Step 3. Connect the IPsec connection
1. Create a customer gateway
Go to the Customer Gateways page and click Create Customer Gateway. Configure the following parameters:
IP Address: Enter the public IP address of the on-premises gateway device, 3.3.XX.XX.
ASN: Enter the ASN of the on-premises IDC, 65002.
2. Create an IPsec connection
In the left-side navigation pane of the VPN Gateway console, click IPsec Connections.
Click Bind CEN and configure the basic parameters for the IPsec connection:
Name: Enter a name for the resource, for example, ipsec-demo.
Region: Select Germany (Frankfurt).
Gateway Type: Select Public.
Bind CEN: Select Same Account.
Associate Resource: Select Transit Router.
CEN Instance ID: Select the CEN instance that you created.
Routing Mode: Select Destination Routing Mode.
Effective Immediately: Select Yes. Start negotiations after the configuration is completed.. Alibaba Cloud initiates the negotiation after the configuration is complete.
Advanced Configuration (including route table association and route forwarding): Select all options, including Automatic Advertising, Automatically Associate with Default Route Table of Transit Router, and Automatically Advertise System Routes to Default Route Table of Transit Router.
Configure the tunnel parameters:
Tunnel 1 (Primary):
Customer Gateways: Select the customer gateway created in Step 1.
Pre-Shared Key: The password for mutual authentication used to establish the tunnel. We recommend that you use a complex key. The key must be identical on the Alibaba Cloud and on-premises sides.
Tunnel 1 (Backup):
Customer Gateways: Select the same customer gateway as for Tunnel 1. In this scenario, the on-premises IDC has only one public IP address.
Pre-Shared Key: In this topic, the same key as for Tunnel 1 is used.
You can keep the default values for the other parameters in the Encryption Configurations section. If you need to manually specify the algorithms, expand the Encryption Configuration section and modify them.
(Optional) Enable BGP
Enable BGP as described in the Resource planning section. For detailed steps, see Enable or disable BGP.
3. Configure the on-premises gateway device
Consult your gateway device vendor for configuration instructions. For configuration examples for some devices, see On-premises gateway device configuration examples.
The goal is to have the Connection Status of both tunnels on the IPsec connection details page display Phase 2 negotiations succeeded. and BGP Normal.
If the IPsec connection uses static routes, make sure your on-premises gateway device supports static ECMP routing. When you associate the IPsec connection with a TR, the two tunnels automatically form an ECMP link for traffic from the cloud to your on-premises IDC. If your on-premises IDC does not support ECMP for traffic to the cloud, asymmetric routing occurs.
4. Check the routes
After you complete the preceding configurations, the route tables of each resource are updated as follows:
TR route table
Two new Candidate entries are added:
Destination CIDR block
Next hop
Status
Source
10.0.0.0/24
VPC
Available
10.0.1.0/24
VPC
Available
172.16.0.0/16
ECR (or VBR if an ECR is not used)
Available
172.16.0.0/16
IPsec connection
Candidate
172.16.0.0/16
IPsec connection
Candidate
IPsec connection route table
Destination CIDR block
Next hop
Source
10.0.0.0/24
TR
Synced from TR
10.0.1.0/24
TR
Synced from TR
172.16.0.0/16
IPsec Tunnel 1
BGP
172.16.0.0/16
IPsec Tunnel 2
BGP
If the IPsec connection does not use BGP, you must manually add a route in the route table of the IPsec connection. Set the destination CIDR block to 172.16.0.0/16 and the next hop to the IPsec tunnel.
On-premises gateway device route table
A new route entry with the next hop pointing to the IPsec connection is added:
Destination CIDR block
Next hop
Source
10.0.0.0/24
Network interface for the Express Connect link
Propagated by BGP
10.0.1.0/24
Network interface for the Express Connect link
Propagated by BGP
10.0.0.0/24
IPsec connection
Propagated by BGP
10.0.1.0/24
IPsec connection
Propagated by BGP
If the IPsec connection does not use BGP, you must manually add routes in its route table. Set the destination CIDR blocks to 10.0.0.0/24 and 10.0.1.0/24, and set the next hop to the IPsec connection.
Step 4. Configure the primary and backup links
Primary/backup path selection for outbound traffic (Alibaba Cloud-side configuration)
Per TR route priorities, routes from a VBR or ECR instance have higher priority than routes from an IPsec connection. Therefore, no additional configuration is required. Outbound traffic from the cloud automatically prefers the Express Connect link.
Primary/backup path selection for inbound traffic (on-premises IDC-side configuration)
Set the route priorities on your on-premises gateway device:
If the IPsec connection uses BGP routing, set the priority as follows: BGP routes learned over the Express Connect link > BGP routes learned over the IPsec connection.
If the IPsec connection uses static routing, set the priority as follows: BGP routes learned over the Express Connect link > static routes with the next hop pointing to the IPsec connection.
The following example shows the configuration on a Cisco ASA firewall (software version 9.19.1) where the IPsec connection uses BGP routing.
ImportantConfiguration commands may vary based on the software version. When you perform the operations, refer to the documentation for your environment or consult the relevant vendors. The information about third-party products is for reference only. Alibaba Cloud does not make any warranties, express or implied, with respect to the performance and reliability of third-party products, nor does it assume any liability for any potential issues that may arise from using such products.
router bgp 65002 bgp router-id 10.1.0.2 bgp log-neighbor-changes address-family ipv4 unicast network 172.16.0.0 mask 255.255.0.0 neighbor 10.1.0.1 remote-as 65001 neighbor 10.1.0.1 activate neighbor 10.1.0.1 weight 1000 #Set the weight of routes learned over the Express Connect link to 1000. neighbor 169.254.10.1 remote-as 65001 neighbor 169.254.10.1 ebgp-multihop 255 neighbor 169.254.10.1 activate neighbor 169.254.10.1 weight 500 #Set the weight of routes learned over the IPsec connection to 500. This weight is lower than that of routes learned over the Express Connect link to ensure that traffic from the on-premises IDC to the VPC is preferentially transmitted over the Express Connect link. exit-address-family
Step 5. Verify failover
After confirming the routes are correct, use the Express Connect fault drill feature to test the backup link's reliability.
Start a continuous ping test
On the ECS instance, run a continuous ping test to the on-premises server. Do not close the terminal.
On a Linux system, run:
ping 172.16.0.1.On a Windows system, run:
ping -t 172.16.0.1.Start a fault drill
Use the Express Connect fault drill feature to simulate an Express Connect link failure. For this example, the drill duration is 5 minutes.
WarningA fault drill simulates a failure by shutting down the specified resource, which places the resource in an artificial fault state. Make sure that you have prepared for any potential service disruptions.
Observe the status changes during and after the drill
Continuous ping test results
When the drill starts: The ping is briefly interrupted and then resumes, but with a significantly higher latency than before the drill. This indicates that traffic has automatically failed over to the IPsec connection.
When the drill ends: The ping latency returns to its pre-drill level. This indicates that traffic has failed back to the Express Connect link.
Traffic trends on the network instance connections attached to the TR
In the Monitoring column of the network instance connection, click the corresponding monitoring icon to observe the metric trends.
When the drill starts: Traffic on the ECR connection drops to zero, and traffic on the VPN connection increases. This indicates that traffic has automatically failed over from the Express Connect link to the VPN backup link.
When the drill ends: Traffic on the VPN connection drops to zero, and traffic on the ECR connection resumes. This indicates that traffic has automatically failed back from the VPN link to the Express Connect primary link.
TR route table entries
When the drill starts: The route to the ECR connection is withdrawn. The status of the route entry pointing to the VPN connection changes from Candidate to Available, and the next hop switches to the VPN backup link.
When the drill ends: The route to the ECR connection is re-advertised and becomes the active route due to its higher priority. The status of the route entry pointing to the VPN connection reverts to Candidate, and the next hop fails back to the Express Connect primary link.