All Products
Search
Document Center

VPN Gateway:Configure an H3C firewall

Last Updated:Apr 01, 2026

This topic explains how to configure an H3C firewall to establish an IPsec-VPN connection between your data center and a virtual private cloud (VPC) on Alibaba Cloud. It covers both dual-tunnel mode and single-tunnel mode.

Device at a glance

AttributeValue
Device vendorH3C
Tested modelH3C SecPath vFW1000 E1185
IKE versionIKEv2
Modes coveredDual-tunnel (static routing, BGP dynamic routing); Single-tunnel (static routing)
Routing optionsStatic routing, Border Gateway Protocol (BGP) dynamic routing
Commands may differ across H3C models and firmware versions. Consult your H3C documentation or contact the manufacturer if your device differs from the tested model.

Dual-tunnel mode (recommended)

We recommend that you add VPN configurations to an H3C firewall in dual-tunnel mode. For background on dual-tunnel mode, see [Upgrade notice] IPsec-VPN connections support the dual-tunnel mode.

Scenario

image

An enterprise connects its data center to Alibaba Cloud using IPsec-VPN in dual-tunnel mode:

  1. The data center uses the CIDR block 10.34.0.0/24 for communication with Alibaba Cloud.

  2. The VPC on Alibaba Cloud uses the CIDR block 192.168.0.0/16, with applications running on an Elastic Compute Service (ECS) instance.

  3. The enterprise plans to establish an IPsec-VPN connection in dual-tunnel mode between the data center and the VPC on Alibaba Cloud to enable communication between the data center and the VPC.

IP address plan

This topic covers two sub-scenarios based on how many Internet egresses the H3C firewall has. Use the plan that matches your setup.

Single egress

LocationConfiguration itemExample
Data centerGigabitEthernet (GE) interface 2 (Internet egress)10.32.0.175
Next hop10.32.0.173
Mapped public IP address8.XX.XX.3
GE interface 4 (private interface)10.34.0.20
Private CIDR block10.34.0.0/24
Server IP address10.34.0.21
Alibaba CloudVPN gateway active tunnel IP39.XX.XX.17
VPN gateway standby tunnel IP39.XX.XX.10
VPC CIDR block192.168.0.0/16
vSwitch CIDR block (Zone J)192.168.1.0/24
vSwitch CIDR block (Zone K)192.168.2.0/24
ECS instance IP address192.168.1.11

Dual egresses

LocationConfiguration itemExample
Data centerGE interface 2 (Internet Egress 1)10.32.0.175
Next hop (Egress 1)10.32.0.173
Mapped public IP address (Egress 1)8.XX.XX.3
GE interface 3 (Internet Egress 2)10.33.0.238
Next hop (Egress 2)10.33.0.236
Mapped public IP address (Egress 2)116.XX.XX.68
GE interface 4 (private interface)10.34.0.20
Private CIDR block10.34.0.0/24
Server IP address10.34.0.21
Alibaba CloudVPN gateway active tunnel IP39.XX.XX.17
VPN gateway standby tunnel IP39.XX.XX.10
VPC CIDR block192.168.0.0/16
vSwitch CIDR block (Zone J)192.168.1.0/24
vSwitch CIDR block (Zone K)192.168.2.0/24
ECS instance IP address192.168.1.11

BGP plan

Skip this section if you are using static routing instead of BGP dynamic routing.

Each tunnel on a VPN gateway must use a unique BGP CIDR block.
ResourceTunnelBGP tunnel CIDR blockBGP IP addressBGP local ASN
Alibaba Cloud VPN gatewayTunnel 1169.254.10.0/30169.254.10.165535
Tunnel 2169.254.20.0/30169.254.20.165535
H3C firewallTunnel 1169.254.10.0/30169.254.10.265500
Tunnel 2169.254.20.0/30169.254.20.265500

IPsec-VPN connection configuration plan

Both tunnels use the same cryptographic parameters. The values on the H3C firewall must exactly match those configured on the Alibaba Cloud side.

Configuration itemExample
Pre-shared keyChangeMe****
Internet Key Exchange (IKE)Versionikev2
Negotiation modemain
Encryption algorithmaes256
Authentication algorithmsha256
Diffie-Hellman (DH) groupgroup14
Security association (SA) lifetime (seconds)86400
IPsecEncryption algorithmaes256
Authentication algorithmsha256
DH groupgroup14
SA lifetime (seconds)86400

Prerequisites

Before you begin, ensure that you have:

