Creating a VPN¶
Overview¶
By default, ECSs in a VPC cannot communicate with devices in your on-premises data center or private network. To enable communication between them, you can use a VPN by creating it in your VPC and updating security group rules.
IPsec VPN Topology¶
In Figure 1, the VPC has subnets 192.168.1.0/24 and 192.168.2.0/24. Your on-premises data center has subnets 192.168.3.0/24 and 192.168.4.0/24. You can use VPN to enable subnets in the VPC to communicate with those in your data center.
Site-to-site VPN is supported to enable communication between VPC subnets and on-premises data center subnets. Before establishing an IPsec VPN, ensure that the on-premises data center where the VPN is to be established meets the following conditions:
On-premises devices that support the standard IPsec protocol are available.
The on-premises devices have fixed public IP addresses, which can be statically configured or translated by NAT.
The on-premises subnets do not conflict with VPC subnets, and devices in the on-premises subnets can communicate with the on-premises devices.
If the preceding conditions are met, ensure that the IKE policies and IPsec policies at both ends are consistent and the subnets at both ends are matched pairs when configuring IPsec VPN.
After the configuration is complete, VPN negotiation needs to be triggered by private network data flows.
Scenarios¶
You need a VPN that sets up a secure, isolated communications tunnel between your on-premises data center and cloud services.
Procedure¶
Log in to the management console.
Click in the upper left corner and select the desired region and project.
Click Service List and choose Network > Virtual Private Network.
In the navigation pane on the left, choose Virtual Private Network.
If Enterprise Edition VPN is available for the selected region, choose Virtual Private Network > Classic.
On the Virtual Private Network page, click Create VPN.
If Enterprise Edition VPN is available for the selected region, click Create VPN on the Classic page.
Configure required parameters and click Create Now.
Table 1, Table 2, and Table 3 describe the parameters.
¶ Parameter
Description
Example Value
Region
Regions are geographic areas that are physically isolated from each other. The networks inside different regions are not connected to each other, so resources cannot be shared across regions. For low network latency and fast resource access, select the region nearest to your target users.
eu-de
Name
The VPN name
VPN-001
VPC
The VPC name
VPC-001
Local Subnet
VPC subnets that will access your on-premises network through a VPN.
192.168.1.0/24,
192.168.2.0/24
Remote Gateway
The public IP address of the gateway in your data center or on the private network. This IP address is used for communicating with your VPC.
N/A
Remote Subnet
The subnets of your on-premises network that will access a VPC through a VPN. The remote and local subnets cannot overlap with each other. The remote subnets cannot overlap with CIDR blocks involved in existing VPC peering connections created for the VPC.
192.168.3.0/24,
192.168.4.0/24
PSK
Private key shared by two ends of a VPN connection for negotiation. PSKs configured at both ends of the VPN connection must be the same.
The PSK can contain 6 to 128 characters.
Confirm PSK
Enter the PSK again.
Advanced Settings
Custom
Advanced Settings > Tags
Configure Tags in Advanced Settings.
-
¶ Parameter
Description
Example Value
Authentication Algorithm
Hash algorithm used for authentication. The following algorithms are supported:
MD5(Insecure. Not recommended.)
SHA1(Insecure. Not recommended.)
SHA2-256
SHA2-384
SHA2-512
The default value is SHA2-256.
SHA2-256
Encryption Algorithm
Encryption algorithm. The following algorithms are supported:
AES-128
AES-192
AES-256
3DES(Insecure. Not recommended.)
The default value is AES-128.
AES-128
DH Algorithm
Diffie-Hellman key exchange algorithm. The following algorithms are supported:
DH group 1(Insecure. Not recommended.)
DH group 2(Insecure. Not recommended.)
DH group 5(Insecure. Not recommended.)
DH group 14
Group 15
Group 16
Group 19
Group 20
Group 21
The default value is Group 14.
Group 14
Version
Version of the IKE protocol. The value can be one of the following:
v1 (For security reasons, IKEv1 is not recommended. If your devices support IKEv2, select IKEv2.)
v2
The default value is v2.
v2
Lifetime (s)
Lifetime of an SA, in seconds
An SA will be renegotiated when its lifetime expires.
The default value is 86400.
86400
Negotiation Mode
The value is Main. This parameter is available only when Version is set to v1.
The default value is Main.
Main
¶ Parameter
Description
Example Value
Authentication Algorithm
Hash algorithm used for authentication. The following algorithms are supported:
SHA1(Insecure. Not recommended.)
MD5(Insecure. Not recommended.)
SHA2-256
SHA2-384
SHA2-512
The default value is SHA2-256.
SHA2-256
Encryption Algorithm
Encryption algorithm. The following algorithms are supported:
AES-128
AES-192
AES-256
3DES(Insecure. Not recommended.)
The default value is AES-128.
AES-128
PFS
Algorithm used by the Perfect forward secrecy (PFS) function.
PFS supports the following algorithms:
Disable
DH group 1(Insecure. Not recommended.)
DH group 2(Insecure. Not recommended.)
DH group 5(Insecure. Not recommended.)
DH group 14
DH group 15
DH group 16
DH group 19
DH group 20
DH group 21
The default value is DH group 14.
DH group 14
Transfer Protocol
Security protocol used in IPsec to transmit and encapsulate user data. The following protocols are supported:
AH
AH-ESP
ESP
The default value is ESP.
ESP
Lifetime (s)
Lifetime of an SA, in seconds
An SA will be renegotiated when its lifetime expires.
The default value is 3600.
3600
Note
An IKE policy specifies the encryption and authentication algorithms to be used in the negotiation phase of an IPsec tunnel. An IPsec policy specifies the protocol, encryption algorithm, and authentication algorithm to be used in the data transmission phase of an IPsec tunnel. The IKE and IPsec policies must be the same at both ends of a VPN connection. Otherwise, the VPN connection cannot be set up.
Submit your application.
After the IPsec VPN is created, a public IP address is assigned to the VPN. The IP address is the local gateway address of the created VPN. When configuring the remote tunnel in your data center, you must set the remote gateway address to this IP address.
You need to configure an IPsec VPN tunnel on the router or firewall in your on-premises data center.
For a list of protocols supported by VPN connections, see Reference Standards and Protocols.
Most devices that meet IPsec VPN standards and protocol requirements can be used as VPN devices. For example, a Fortinet FortiGate firewall can be used as a VPN device. For details, see Configuring VPN When Fortinet FortiGate Firewall Is Used.
Other devices that meet the requirements outlined in the reference protocols described in section Reference Standards and Protocols can also be deployed. However, some devices may not be supported because of the inconsistent protocol implementation methods of these devices. If connections cannot be set up, rectify the fault by referring to What Do I Do If a VPN Connection Fails to Be Established? or contact technical support.