Invoca a API CreateVpnConnection para criar uma conexão IPsec-VPN.
Descrição da operação
-
Se a instância do VPN Gateway suportar a criação de conexões IPsec-VPN no modo de túnel duplo, ao invocar a API
CreateVpnConnection, além dos parâmetros obrigatórios, você também pode configurar os seguintes parâmetros de solicitação:ClientToken, Name, EffectImmediately, AutoConfigRoute, array Tags, array TunnelOptionsSpecification e EnableTunnelsBgp.
Para informações sobre regiões e zonas que suportam a criação de conexões IPsec-VPN no modo de túnel duplo, consulte Atualizar conexões IPsec-VPN para o modo de túnel duplo.
-
Se a instância do VPN Gateway suportar apenas a criação de conexões IPsec-VPN no modo de túnel único, ao invocar a API
CreateVpnConnection, além dos parâmetros obrigatórios, você também pode configurar os seguintes parâmetros de solicitação:ClientToken, CustomerGatewayId, Name, EffectImmediately, IkeConfig, IpsecConfig, HealthCheckConfig, AutoConfigRoute, EnableDpd, EnableNatTraversal, BgpConfig, RemoteCaCertificate e array Tags.
-
A API CreateVpnConnection é assíncrona. Isso significa que o sistema retorna um ID de instância imediatamente, mas a conexão IPsec-VPN ainda não foi criada com sucesso, e a tarefa de criação continua em segundo plano. Você pode chamar DescribeVpnGateway para consultar o status da instância do VPN Gateway e determinar o status de criação da conexão IPsec-VPN:
Se a instância do VPN Gateway estiver no status updating, a conexão IPsec-VPN está sendo criada.
Se a instância do VPN Gateway estiver no status active, a conexão IPsec-VPN foi criada com sucesso.
-
A API CreateVpnConnection não suporta a criação simultânea de conexões IPsec-VPN sob o mesmo VPN Gateway.
Experimente agora
Testar
Autorização RAM
Parâmetros da solicitação
|
Parâmetro |
Tipo |
Obrigatório |
Descrição |
Exemplo |
| RegionId |
string |
Sim |
O ID da região onde a conexão IPsec-VPN é criada. Você pode chamar a operação DescribeRegions para consultar a lista de regiões mais recente. |
cn-shanghai |
| ClientToken |
string |
Não |
O token do cliente usado para garantir a idempotência da solicitação. Você pode usar o cliente para gerar o token, mas deve garantir que o token seja único entre diferentes solicitações. O token pode conter apenas caracteres ASCII. Nota
Se você não especificar este parâmetro, o sistema usa automaticamente o ID da solicitação como o token do cliente. O ID da solicitação pode ser diferente para cada solicitação. |
02fb3da4-130e-11e9-8e44-001**** |
| CustomerGatewayId |
string |
Não |
Ao criar uma conexão IPsec-VPN no modo de túnel único, este parâmetro é obrigatório. O ID do customer gateway. |
cgw-p0w2jemrcj5u61un8**** |
| VpnGatewayId |
string |
Sim |
O ID do VPN Gateway. |
vpn-bp1q8bgx4xnkm**** |
| Name |
string |
Não |
O nome da conexão IPsec-VPN. O nome deve ter de 1 a 100 caracteres e não pode começar com |
IPsec |
| LocalSubnet |
string |
Sim |
O bloco CIDR da virtual private cloud (VPC) que precisa se comunicar com o banco de dados local. O bloco CIDR é usado nas negociações da Fase 2. Separe múltiplos blocos CIDR com vírgulas (,). Exemplo: 192.168.1.0/24,192.168.2.0/24. Os seguintes modos de roteamento são suportados:
|
10.10.1.0/24,10.10.2.0/24 |
| RemoteSubnet |
string |
Sim |
O bloco CIDR do banco de dados local que precisa se comunicar com a VPC. O bloco CIDR é usado nas negociações da Fase 2. Separe múltiplos blocos CIDR com vírgulas (,). Exemplo: 192.168.3.0/24,192.168.4.0/24. Os seguintes modos de roteamento são suportados:
|
10.10.3.0/24,10.10.4.0/24 |
| EffectImmediately |
boolean |
Não |
Especifica se as negociações IPsec devem ser iniciadas imediatamente. Valores válidos:
|
false |
| IkeConfig |
string |
Não |
Este parâmetro é suportado se você criar uma conexão IPsec-VPN no modo de túnel único. As configurações das negociações da Fase 1:
|
{"Psk":"1234****","IkeVersion":"ikev1","IkeMode":"main","IkeEncAlg":"aes","IkeAuthAlg":"sha1","IkePfs":"group2","IkeLifetime":86400,"LocalId":"47.XX.XX.1","RemoteId":"47.XX.XX.2"} |
| IpsecConfig |
string |
Não |
Este parâmetro está disponível se você criar uma conexão IPsec-VPN no modo de túnel único. As configurações das negociações da Fase 2:
|
{"IpsecEncAlg":"aes","IpsecAuthAlg":"sha1","IpsecPfs":"group2","IpsecLifetime":86400} |
| HealthCheckConfig |
string |
Não |
Este parâmetro está disponível se você criar uma conexão IPsec-VPN no modo de túnel único. A configuração de verificação de integridade:
|
{"enable":"true","dip":"192.168.10.1","sip":"10.10.1.1","interval":"3","retry":"3"} |
| AutoConfigRoute |
boolean |
Não |
Especifica se as rotas devem ser configuradas automaticamente. Valores válidos:
|
true |
| EnableDpd |
boolean |
Não |
Este parâmetro está disponível se você criar uma conexão IPsec-VPN no modo de túnel único. Especifica se o recurso de detecção de peer inativo (DPD) deve ser ativado. Valores válidos:
|
true |
| EnableNatTraversal |
boolean |
Não |
Este parâmetro está disponível se você criar uma conexão IPsec-VPN no modo de túnel único. Especifica se o NAT traversal deve ser ativado. Valores válidos:
|
true |
| BgpConfig |
string |
Não |
Este parâmetro é suportado se você criar uma conexão IPsec-VPN no modo de túnel único. Configuração BGP:
Nota
|
{"EnableBgp":"true","LocalAsn":"45104","TunnelCidr":"169.254.11.0/30","LocalBgpIp":"169.254.11.1"} |
| RemoteCaCertificate |
string |
Não |
Este parâmetro está disponível se você criar uma conexão IPsec-VPN no modo de túnel único. O certificado da autoridade certificadora (CA). Se o VPN Gateway for do tipo ShangMi (SM), você precisa configurar um certificado CA para o dispositivo de gateway peer.
|
-----BEGIN CERTIFICATE----- MIIB7zCCAZW**** -----END CERTIFICATE----- |
| Tags |
array<object> |
Não |
O valor da tag. O valor da tag pode ser uma string vazia e não pode exceder 128 caracteres. Não pode começar com Cada chave de tag corresponde a um valor de tag. Você pode especificar até 20 valores de tag em cada chamada. |
|
|
object |
Não |
O valor da tag. |
||
| Key |
string |
Não |
A chave da tag. A chave da tag não pode ser uma string vazia. Pode ter no máximo 64 caracteres e não pode conter Você pode especificar no máximo 20 chaves de tag em cada chamada. |
TagKey |
| Value |
string |
Não |
O valor da tag. O valor da tag pode ser uma string vazia e não pode exceder 128 caracteres. Não pode começar com Cada chave de tag corresponde a um valor de tag. Você pode especificar no máximo 20 valores de tag em cada chamada. |
TagValue |
| TunnelOptionsSpecification |
array<object> |
Não |
As configurações do túnel.
|
|
|
array<object> |
Não |
A configuração do túnel. |
||
| CustomerGatewayId |
string |
Não |
O ID do customer gateway associado ao túnel. Nota
|
cgw-p0wy363lucf1uyae8**** |
| EnableDpd |
boolean |
Não |
Especifica se o recurso de Detecção de Peer Inativo (DPD) deve ser ativado para o túnel. Valores válidos:
|
true |
| EnableNatTraversal |
boolean |
Não |
Especifica se o NAT traversal deve ser ativado para o túnel. Valores válidos:
|
true |
| RemoteCaCertificate |
string |
Não |
Se o VPN Gateway usar um certificado SM, você precisa configurar o certificado CA usado pelo peer IPsec.
|
-----BEGIN CERTIFICATE----- MIIB7zCCAZW**** -----END CERTIFICATE----- |
| Role |
string |
Não |
A função do túnel. Valores válidos:
|
master |
| TunnelBgpConfig |
object |
Não |
As configurações do Border Gateway Protocol (BGP) do túnel. |
|
| LocalAsn |
integer |
Não |
O número de sistema autônomo (ASN) do túnel no lado da Alibaba Cloud. Valores válidos: 1 a 4294967295. Valor padrão: 45104. Nota
|
65530 |
| LocalBgpIp |
string |
Não |
O endereço IP BGP do túnel no lado da Alibaba Cloud. O endereço é um endereço IP que está dentro do bloco CIDR BGP. |
169.254.10.1 |
| TunnelCidr |
string |
Não |
O bloco CIDR BGP do túnel. O bloco CIDR deve estar dentro de 169.254.0.0/16 e a máscara do bloco CIDR deve ter 30 bits de comprimento. O bloco CIDR não pode ser 169.254.0.0/30, 169.254.1.0/30, 169.254.2.0/30, 169.254.3.0/30, 169.254.4.0/30, 169.254.5.0/30, 169.254.6.0/30 ou 169.254.169.252/30. Nota
O bloco CIDR BGP de cada túnel deve ser único em um VPN Gateway. |
169.254.10.0/30 |
| TunnelIkeConfig |
object |
Não |
As configurações das negociações da Fase 1. |
|
| IkeAuthAlg |
string |
Não |
O algoritmo de autenticação usado nas negociações da Fase 1. Valores válidos: md5, sha1, sha256, sha384 e sha512. Valor padrão: md5. |
md5 |
| IkeEncAlg |
string |
Não |
O algoritmo de criptografia usado nas negociações da Fase 1. Valores válidos: aes, aes192, aes256, des e 3des. Valor padrão: aes. |
aes |
| IkeLifetime |
integer |
Não |
O tempo de vida da SA resultante das negociações da Fase 1. Unidade: segundos. Valores válidos: 0 a 86400. Valor padrão: 86400. |
86400 |
| IkeMode |
string |
Não |
O modo de negociação do IKE. Valores válidos: main e aggressive. Valor padrão: main.
|
main |
| IkePfs |
string |
Não |
O algoritmo de troca de chaves Diffie-Hellman usado nas negociações da Fase 1. Valor padrão: group2. |
group2 |
| IkeVersion |
string |
Não |
A versão do protocolo IKE. Valores válidos: ikev1 e ikev2. Valor padrão: ikev1. Comparado com o IKEv1, o IKEv2 simplifica o processo de negociação de SA e oferece melhor suporte para cenários com múltiplos blocos CIDR. |
ikev1 |
| LocalId |
string |
Não |
O identificador do túnel no lado da Alibaba Cloud, usado nas negociações da Fase 1. O identificador não pode exceder 100 caracteres e não pode conter espaços. O valor padrão é o endereço IP do túnel. LocalId suporta nomes de domínio totalmente qualificados (FQDNs). Se você usar um FQDN, recomendamos que defina o modo de negociação como aggressive. |
47.21.XX.XX |
| Psk |
string |
Não |
A chave pré-compartilhada usada para autenticação de identidade entre o túnel e o peer do túnel.
Nota
O túnel e o peer do túnel devem usar a mesma chave pré-compartilhada. Caso contrário, o túnel não poderá ser estabelecido. |
123456**** |
| RemoteId |
string |
Não |
O identificador do peer do túnel, usado nas negociações da Fase 1. O identificador não pode exceder 100 caracteres e não pode conter espaços. O valor padrão é o endereço IP do customer gateway associado ao túnel. RemoteId suporta FQDNs. Se você usar um FQDN, recomendamos que defina o modo de negociação como aggressive. |
47.42.XX.XX |
| TunnelIpsecConfig |
object |
Não |
As configurações das negociações da Fase 2. |
|
| IpsecAuthAlg |
string |
Não |
O algoritmo de autenticação usado nas negociações da Fase 2. Valores válidos: md5, sha1, sha256, sha384 e sha512. Valor padrão: md5. |
md5 |
| IpsecEncAlg |
string |
Não |
O algoritmo de criptografia usado nas negociações da Fase 2. Valores válidos: aes, aes192, aes256, des e 3des. Valor padrão: aes. |
aes |
| IpsecLifetime |
integer |
Não |
O tempo de vida da SA resultante das negociações da Fase 2. Unidade: segundos. Valores válidos: 0 a 86400. Valor padrão: 86400. |
86400 |
| IpsecPfs |
string |
Não |
O algoritmo de troca de chaves Diffie-Hellman usado nas negociações da Fase 2. Valor padrão: group2. Valores válidos: disabled, group1, group2, group5 e group14. |
group2 |
| EnableTunnelsBgp |
boolean |
Não |
Este parâmetro está disponível se você criar uma conexão IPsec-VPN no modo de túnel duplo. Especifica se o recurso BGP deve ser ativado para o túnel. Valores válidos: true e false. Valor padrão: false. |
true |
| DryRun |
boolean |
Não |
Especifica se deve ser realizado apenas um dry run da solicitação. Valores válidos:
|
false |
Elementos de resposta
|
Elemento |
Tipo |
Descrição |
Exemplo |
|
object |
Os dados retornados. |
||
| RequestId |
string |
O ID da solicitação. |
082AD562-B8DB-4BB2-861F-DA1FCA01FD76 |
| VpnConnectionId |
string |
O ID da conexão IPsec-VPN. |
vco-bp15oes1py4i6**** |
| Name |
string |
O nome da conexão IPsec-VPN. |
test |
| CreateTime |
integer |
O timestamp gerado quando a conexão IPsec-VPN foi estabelecida. Unidade: milissegundos. Este valor é um timestamp UNIX que representa o número de milissegundos decorridos desde a época em 1 de janeiro de 1970, 00:00:00 UTC. |
1544666102000 |
Exemplos
Resposta de sucesso
JSON formato
{
"RequestId": "082AD562-B8DB-4BB2-861F-DA1FCA01FD76",
"VpnConnectionId": "vco-bp15oes1py4i6****",
"Name": "test",
"CreateTime": 1544666102000
}
Códigos de erro
|
Código de status HTTP |
Código de erro |
Mensagem de erro |
Descrição |
|---|---|---|---|
| 400 | Resource.QuotaFull | The quota of resource is full | |
| 400 | InvalidVpnConnection.AlreadyExists | Vpn connection already exists. | |
| 400 | VpnGateway.Configuring | The specified service is configuring. | |
| 400 | VpnGateway.FinancialLocked | The specified service is financial locked. | |
| 400 | VpnGateway.IpsecVpnDisabled | The vpn gateway does not enable IPSec VPN. | The IPsec-VPN feature is not enabled for the VPN gateway. |
| 400 | VpnRouteEntry.AlreadyExists | The specified route entry is already exist. | The route already exists. |
| 400 | VpnRouteEntry.Conflict | The specified route entry has conflict. | Route conflicts exist. |
| 400 | NotSupportVpnConnectionParameter.IpsecPfs | The specified vpn connection ipsec Ipsec Pfs is not support. | The PFS parameter set for the IPsec-VPN connection is not supported. |
| 400 | NotSupportVpnConnectionParameter.IpsecAuthAlg | The specified vpn connection ipsec Auth Alg is not support. | The authentication algorithm specified for the IPsec-VPN connection is not supported. |
| 400 | VpnRouteEntry.ConflictSSL | The specified route entry has conflict with SSL client. | The route conflicts with the SSL client. |
| 400 | VpnRouteEntry.BackupRoute | Validate backup route entry failed. | Active/standby routes failed authentication. |
| 400 | VpnRouteEntry.InvalidWeight | Invalid route entry weight value. | The weight specified for the route is invalid. |
| 400 | InvalidParameter.VpnConnectionName | The specified vpn connection name is invalid. | The VPN connection name does not meet the requirements. |
| 400 | OperationUnsupported.SetDPD | Current version of the VPN does not support setting DPD. | The VPN gateway version does not support DPD. |
| 400 | OperationUnsupported.SetNatTraversal | Current version of the VPN does not support setting NAT traversal. | The VPN gateway version does not support NAT traversal. |
| 400 | QuotaExceeded.PolicyBasedRoute | The maximum number of policy-based routes is exceeded. Existing routes: %s. Routes to be created: %s. Maximum routes: %s. | The quota of policy-based routes is reached. Existing routes: %s. Routes to be created: %s. Quota: %s. |
| 400 | MissingParameter.TunnelCidr | The parameter TunnelCidr is mandatory when BGP is enabled. | You must specify the tunnel CIDR block when you enable BGP. |
| 400 | OperationUnsupported.EnableBgp | Current version of the VPN does not support enable BGP. | The current version of the VPN gateway does not support BGP. |
| 400 | MissingParam.CustomerGatewayAsn | Asn of customer gateway is mandatory when BGP is enabled. | The ASN of the customer gateway cannot be empty when you enable BGP. |
| 400 | IllegalParam.LocalAsn | The specified LocalAsn is invalid. | The local ASN is invalid. |
| 400 | IllegalParam.BgpConfig | The specified BgpConfig is invalid. | The BGP configuration is invalid. |
| 400 | IllegalParam.EnableBgp | VPN connection must enable BGP when VPN gateway has enabled BGP. | The error message returned because the VPN connection must use BGP if BGP is enabled for the VPN gateway. |
| 400 | IllegalParam.TunnelCidr | The specified TunnelCidr is invalid. | The TunnelCidr parameter is set to an invalid value. |
| 400 | InvalidLocalBgpIp.Malformed | The specified LocalBgpIp is malformed. | The local BGP IP address is in an abnormal state. |
| 400 | IllegalParam.LocalBgpIp | The specified LocalBgpIp is invalid. | The local BGP IP address is invalid. |
| 400 | IllegalParam.LocalSubnet | The specified "LocalSubnet" (%s) is invalid. | The specified "LocalSubnet" (%s) is invalid. |
| 400 | IllegalParam.RemoteSubnet | The specified "RemoteSubnet" (%s) is invalid. | The specified "RemoteSubnet" (%s) is invalid. |
| 400 | OperationFailed.MissCertificate | The VPN gateway has not associated any certificates. | The error message returned because the VPN gateway is not associated with a certificate. |
| 400 | MissingParam.RemoteId | The remote ID is mandatory when creating national standard VPN connection. | The error message returned because the peer ID is not specified. You must specify the peer ID when you create a VPN connection encrypted by SM. |
| 400 | OperationFailed.CenLevelNotSupport | When the VPC to which the VPN gateway belongs is attached to a FULL-mode CEN, the VPN gateway cannot enable BGP. | When the VPC to which the VPN gateway belongs is attached to a FULL-mode CEN, the VPN gateway cannot enable BGP. |
| 400 | CustomerGateway.ConflictRouteEntry | The specified customer gateway has conflict with route entry. | The customer gateway conflicts with the current routes. |
| 400 | VpnTask.CONFLICT | Vpn task has conflict. | The VPN operation conflicts. Try again later. |
| 400 | Forbidden.TagKey.Duplicated | The specified tag key already exists. | The tag resources are duplicate. |
| 400 | SizeLimitExceeded.TagNum | The maximum number of tags is exceeded. | The number of tags has reached the upper limit. |
| 400 | InvalidParameter.TagValue | The specified parameter TagValue is invalid. | The error message returned because the specified tag value is invalid. |
| 400 | InvalidParameter.TagKey | The specified parameter TagKey is invalid. | The error message returned because the specified tag key is invalid. |
| 400 | Duplicated.TagKey | The specified parameter TagKey is duplicated. | The error message returned because the specified tag key already exists. |
| 400 | InternalError | The request processing has failed due to some unknown error, exception or failure. | |
| 400 | InvalidTunnelCidr.Malformed | The specified TunnelCidr is malformed. | The specified tunnel CIDR block is invalid. |
| 400 | VpnConnectionParamInvalid.SameVpnAndCgwDifferentIkeConfigs | IPSec connections associated with the same user gateway and VPN gateway should have the same pre-shared key and IKE configuration. | The pre-shared key and IKE parameters must be the same for IPsec-VPN connections that are associated with the same VPN gateway and customer gateway. |
| 400 | VpnConnectionParamInvalid.SameVpnAndCgwTrafficSelectorOverlap | Traffic selectors of IPSec connections associated with the same user gateway and VPN gateway should not overlap. | The protected data flows of IPsec-VPN connections that are associated with the same VPN gateway and customer gateway cannot overlap. |
| 400 | CustomerGateway.ConflictVpnIp | The customer gateway associated with the IPSec connection should not have the same IP address as the VPN gateway. | The customer gateway and VPN gateway of an IPsec-VPN connection cannot use the same IP address. |
| 400 | VpnGateway.IPsecServerAndVpnConnectionConflict | The IPSec connection and IPSec server cannot be configured on the same VPN gateway at the same time. | You cannot configure an IPsec server and an IPsec-VPN connection at the same time for one VPN gateway. |
| 400 | InvalidSslVpnServerCertId.NotFound | The parameter is incorrect. The corresponding SSL VPN server certificate cannot be found. | The parameter is incorrect. The corresponding SSL VPN server certificate cannot be found. |
| 400 | MissingParameter.TunnelOptionsSpecification | The required parameters are missing when creating a tunnel for dual-tunnel VPN. | The required parameters are missing when creating a tunnel for dual-tunnel VPN. |
| 400 | CreateDbrRoutesQuotaFull.QuotaFull | The number of created destination routes exceeds the quota limit. | The number of created destination routes exceeds the quota limit. |
| 400 | CreatePbrRoutesQuotaFull.QuotaFull | The number of policy routes exceeds the quota limit. | The number of policy routes exceeds the quota limit. |
| 400 | CreateVpnConnectionsQuotaFull.QuotaFull | The number of VPN connections exceeds the quota limit. | The number of VPN connections exceeds the quota limit. |
| 400 | DryRunOperation | Request validation has been passed with DryRun flag set. | The request passed the dry run. |
| 400 | OperationFailed.OpenCdtServiceFirst | The operation is failed because of %s. | The billing method requires CDT billing enabled. Enable CDT billing and try again. |
| 400 | EncAlgInvalid.DesIncompatible | Des/3des in IkeEncAlg and IpsecEncAlg does not support multi algorithm. | Des/3des in IkeEncAlg and IpsecEncAlg does not support multi algorithm. |
| 400 | IkeVersionInvalid.GcmIncompatible | Ikev1 does not support IkeEncAlg of gcm16. | Ikev1 does not support IkeEncAlg of gcm16. |
| 403 | Forbbiden.SubUser | User not authorized to operate on the specified resource as your account is created by another user. | |
| 403 | Forbidden | User not authorized to operate on the specified resource. | You do not have the permissions to manage the specified resource. Apply for the permissions and try again. |
| 404 | InvalidCustomerGatewayInstanceId.NotFound | The specified customer gateway instance id does not exist. | The specified customer gateway does not exist. Check whether the ID of the customer gateway is correct. |
| 404 | InvalidVpnGatewayInstanceId.NotFound | The specified vpn gateway instance id does not exist. |
Consulte Códigos de Erro para uma lista completa.
Notas de versão
Consulte Notas de Versão para uma lista completa.