Customer gateway requirements differ by egress configuration:

  • Single egress: Create one customer gateway. Assign it to both the active and standby tunnels when creating the IPsec-VPN connection.

  • Dual egresses: Create two customer gateways. Assign one to the active tunnel and the other to the standby tunnel.

Configuration procedures

Choose the procedure that matches your egress count and routing type:

Single egress and static routing

With a single Internet egress, bind that egress to two tunnel interfaces and assign a separate IPsec profile to each — one for the active tunnel and one for the standby.

In this example, H3C SecPath vFW1000 E1185 is used. The firewall configurations may vary with different models and versions. You can refer to the relevant documentation or consult the firewall manufacturer to configure the firewall based on the version of the firewall that you use.

Step 1: Configure interfaces and networking

Assign IP addresses and security zones to the public and private interfaces, then add the required routes.

# Configure a public interface.
interface GigabitEthernet 2/0
 ip addr 10.32.0.175 24
 quit

# Configure a private interface.
interface GigabitEthernet 4/0
 ip addr 10.34.0.10 24
 quit

# Add the public and private interfaces to their respective security zone.
security-zone name Untrust
 import interface GigabitEthernet 2/0
 quit
security-zone name Trust
 import interface GigabitEthernet 4/0
 quit

# Configure routes for peer VPN gateway public IPs (Internet egress).
ip route-static 39.XX.XX.17 32 10.32.0.173
ip route-static 39.XX.XX.10 32 10.32.0.173
# Configure a route for the local internal network CIDR block.
ip route-static 10.0.0.0 8 10.34.0.253

Step 2: Configure tunnels

Create two tunnel interfaces — one for the active tunnel and one for the standby.

# Configure the tunnel interfaces and apply IPsec to the tunnel interfaces.
interface tunnel 1 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 quit
interface tunnel 2 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 quit

# Add the tunnel interfaces to the Untrust security zone.
security-zone name Untrust
 import interface Tunnel 1
 import interface Tunnel 2
 quit

Step 3: Configure IPsec and IKEv2

Configure an IPsec transform set, an IKEv2 proposal and policy, keychains, profiles, and IPsec profiles. All cryptographic parameters must match the Alibaba Cloud side.

# Configure an IPsec transform set.
ipsec transform-set to-ali-trans
 encapsulation-mode tunnel
 protocol esp
 esp authentication-algorithm sha256
 esp encryption-algorithm aes-cbc-256
 pfs dh-group14
 quit

# Configure an IKEv2 proposal and policy.
ikev2 proposal to-ali-prop
 dh group14
 encryption aes-cbc-256
 integrity sha256
 prf sha256
 quit
ikev2 policy to-ali-policy
 priority 1
 proposal to-ali-prop
 quit

# Configure IKEv2 keychains — one per tunnel, pointing to the active and standby tunnel IPs.
ikev2 keychain to_ali_key1
 peer to-ali-peer1
  address 39.XX.XX.17 32
  identity address 39.XX.XX.17
  pre-shared-key plaintext ChangeMe****
  quit
 quit
ikev2 keychain to_ali_key2
 peer to-ali-peer2
  address 39.XX.XX.10 32
  identity address 39.XX.XX.10
  pre-shared-key plaintext ChangeMe****
  quit
 quit

# Configure IKEv2 profiles — one per tunnel.
ikev2 profile to-ali-profile1
 authentication-method local pre-share
 authentication-method remote pre-share
 keychain to_ali_key1
 identity local address 8.XX.XX.3
 match remote identity address 39.XX.XX.17 32
 sa duration 86400
 dpd interval 30 periodic
 quit

ikev2 profile to-ali-profile2
 authentication-method local pre-share
 authentication-method remote pre-share
 keychain to_ali_key2
 identity local address 8.XX.XX.3
 match remote identity address 39.XX.XX.10 32
 sa duration 86400
 dpd interval 30 periodic
 quit

# Configure IPsec profiles and reference the IKEv2 profiles above.
# We recommend that you specify only the time-based SA lifetime. If you specify the traffic-based SA lifetime, set it to the maximum value.
ipsec profile to-ali-profile1 isakmp
 transform-set to-ali-trans
 ikev2-profile to-ali-profile1
 sa duration time-based 86400
 quit

ipsec profile to-ali-profile2 isakmp
 transform-set to-ali-trans
 ikev2-profile to-ali-profile2
 sa duration time-based 86400
 quit

