zstackio / doc-ch

ZStack Chinese user manual
Apache License 2.0
12 stars 21 forks source link

[IPsec]org.zstack.ipsec.APICreateIPsecConnectionMsg #76

Open zxwing opened 7 years ago

zxwing commented 7 years ago

描述

创建IPsec site-to-site VPN链接

image

site-to-site VPN用于连接两个私有网络,上图中192.168.1.0/24和92.168.3.0/24是两个私有网络,他们通过64.49.246.101和198.61.180.101两个公网IP连接。

API

org.zstack.ipsec.APICreateIPsecConnectionMsg

举例(Example)

CreateIPsecConnection name=ipsec1 l3NetworkUuid=fbbc1e6519a14e5696a6d271bce9d8f6 peerAddress=172.20.51.150 authKey=test vipUuid=0af328f53d3d4b11aebbc3b0f560b849 peerCidrs=10.0.15.0/24 policyMode=tunnel description=test

返回结果:

{
    "inventory": {
        "authKey": "test",
        "authMode": "psk",
        "createDate": "Nov 11, 2016 4:58:04 PM",
        "description": "test",
        "ikeAuthAlgorithm": "sha1",
        "ikeDhGroup": 2,
        "ikeEncryptionAlgorithm": "aes-128",
        "l3NetworkUuid": "fbbc1e6519a14e5696a6d271bce9d8f6",
        "lastOpDate": "Nov 11, 2016 4:58:04 PM",
        "name": "ipsec1",
        "peerAddress": "172.20.51.150",
        "peerCidrs": [
            {
                "cidr": "10.0.15.0/24",
                "connectionUuid": "5470eaffb87747a4af70c0359ae134ad",
                "createDate": "Nov 11, 2016 4:58:04 PM",
                "lastOpDate": "Nov 11, 2016 4:58:04 PM",
                "uuid": "413a423b88af486c89034e4e2bc77850"
            }
        ],
        "policyAuthAlgorithm": "sha1",
        "policyEncryptionAlgorithm": "aes-128",
        "policyMode": "tunnel",
        "transformProtocol": "esp",
        "uuid": "5470eaffb87747a4af70c0359ae134ad",
        "vipUuid": "0af328f53d3d4b11aebbc3b0f560b849"
    },
    "success": true
}

参数(Parameters)

IPsec site-to-site用于连接本地网络和远端网络,在下面的描述中,我们将用户在ZStack创建的相关网络资源称为本地网络资源,将要链接的网络及相关资源称为远端网络资源。

名字 描述 可选的参数 起始支持版本
name 链接名称 1.8
resourceUuid 资源的uuid 1.8
description 链接描述 1.8
l3NetworkUuid 本地L3网络UUID 1.8
peerAddress 远端网络IP 1.8
authMode 验证方式,支持pskcerts两种方式。1.8版本只支持psk模式 是,默认值为psk 1.8
authKey 验证码,根据验证方式不同内容不同。如果authMode = psk,该字段为一个用作密码的字符串 1.8
vipUuid 本地网络的VIP UUID。该VIP用于与远端网络地址链接,即peerAddress代表的IP 1.8
peerCidrs 远端网络CIDR,为一个数组。即本地网络可以链接多个远端网络,例如10.10.0.0/24 1.8
ikeAuthAlgorithm IKE验证算法,可选值为md5, sha1, sha256, sha384, sha512 是,默认值为sha1 1.8
ikeEncryptionAlgorithm IKE加密算法,可选值为3des, aes-128, aes-192, aes-256; NOTE:如果网络服务提供者为Vyos,则aes-192算法不支持 是,默认值为aes-128 1.8
ikeDhGroup IKE dh group(Diffie Hellman Groups),整形值,可选值为1,2,5,14,19,20 是,默认为2 1.8
policyAuthAlgorithm ipsec policy验证算法。对于1.8版本,为ESP验证算法,可选值为md5, sha1, sha256, sha384, sha512 是,默认值为sha 1.8
policyEncryptionAlgorithm ipsec policy加密算法。对于1.8版本,为ESP加密算法,可选值为3des, aes-128, aes-192, aes-256NOTE:如果网络服务提供者为Vyos,则aes-192算法不支持 是,默认值为aes-128 1.8
pfs Perfect Forward Secrecy,可选值为dh-group2,dh-group5,dh-group14,dh-group15,dh-group16,dh-group17,dh-group18,dh-group19,dh-group20,dh-group21,dh-group22,dh-group23,dh-group24,dh-group25,dh-group26,或不设置 是,默认是不设置,代表禁用pfs功能 1.8
policyMode ESP模式,可选值为tunneltransport。1.8只支持tunnel 是,默认为tunnel 1.8
transformProtocol 协议类型,可选值为esp, ah, 1.8只支持esp 是,默认为esp 1.8

备注

Feature_link

Configure a Site-to-site VPN using the Vyatta Network Appliance AH and ESP protocols

glody commented 7 years ago

Automation cases created. Total 38 cases for the parameters. Here is the link of cases https://github.com/zstackio/zstack-woodpecker/tree/master/integrationtest/vm/virtualrouter/ipsec

glody commented 7 years ago

根据https://github.com/zstackio/issues/issues/2558中@HeathHose 的调查结果,ikdDhGroup的取值范围应该与pfs对应的,故应该修改为如下值。

ikeDhGroup IKE dh group(Diffie Hellman Groups),整形值,可选值为2,5,14,,15,16,17,18,19,20,21,22,23,24,25,26,默认为2