# Configure the tunnel interfaces and apply the IPsec profiles to the tunnel interfaces.
interface tunnel 1 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 tunnel protection ipsec profile to-ali-profile1
 source 10.32.0.175
 destination 39.XX.XX.17
 quit
interface tunnel 2 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 tunnel protection ipsec profile to-ali-profile2
 source 10.32.0.175
 destination 39.XX.XX.10
 quit

# Configure routes for peer VPC CIDR block to tunnel interfaces.
ip route-static 192.168.0.0 16 Tunnel 1 preference 10
ip route-static 192.168.0.0 16 Tunnel 2 preference 20

Step 4: Configure an ACL

Configure an access control list (ACL) to permit IKE negotiation and IPsec data traffic.

Important
# Configure an ACL to allow IKE negotiation packets and IPsec data packets between the Untrust security zone and any other zone. In this example, the configurations are simplified. You can configure a fine-grained ACL based on your business requirements.
acl advanced 3001
 rule 0 permit ip
 quit
zone-pair security source any destination any
 packet-filter 3001
 quit

Step 5: Verify results

After adding routes from the server in the data center to the H3C firewall, verify connectivity and failover behavior.

Test connectivity

  1. Log on to an ECS instance in the VPC. See Connection method overview.

  2. Ping a server in the data center. A successful reply confirms the tunnels are up.

ping <Private IP address of a server in the data center>

Test failover

  1. Log on to an ECS instance in the VPC.

  2. Send a continuous stream of packets to the data center:

ping <Private IP address of a server in the data center> -c 10000
  1. Simulate an active tunnel failure by changing its pre-shared key. The active tunnel is closed when the two sides of the tunnel use different pre-shared keys.

  2. Observe the traffic on the ECS instance. If the traffic is interrupted and then resumed, it indicates that the standby tunnel automatically takes over after the active tunnel is down.

Single egress and BGP dynamic routing

The interface and tunnel setup is identical to the static routing scenario. Follow Steps 1–4 from Single egress and static routing, then replace the static routes with BGP dynamic routing as described below.

Step 1: Configure interfaces and networking

# Configure a public interface.
interface GigabitEthernet 2/0
 ip addr 10.32.0.175 24
 quit

# Configure a private interface.
interface GigabitEthernet 4/0
 ip addr 10.34.0.10 24
 quit

# Add the public and private interfaces to their respective security zone.
security-zone name Untrust
 import interface GigabitEthernet 2/0
 quit
security-zone name Trust
 import interface GigabitEthernet 4/0
 quit

# Configure routes for peer VPN gateway public IPs (Internet egress).
ip route-static 39.XX.XX.17 32 10.32.0.173
ip route-static 39.XX.XX.10 32 10.32.0.173
# Configure a route for the local internal network CIDR block.
ip route-static 10.0.0.0 8 10.34.0.253

Step 2: Configure tunnels

# Configure the tunnel interfaces and apply IPsec to the tunnel interfaces.
interface tunnel 1 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 quit
interface tunnel 2 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 quit

# Add the tunnel interfaces to the Untrust security zone.
security-zone name Untrust
 import interface Tunnel 1
 import interface Tunnel 2
 quit

Step 3: Configure IPsec and IKEv2

# Configure an IPsec transform set.
ipsec transform-set to-ali-trans
 encapsulation-mode tunnel
 protocol esp
 esp authentication-algorithm sha256
 esp encryption-algorithm aes-cbc-256
 pfs dh-group14
 quit

# Configure an IKEv2 proposal and policy.
ikev2 proposal to-ali-prop
 dh group14
 encryption aes-cbc-256
 integrity sha256
 prf sha256
 quit
ikev2 policy to-ali-policy
 priority 1
 proposal to-ali-prop
 quit

# Configure IKEv2 keychains — one per tunnel.
ikev2 keychain to_ali_key1
 peer to-ali-peer1
  address 39.XX.XX.17 32
  identity address 39.XX.XX.17
  pre-shared-key plaintext ChangeMe****
  quit
 quit
ikev2 keychain to_ali_key2
 peer to-ali-peer2
  address 39.XX.XX.10 32
  identity address 39.XX.XX.10
  pre-shared-key plaintext ChangeMe****
  quit
 quit

# Configure IKEv2 profiles — one per tunnel.
ikev2 profile to-ali-profile1
 authentication-method local pre-share
 authentication-method remote pre-share
 keychain to_ali_key1
 identity local address 8.XX.XX.3
 match remote identity address 39.XX.XX.17 32
 sa duration 86400
 dpd interval 30 periodic
 quit

ikev2 profile to-ali-profile2
 authentication-method local pre-share
 authentication-method remote pre-share
 keychain to_ali_key2
 identity local address 8.XX.XX.3
 match remote identity address 39.XX.XX.10 32
 sa duration 86400
 dpd interval 30 periodic
 quit

# Configure IPsec profiles. We recommend that you specify only the time-based SA lifetime. If you specify the traffic-based SA lifetime, set it to the maximum value.
ipsec profile to-ali-profile1 isakmp
 transform-set to-ali-trans
 ikev2-profile to-ali-profile1
 sa duration time-based 86400
 quit

ipsec profile to-ali-profile2 isakmp
 transform-set to-ali-trans
 ikev2-profile to-ali-profile2
 sa duration time-based 86400
 quit

# Configure the tunnel interfaces and apply the IPsec profiles to the tunnel interfaces.
interface tunnel 1 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 tunnel protection ipsec profile to-ali-profile1
 source 10.32.0.175
 destination 39.XX.XX.17
 quit
interface tunnel 2 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 tunnel protection ipsec profile to-ali-profile2
 source 10.32.0.175
 destination 39.XX.XX.10
 quit

# Configure routes for the peer VPC CIDR block to point to the tunnel interfaces.
ip route-static 192.168.0.0 16 Tunnel 1 preference 10
ip route-static 192.168.0.0 16 Tunnel 2 preference 20

Step 4: Configure an ACL

Important
# Configure an ACL to allow IKE negotiation packets and IPsec data packets between the Untrust security zone and any other zone. In this example, the configurations are simplified. You can configure a fine-grained ACL based on your business requirements.
acl advanced 3001
 rule 0 permit ip
 quit
zone-pair security source any destination any
 packet-filter 3001
 quit

Step 5: Configure BGP dynamic routing

Assign IP addresses to the tunnel interfaces for BGP peering, remove the static tunnel routes, and configure BGP.

# Configure IP addresses for the tunnel interfaces to establish BGP peering with the VPN gateway on Alibaba Cloud.
interface tunnel 1 mode ipsec
 ip address 169.254.10.2 30
 quit
interface tunnel 2 mode ipsec
 ip address 169.254.20.2 30
 quit

# Delete the static routes that point to the tunnels in the static routing scenario.
undo ip route-static 192.168.0.0 16 Tunnel 1 preference 10
undo ip route-static 192.168.0.0 16 Tunnel 2 preference 20

# Configure BGP dynamic routing. The H3C firewall advertises 10.0.0.0/8 to the VPN gateway on Alibaba Cloud.
bgp 65500
peer 169.254.10.1 as-number 65535
peer 169.254.20.1 as-number 65535
address-family ipv4 unicast
peer 169.254.10.1 enable
peer 169.254.20.1 enable
network 10.0.0.0 8  # Advertise the CIDR block 10.0.0.0/8.

After configuration, verify the BGP state:

Check the BGP connection.

image

Check the BGP dynamic routing.

image

Check the route table.

image

Step 6: Verify results

After adding routes from the data center to the H3C firewall, verify connectivity and failover behavior.

Test connectivity

  1. Log on to an ECS instance in the VPC. See Connection method overview.

  2. Ping a server in the data center. A successful reply confirms the tunnels are up.

ping <Private IP address of a server in the data center>

Test failover

  1. Log on to an ECS instance in the VPC.

  2. Send a continuous stream of packets to the data center:

ping <Private IP address of a server in the data center> -c 10000
  1. Simulate an active tunnel failure by changing its pre-shared key. The active tunnel is closed when the two sides of the tunnel use different pre-shared keys.

  2. Observe the traffic on the ECS instance. If the traffic is interrupted and then resumed, it indicates that the standby tunnel automatically takes over after the active tunnel is down.

Dual egresses and static routing

With two Internet egresses, bind each egress to a separate tunnel interface and assign a distinct IPsec profile to each tunnel.

In this example, H3C SecPath vFW1000 E1185 is used. The firewall configurations may vary with different models and versions. You can refer to the relevant documentation or consult the firewall manufacturer to configure the firewall based on the version of the firewall that you use.

Step 1: Configure interfaces and networking

# Configure Public Interface 1.
interface GigabitEthernet 2/0
 ip addr 10.32.0.175 24
 quit

# Configure Public Interface 2.
interface GigabitEthernet 3/0
 ip addr 10.33.0.238 24
 quit

# Configure a private interface.
interface GigabitEthernet 4/0
 ip addr 10.34.0.10 24
 quit

# Add the public and private interfaces to their respective security zone.
security-zone name Untrust
 import interface GigabitEthernet 2/0
 import interface GigabitEthernet 3/0
 quit
security-zone name Trust
 import interface GigabitEthernet 4/0
 quit

# Configure 32-bit routes for peer VPN gateway public IPs (Internet).
ip route-static 39.XX.XX.17 32 10.32.0.173
ip route-static 39.XX.XX.10 32 10.33.0.236
# Configure a route for the local internal network CIDR block.
ip route-static 10.0.0.0 8 10.34.0.253

Step 2: Configure tunnels

# Configure the tunnel interfaces and apply IPsec to the tunnel interfaces.
interface tunnel 1 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 quit
interface tunnel 2 mode ipsec
 ip address unnumbered interface GigabitEthernet 3/0
 quit

# Add the tunnel interfaces to the Untrust security zone.
security-zone name Untrust
 import interface Tunnel 1
 import interface Tunnel 2
 quit

Step 3: Configure IPsec and IKEv2

The key difference from the single-egress scenario: to-ali-profile2 uses the mapped public IP of Egress 2 (116.XX.XX.68) as the local identity.

# Configure an IPsec transform set.
ipsec transform-set to-ali-trans
 encapsulation-mode tunnel
 protocol esp
 esp authentication-algorithm sha256
 esp encryption-algorithm aes-cbc-256
 pfs dh-group14
 quit

# Configure an IKEv2 proposal and policy.
ikev2 proposal to-ali-prop
 dh group14
 encryption aes-cbc-256
 integrity sha256
 prf sha256
 quit
ikev2 policy to-ali-policy
 priority 1
 proposal to-ali-prop
 quit

# Configure IKEv2 keychains for active and standby tunnels.
ikev2 keychain to_ali_key1
 peer to-ali-peer1
  address 39.XX.XX.17 32
  identity address 39.XX.XX.17
  pre-shared-key plaintext ChangeMe****
  quit
 quit
ikev2 keychain to_ali_key2
 peer to-ali-peer2
  address 39.XX.XX.10 32
  identity address 39.XX.XX.10
  pre-shared-key plaintext ChangeMe****
  quit
 quit

# Configure IKEv2 profiles. Specify the active and standby tunnels on Alibaba Cloud as the two peers.
# profile1 uses the mapped public IP of Egress 1; profile2 uses the mapped public IP of Egress 2.
ikev2 profile to-ali-profile1
 authentication-method local pre-share
 authentication-method remote pre-share
 keychain to_ali_key1
 identity local address 8.XX.XX.3
 match remote identity address 39.XX.XX.17 32
 sa duration 86400
 dpd interval 30 periodic
 quit

ikev2 profile to-ali-profile2
 authentication-method local pre-share
 authentication-method remote pre-share
 keychain to_ali_key2
 identity local address 116.XX.XX.68
 match remote identity address 39.XX.XX.10 32
 sa duration 86400
 dpd interval 30 periodic
 quit

# Configure IPsec profiles and reference the preceding IKEv2 profiles.
# We recommend that you specify only the time-based SA lifetime. If you specify the traffic-based SA lifetime, set it to the maximum value.
ipsec profile to-ali-profile1 isakmp
 transform-set to-ali-trans
 ikev2-profile to-ali-profile1
 sa duration time-based 86400
 quit

ipsec profile to-ali-profile2 isakmp
 transform-set to-ali-trans
 ikev2-profile to-ali-profile2
 sa duration time-based 86400
 quit

# Configure the tunnel interfaces and apply the IPsec profiles to the tunnel interfaces.
interface tunnel 1 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 tunnel protection ipsec profile to-ali-profile1
 source 10.32.0.175
 destination 39.XX.XX.17
 quit
interface tunnel 2 mode ipsec
 ip address unnumbered interface GigabitEthernet 3/0
 tunnel protection ipsec profile to-ali-profile2
 source 10.33.0.238
 destination 39.XX.XX.10
 quit

# Configure routes for peer VPC CIDR block to tunnel interfaces.
ip route-static 192.168.0.0 16 Tunnel 1 preference 10
ip route-static 192.168.0.0 16 Tunnel 2 preference 20

Step 4: Configure an ACL

Important
# Configure an ACL to allow IKE negotiation packets and IPsec data packets between the Untrust security zone and any other zone. In this example, the configurations are simplified. You can configure a fine-grained ACL based on your business requirements.
acl advanced 3001
 rule 0 permit ip
 quit
zone-pair security source any destination any
 packet-filter 3001
 quit

Step 5: Verify results

After adding routes from the data center to the H3C firewall, verify connectivity and failover behavior.

Test connectivity

  1. Log on to an ECS instance in the VPC. See Connection method overview.

  2. Ping a server in the data center. A successful reply confirms the tunnels are up.

ping <Private IP address of a server in the data center>

Test failover

  1. Log on to an ECS instance in the VPC.

  2. Send a continuous stream of packets to the data center:

ping <Private IP address of a server in the data center> -c 10000
  1. Simulate an active tunnel failure by changing its pre-shared key. The active tunnel is closed when the two sides of the tunnel use different pre-shared keys.

  2. Observe the traffic on the ECS instance. If the traffic is interrupted and then resumed, it indicates that the standby tunnel automatically takes over after the active tunnel is down.

Dual egresses and BGP dynamic routing

The interface and tunnel setup is identical to the dual-egress static routing scenario. Follow Steps 1–4 from Dual egresses and static routing, then replace the static routes with BGP dynamic routing as described below.

Step 1: Configure interfaces and networking

# Configure Public Interface 1.
interface GigabitEthernet 2/0
 ip addr 10.32.0.175 24
 quit

# Configure Public Interface 2.
interface GigabitEthernet 3/0
 ip addr 10.33.0.238 24
 quit

# Configure a private interface.
interface GigabitEthernet 4/0
 ip addr 10.34.0.10 24
 quit

# Add the public and private interfaces to their respective security zone.
security-zone name Untrust
 import interface GigabitEthernet 2/0
 import interface GigabitEthernet 3/0
 quit
security-zone name Trust
 import interface GigabitEthernet 4/0
 quit

# Configure 32-bit routes for peer VPN gateway public IPs (Internet).
ip route-static 39.XX.XX.17 32 10.32.0.173
ip route-static 39.XX.XX.10 32 10.33.0.236
# Configure a route for the local internal network CIDR block.
ip route-static 10.0.0.0 8 10.34.0.253

Step 2: Configure tunnels

# Configure the tunnel interfaces and apply IPsec to the tunnel interfaces.
interface tunnel 1 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 quit
interface tunnel 2 mode ipsec
 ip address unnumbered interface GigabitEthernet 3/0
 quit

# Add the tunnel interfaces to the Untrust security zone.
security-zone name Untrust
 import interface Tunnel 1
 import interface Tunnel 2
 quit

Step 3: Configure IPsec and IKEv2

# Configure an IPsec transform set.
ipsec transform-set to-ali-trans
 encapsulation-mode tunnel
 protocol esp
 esp authentication-algorithm sha256
 esp encryption-algorithm aes-cbc-256
 pfs dh-group14
 quit

# Configure an IKEv2 proposal and policy.
ikev2 proposal to-ali-prop
 dh group14
 encryption aes-cbc-256
 integrity sha256
 prf sha256
 quit
ikev2 policy to-ali-policy
 priority 1
 proposal to-ali-prop
 quit

# Configure IKEv2 keychains for active and standby tunnels.
ikev2 keychain to_ali_key1
 peer to-ali-peer1
  address 39.XX.XX.17 32
  identity address 39.XX.XX.17
  pre-shared-key plaintext ChangeMe****
  quit
 quit
ikev2 keychain to_ali_key2
 peer to-ali-peer2
  address 39.XX.XX.10 32
  identity address 39.XX.XX.10
  pre-shared-key plaintext ChangeMe****
  quit
 quit

# Configure IKEv2 profiles. Specify the active and standby tunnels on Alibaba Cloud as the two peers.
# profile1 uses the mapped public IP of Egress 1; profile2 uses the mapped public IP of Egress 2.
ikev2 profile to-ali-profile1
 authentication-method local pre-share
 authentication-method remote pre-share
 keychain to_ali_key1
 identity local address 8.XX.XX.3
 match remote identity address 39.XX.XX.17 32
 sa duration 86400
 dpd interval 30 periodic
 quit

ikev2 profile to-ali-profile2
 authentication-method local pre-share
 authentication-method remote pre-share
 keychain to_ali_key2
 identity local address 116.XX.XX.68
 match remote identity address 39.XX.XX.10 32
 sa duration 86400
 dpd interval 30 periodic
 quit

# Configure IPsec profiles and reference the preceding IKEv2 profiles.
# We recommend that you specify only the time-based SA lifetime. If you specify the traffic-based SA lifetime, set it to the maximum value.
ipsec profile to-ali-profile1 isakmp
 transform-set to-ali-trans
 ikev2-profile to-ali-profile1
 sa duration time-based 86400
 quit

ipsec profile to-ali-profile2 isakmp
 transform-set to-ali-trans
 ikev2-profile to-ali-profile2
 sa duration time-based 86400
 quit

# Configure the tunnel interfaces and apply the IPsec profiles to the tunnel interfaces.
interface tunnel 1 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 tunnel protection ipsec profile to-ali-profile1
 source 10.32.0.175
 destination 39.XX.XX.17
 quit
interface tunnel 2 mode ipsec
 ip address unnumbered interface GigabitEthernet 3/0
 tunnel protection ipsec profile to-ali-profile2
 source 10.33.0.238
 destination 39.XX.XX.10
 quit

# Configure routes for the peer VPC CIDR block to point to the tunnel interfaces.
ip route-static 192.168.0.0 16 Tunnel 1 preference 10
ip route-static 192.168.0.0 16 Tunnel 2 preference 20

Step 4: Configure an ACL

Important
# Configure an ACL to allow IKE negotiation packets and IPsec data packets between the Untrust security zone and any other zone. In this example, the configurations are simplified. You can configure a fine-grained ACL based on your business requirements.
acl advanced 3001
 rule 0 permit ip
 quit
zone-pair security source any destination any
 packet-filter 3001
 quit

Step 5: Configure BGP dynamic routing

# Configure IP addresses for the tunnel interfaces to establish BGP peering with the VPN gateway on Alibaba Cloud.
interface tunnel 1 mode ipsec
 ip address 169.254.10.2 30
 quit
interface tunnel 2 mode ipsec
 ip address 169.254.20.2 30
 quit

# Delete the static routes that point to the tunnels in the static routing scenario.
undo ip route-static 192.168.0.0 16 Tunnel 1 preference 10
undo ip route-static 192.168.0.0 16 Tunnel 2 preference 20

# Configure BGP dynamic routing. The H3C firewall advertises 10.0.0.0/8 to the VPN gateway on Alibaba Cloud.
bgp 65500
peer 169.254.10.1 as-number 65535
peer 169.254.20.1 as-number 65535
address-family ipv4 unicast
peer 169.254.10.1 enable
peer 169.254.20.1 enable
network 10.0.0.0 8  # Advertise the CIDR block 10.0.0.0/8.

After configuration, verify the BGP state:

Check the BGP connection.

image

Check the BGP dynamic routing.

image

Check the route table.

image

Step 6: Verify results

After adding routes from the data center to the H3C firewall, verify connectivity and failover behavior.

Test connectivity

  1. Log on to an ECS instance in the VPC. See Connection method overview.

  2. Ping a server in the data center. A successful reply confirms the tunnels are up.

ping <Private IP address of a server in the data center>

Test failover

  1. Log on to an ECS instance in the VPC.

  2. Send a continuous stream of packets to the data center:

ping <Private IP address of a server in the data center> -c 10000
  1. Simulate an active tunnel failure by changing its pre-shared key. The active tunnel is closed when the two sides of the tunnel use different pre-shared keys.

  2. Observe the traffic on the ECS instance. If the traffic is interrupted and then resumed, it indicates that the standby tunnel automatically takes over after the active tunnel is down.

Single-tunnel mode

Scenario

image

An enterprise connects its data center to Alibaba Cloud using IPsec-VPN in single-tunnel mode:

  1. The data center uses the CIDR block 10.34.0.0/24 for communication with Alibaba Cloud.

  2. The VPC on Alibaba Cloud uses the CIDR block 192.168.0.0/16, with applications running on an ECS instance.

This section covers static routing only.

IP address plan

LocationConfiguration itemExample
Data centerGE interface 2 (Internet egress)10.32.0.175/24
Next hop10.32.0.173
Mapped public IP address8.XX.XX.3
GE interface 4 (private interface)10.34.0.20/24
Server IP address10.34.0.21
Alibaba CloudVPN gateway IP address39.XX.XX.17
VPC CIDR block192.168.0.0/16
vSwitch CIDR block192.168.1.0/24
ECS instance IP address192.168.1.11

IPsec-VPN connection configuration plan

The values on the H3C firewall must exactly match those configured on the Alibaba Cloud side.

Configuration itemExample
Pre-shared keyChangeMe****
IKEVersionikev2
Negotiation modemain
Encryption algorithmaes256
Authentication algorithmsha256
DH groupgroup14
SA lifetime (seconds)86400
IPsecEncryption algorithmaes256
Authentication algorithmsha256
DH groupgroup14
SA lifetime (seconds)86400

Prerequisites

Before you begin, ensure that you have:

Procedure

In this example, H3C SecPath vFW1000 E1185 is used. The firewall configurations may vary with different models and versions. You can refer to the relevant documentation or consult the firewall manufacturer to configure the firewall based on the version of the firewall that you use.

Step 1: Configure interfaces and networking

# Configure a public interface.
interface GigabitEthernet 2/0
 ip addr 10.32.0.175 24
 quit

# Configure a private interface.
interface GigabitEthernet 4/0
 ip addr 10.34.0.10 24
 quit

# Add the public and private interfaces to their respective security zone.
security-zone name Untrust
 import interface GigabitEthernet 2/0
 quit
security-zone name Trust
 import interface GigabitEthernet 4/0
 quit

# Configure a route for peer VPN gateway public IP (Internet egress).
ip route-static 39.XX.XX.17 32 10.32.0.173
# Configure a route for the local internal network CIDR block.
ip route-static 10.0.0.0 8 10.34.0.253

Step 2: Configure a tunnel

# Configure the tunnel interface and apply IPsec to the tunnel interface.
interface tunnel 1 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 quit

# Add the tunnel interface to the Untrust security zone.
security-zone name Untrust
 import interface Tunnel 1
 quit

Step 3: Configure IPsec and IKEv2

# Configure an IPsec transform set.
ipsec transform-set to-ali-trans
 encapsulation-mode tunnel
 protocol esp
 esp authentication-algorithm sha256
 esp encryption-algorithm aes-cbc-256
 pfs dh-group14
 quit

# Configure an IKEv2 proposal and policy.
ikev2 proposal to-ali-prop
 dh group14
 encryption aes-cbc-256
 integrity sha256
 prf sha256
 quit
ikev2 policy to-ali-policy
 priority 1
 proposal to-ali-prop
 quit

# Configure an IKEv2 keychain. Specify the tunnel on Alibaba Cloud as the peer. Set the address parameter to the public IP address of the tunnel on Alibaba Cloud.
ikev2 keychain to_ali_key1
 peer to-ali-peer1
  address 39.XX.XX.17 32
  identity address 39.XX.XX.17
  pre-shared-key plaintext ChangeMe****
  quit
 quit

# Configure an IKEv2 profile. Specify the tunnel on Alibaba Cloud as the peer.
ikev2 profile to-ali-profile1
 authentication-method local pre-share
 authentication-method remote pre-share
 keychain to_ali_key1
 identity local address 8.XX.XX.3
 match remote identity address 39.XX.XX.17 32
 sa duration 86400
 dpd interval 30 periodic
 quit

# Configure an IPsec profile and reference the preceding IKEv2 profile.
# We recommend that you specify only the time-based SA lifetime. If you specify the traffic-based SA lifetime, set it to the maximum value.
ipsec profile to-ali-profile1 isakmp
 transform-set to-ali-trans
 ikev2-profile to-ali-profile1
 sa duration time-based 86400
 quit

# Configure the tunnel interface and apply the IPsec profile to the tunnel interface.
interface tunnel 1 mode ipsec
 ip address unnumbered interface GigabitEthernet 2/0
 tunnel protection ipsec profile to-ali-profile1
 source 10.32.0.175
 destination 39.XX.XX.17
 quit

# Configure a route for the peer VPC CIDR block to point to the tunnel interface.
ip route-static 192.168.0.0 16 Tunnel 1 preference 10

Step 4: Configure an ACL

Important
# Configure an ACL to allow IKE negotiation packets and IPsec data packets between the Untrust security zone and any other zone. In this example, the configurations are simplified. You can configure a fine-grained ACL based on your business requirements.
acl advanced 3001
 rule 0 permit ip
 quit
zone-pair security source any destination any
 packet-filter 3001
 quit

Step 5: Verify results

After adding routes from the server in the data center to the H3C firewall, verify connectivity.

  1. Log on to an ECS instance that is not assigned a public IP address in the VPC. See Connection method overview.

  2. Run the ping command to ping a server in the data center to test the network connectivity.

ping <Private IP address of a server in the data center>

If you can receive echo reply packets, the connection is established.