云服务器内容精选

  • 访问策略 权限 对应API接口 授权项(Action) 依赖的授权项 IAM 项目(Project) 企业项目(Enterprise Project) 创建VPN访问策略 POST /v5/{project_id}/p2c-vpn-gateways/vpn-servers/{vpn_server_id}/access-policies vpn:p2cVpnGateway:createAccessPolicy - √ x 查询VPN访问策略列表 GET /v5/{project_id}/p2c-vpn-gateways/vpn-servers/{vpn_server_id}/access-policies vpn:p2cVpnGateway:listAccessPolicies - √ x 修改VPN访问策略 PUT /v5/{project_id}/p2c-vpn-gateways/vpn-servers/{vpn_server_id}/access-policies/{policy_id} vpn:p2cVpnGateway:updateAccessPolicy - √ x 查询VPN访问策略 GET /v5/{project_id}/p2c-vpn-gateways/vpn-servers/{vpn_server_id}/access-policies/{policy_id} vpn:p2cVpnGateway:getAccessPolicy - √ x 删除VPN访问策略 DELETE /v5/{project_id}/p2c-vpn-gateways/vpn-servers/{vpn_server_id}/access-policies/{policy_id} vpn:p2cVpnGateway:deleteAccessPolicy - √ x 父主题: 终端入云VPN授权项列表
  • VPN连接监控 权限 对应API接口 授权项(Action) 依赖的授权项 IAM项目(Project) 企业项目(Enterprise Project) 创建连接监控 POST /v5/{project_id}/connection-monitors vpn:connectionMonitors:create - √ x 查询连接监控列表 GET /v5/{project_id}/connection-monitors vpn:connectionMonitors:list - √ x 删除连接监控 DELETE /v5/{project_id}/connection-monitors/{connection_monitor_id} vpn:connectionMonitors:delete - √ x 查询连接监控 GET /v5/{project_id}/connection-monitors/{connection_monitor_id} vpn:connectionMonitors:get - √ x 父主题: 站点入云VPN授权项列表
  • 操作步骤 根据Windows操作系统下载Easy-RSA安装包至“D:\”目录下。 Windows 32位操作系统,可以下载EasyRSA-3.1.7-win32.zip。 Windows 64位操作系统,可以下载EasyRSA-3.1.7-win64.zip。 此处以安装EasyRSA-3.1.7-win64为示例。 解压缩“EasyRSA-3.1.7-win64.zip”至指定目录,如“D:\EasyRSA-3.1.7”。 进入“D:\EasyRSA-3.1.7”目录。 在地址栏中输入cmd并按回车键,打开命令行窗口。 执行“.\EasyRSA-Start.bat”命令,运行Easy-RSA。 系统显示如下类似信息: Welcome to the EasyRSA 3 Shell for Windows. Easy-RSA 3 is available under a GNU GPLv2 license. Invoke './easyrsa' to call the program. Without commands, help is displayed. EasyRSA Shell # 执行“./easyrsa init-pki”命令,初始化PKI环境。 系统显示如下类似信息: Notice ------ 'init-pki' complete; you may now create a CA or requests. Your newly created PKI dir is: * D:/EasyRSA-3.1.7/pki Using Easy-RSA configuration: * undefined EasyRSA Shell # 执行命令后,在“D:\EasyRSA-3.1.7”的目录下自动生成了“pki”的文件夹。 配置变量参数。 将“D:\EasyRSA-3.1.7”目录下的“vars.example”文件复制到“D:\EasyRSA-3.1.7\pki”目录下。 将“D:\EasyRSA-3.1.7\pki”目录下的“vars.example”重命名为“vars”。 默认按“vars.example”中描述的参数值进行配置。如需自定义参数值,按需设置“vars”文件的参数值。 生成服务端CA证书认证及其私钥。 复制解压缩后的“EasyRSA-3.1.7”文件夹至“D:\”目录下,并重命名,如“EasyRSA-3.1.7 - server”。 进入“D:\EasyRSA-3.1.7 - server”目录。 在“D:\EasyRSA-3.1.7 - server”的文件夹中,地址栏中输入cmd并按回车键,打开命令行窗口。 执行“.\EasyRSA-Start.bat”命令,运行Easy-RSA。 系统显示如下类似信息: Welcome to the EasyRSA 3 Shell for Windows. Easy-RSA 3 is available under a GNU GPLv2 license. Invoke './easyrsa' to call the program. Without commands, help is displayed. EasyRSA Shell # 执行“./easyrsa build-ca nopass”命令,生成CA证书。 此命令生成中,[Easy-RSA CA]需要设置服务端CA证书名称,例如:p2cvpn_server.com。 系统显示如下类似信息: Using Easy-RSA 'vars' configuration: * D:/EasyRSA-3.1.7 - server/pki/vars Using SSL: * openssl OpenSSL 3.1.2 1 Aug 2023 (Library: OpenSSL 3.1.2 1 Aug 2023) ..+.....+...+..........+..+.......+..+..........+...+...+..+......+.......+...+++++++++++++++++++++++++++++++++++++++*.+++++++++++++++++++++++++++++++++++++++*..........+...........+...+......++++++ .......+.......+...+......+...+.....+...+...+++++++++++++++++++++++++++++++++++++++*......+.....+....+..+....+......+...+......+...+......+.....+.+++++++++++++++++++++++++++++++++++++++*.......+......+.......+..............+.+...+.....+....+........+.........+....+..+............+.+.....+....+...+...+...........+.+..+.+.........+.....+...+..................+.......+..+.......+.....+..........+......+..+.+.....+.+.....+....+.....+.......+...+.........+..+......+...+.......+...+.........+......+......+...........+....+......+...+..+...+......+...+.+.....+.......+..+.......+...+...+..+.............+........+.........+.+.........+........+....+.........+.....+.........+................+.....+.+........+.......+.....+.+........+....+..+...+..........+..+......+...+.........+................+......+.....+....+......+......+............+..+......+...+.......+.................+.+......+......+..+.+...........+.........+.........+.+......++++++ ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Common Name (eg: your user, host, or server name) [Easy-RSA CA]:p2cvpn_server.com //设置服务端CA证书名称 Notice ------ CA creation complete. Your new CA certificate is at: * D:/EasyRSA-3.1.7 - server/pki/ca.crt EasyRSA Shell # 查看服务端CA证书及其私钥。 生成的CA证书默认存放在“D:\EasyRSA-3.1.7 - server\pki”目录下。 本示例中生成的证书为“ca.crt”。 生成的CA私钥默认存放在“D:\EasyRSA-3.1.7 - server\pki\private”目录下。 本示例中生成的私钥为“ca.key”。 执行 “./easyrsa build-server-full p2cserver.com nopass”命令,生成服务端证书及其私钥。 此命令中,“p2cserver.com”为服务端证书的CN,必须是 域名 格式,否则无法正常托管到 云证书管理服务 。请根据实际填写。 系统显示如下类似信息: Using Easy-RSA 'vars' configuration: * D:/EasyRSA-3.1.7 - server/pki/vars Using SSL: * openssl OpenSSL 3.1.2 1 Aug 2023 (Library: OpenSSL 3.1.2 1 Aug 2023) .+.+......+...+.....+......+...+.......+.....+.+...+..+...+....+.....+......+++++++++++++++++++++++++++++++++++++++*....+..+....+++++++++++++++++++++++++++++++++++++++*................+.......+..+.+..+...+......+.............+...+...+.........+........+.........+...+......+.+...+...+........+....+.....+.+............+.....+...+....+...........+....+..+......+.............+.........+........+...+.+......+.....+.......+......+.....+.+.....+....+.........+...+..+............+.+........+.........+.+..+.........+......+...+....+......+.....+....+......+.....+......+.............+...+........+.+.....+.+....................+.......+.....+.+..+.......+...++++++ ......+.....+...+.+.........+..+.+..+...+++++++++++++++++++++++++++++++++++++++*.......+...+........+....+...+..+...+++++++++++++++++++++++++++++++++++++++*..+.........+...+.......+......+.................+...+...+............+...+....+........+.........+..........+......+...+...........+.+..+............+.+........+....+...........+....+...........+......+.............+......+.....++++++ ----- Notice ------ Private-Key and Public-Certificate-Request files created. Your files are: * req: D:/EasyRSA-3.1.7 - server/pki/reqs/p2cserver.com.req * key: D:/EasyRSA-3.1.7 - server/pki/private/p2cserver.com.key You are about to sign the following certificate: Request subject, to be signed as a server certificate for '825' days: subject= commonName = p2cserver.com Type the word 'yes' to continue, or any other input to abort. Confirm request details: yes //输入“yes”以继续 Using configuration from D:/EasyRSA-3.1.7 - server/pki/openssl-easyrsa.cnf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows commonName :ASN.1 12:'p2cserver.com' Certificate is to be certified until Oct 6 03:28:14 2026 GMT (825 days) Write out database with 1 new entries Database updated Notice ------ Certificate created at: * D:/EasyRSA-3.1.7 - server/pki/issued/p2cserver.com.crt Notice ------ Inline file created: * D:/EasyRSA-3.1.7 - server/pki/inline/p2cserver.com.inline EasyRSA Shell # 查看服务端证书及其私钥。 生成的服务端证书默认存放在“D:\EasyRSA-3.1.7 - server\pki\issued”目录下的“issued”文件夹中。 本示例中生成的证书为“p2cserver.com.crt”。 生成的服务端私钥默认存放在“D:\EasyRSA-3.1.7 - server\pki\private”目录下的“private”文件夹中。 本示例中生成的私钥为“p2cserver.com.key”。 生成客户端CA证书认证及其私钥。 复制解压缩后的“EasyRSA-3.1.7”文件夹至“D:\”目录下,并重命名,如“EasyRSA-3.1.7 - client” 进入“EasyRSA-3.1.7 - client”目录。 在“EasyRSA-3.1.7 - client”的文件夹中,地址栏中输入cmd并按回车键,打开命令行窗口。 执行“.\EasyRSA-Start.bat”命令,运行Easy-RSA。 系统显示如下类似信息: Welcome to the EasyRSA 3 Shell for Windows. Easy-RSA 3 is available under a GNU GPLv2 license. Invoke './easyrsa' to call the program. Without commands, help is displayed. EasyRSA Shell # 执行“ ./easyrsa build-ca nopass”命令,生成CA证书。 系统显示如下类似信息: Using Easy-RSA 'vars' configuration: * D:/EasyRSA-3.1.7 - client/pki/vars Using SSL: * openssl OpenSSL 3.1.2 1 Aug 2023 (Library: OpenSSL 3.1.2 1 Aug 2023) .+++++++++++++++++++++++++++++++++++++++*.....+.+..+...+....+.....................+..+...+....+.........+.....+......+.+.....+....+++++++++++++++++++++++++++++++++++++++*....+...+...+...+............+.........++++++ .+.........+.........+.+......+...........+....+.....+.........+....+..+...+.+.........+......+......+...+.....+......+......+..........+++++++++++++++++++++++++++++++++++++++*.+.........+......+.+++++++++++++++++++++++++++++++++++++++*...........+................+..............+.........+.+...+.....................+..+....+.....+..........+...+...+..+.++++++ ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Common Name (eg: your user, host, or server name) [Easy-RSA CA]:p2cvpn_client.com //设置客户端CA证书名称 Notice ------ CA creation complete. Your new CA certificate is at: * D:/EasyRSA-3.1.7 - client/pki/ca.crt EasyRSA Shell # 查看客户端CA证书及其私钥。 生成的CA证书默认存放在“D:\EasyRSA-3.1.7 - client\pki”目录下。 本示例中生成的证书为“ca.crt”。 生成的CA私钥默认存放在“D:\EasyRSA-3.1.7 - client\pki\private”目录下。 本示例中生成的私钥为“ca.key”。 执行“./easyrsa build-client-full p2cclient.com nopass”命令,生成客户端证书及其私钥。 此命令中,客户端证书的命名(如“p2cclient.com”)应与服务端证书的命名(如“p2cserver.com”)不一致。 系统显示如下类似信息: Using Easy-RSA 'vars' configuration: * D:/EasyRSA-3.1.7 - client/pki/vars Using SSL: * openssl OpenSSL 3.1.2 1 Aug 2023 (Library: OpenSSL 3.1.2 1 Aug 2023) .+++++++++++++++++++++++++++++++++++++++*.........+.....+...+.+........+.+.....+.........+.+......+.....+++++++++++++++++++++++++++++++++++++++*..........+...+...+..+.......+...+..+.+.........+.....+.+..+.+....................+......+...............+.............+......+..+....+...+......+..+....+.....+.........+................+...+...+.....+....+.........++++++ .+..+..........+.........+++++++++++++++++++++++++++++++++++++++*...+..+++++++++++++++++++++++++++++++++++++++*.......+...............+......+.........+..............+....+.....+...+..................+....+...+........+....+.....+.+.....+...............++++++ ----- Notice ------ Private-Key and Public-Certificate-Request files created. Your files are: * req: D:/EasyRSA-3.1.7 - client/pki/reqs/p2cclient.com.req * key: D:/EasyRSA-3.1.7 - client/pki/private/p2cclient.com.key You are about to sign the following certificate: Request subject, to be signed as a client certificate for '825' days: subject= commonName = p2cclient.com Type the word 'yes' to continue, or any other input to abort. Confirm request details: yes Using configuration from D:/EasyRSA-3.1.7 - client/pki/openssl-easyrsa.cnf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows commonName :ASN.1 12:'p2cclient.com' Certificate is to be certified until Oct 7 11:19:52 2026 GMT (825 days) Write out database with 1 new entries Database updated Notice ------ Certificate created at: * D:/EasyRSA-3.1.7 - client/pki/issued/p2cclient.com.crt Notice ------ Inline file created: * D:/EasyRSA-3.1.7 - client/pki/inline/p2cclient.com.inline EasyRSA Shell # 查看客户端证书和私钥。 生成的客户端证书默认存放在“D:\EasyRSA-3.1.7 - client\pki\issued”目录下。 本示例中生成的证书为“p2cclient.com.crt”。 生成的客户端私钥默认存放在“D:\EasyRSA-3.1.7 - client\pki\private”目录下。 本示例中生成的私钥为“p2cclient.com.key”。
  • Linux客户端 此处以在Ubuntu 22.04(jammy) openvpn_2.5.8-0ubuntu0.22.04.1_amd64操作系统上安装OpenVPN为例,不同Linux系统的安装命令可能存在差异,请以实际为准。(2.5版本不支持dco,需要在配置文件中注释“disable-dco”。) 打开命令行窗口。 执行以下命令安装OpenVPN客户端。 yum install -y openvpn 将已添加客户端证书及私钥的客户端配置文件内容复制至/etc/openvpn/conf/目录。 进入/etc/openvpn/conf/目录,执行以下命令建立VPN连接。 openvpn --config /etc/openvpn/conf/config.ovpn --daemon
  • iOS客户端 此处以安装OpenVPN Connect(3.4.0)为例,不同软件版本的安装界面可能存在差异,请以实际为准。 在App Store搜索“OpenVPN Connect”,下载并安装。 下载客户端配置,在“client_config.ovpn”文件中添加客户端证书及私钥,然后通过OpenVPN Connect打开,按照界面提示添加客户端配置。 图11 导入配置文件 出现类似下图所示界面,代表连接成功。 图12 连接成功
  • Mac客户端(Tunnelblick) 此处以安装Tunnelblick(3.8.8d)为例,不同软件版本的安装界面可能存在差异,请以实际为准。 前往官方网站下载Tunnelblick。 您可以根据实际需要下载适用的版本,推荐使用正式版本。下载软件时推荐下载DMG格式的软件。 根据界面提示,安装Tunnelblick。 图2 安装Tunelblick 启动Tunnelblick客户端,将已添加客户端证书及私钥的配置文件上传至Tunnelblick客户端,建立VPN连接。 图3 上传客户端配置文件 出现类似下图所示界面,代表连接成功。 图4 连接成功
  • Mac客户端(OpenVPN Connect) 此处以安装OpenVPN Connect(3.4.4.4629)为例,不同软件版本的安装界面可能存在差异,请以实际为准。 在OpenVPN官方网站下载OpenVPN Connect,根据硬件规格选择对应安装程序。 图5 选择安装包 根据界面提示,完成软件安装。 图6 安装OpenVPN Connect 启动OpenVPN Connect客户端,导入已添加客户端证书及私钥的配置文件,填写配置信息后建立VPN连接。 图7 导入配置文件 出现类似下图所示界面,代表连接成功。 图8 连接成功
  • Windows客户端(OpenVPN Connect) 此处以安装OpenVPN Connect 3.4.2(3160)为例,不同软件版本的安装界面可能存在差异,请以实际为准。 在OpenVPN官方网站下载OpenVPN Connect,根据界面提示进行安装。 启动OpenVPN Connect客户端,支持以下两种方式添加配置信息,建立VPN连接。 方式1:使用配置文件(已添加客户端证书及私钥)建立VPN连接 打开OpenVPN客户端,导入已添加客户端证书及私钥的配置文件,建立VPN连接。 方式2:使用原始配置文件(未添加客户端证书及私钥)+USB-Key的组合,建立VPN连接 初始化USB-Key。 此处以使用龙脉mToken GM3000管理员工具(v2.2.19.619)制作USB-Key为例。USB-Key初始化成功后如下图所示,此时需要拔插一下USB设备。 将客户端证书导入USB-Key。 使用USB-Key建立VPN连接。 在OpenVPN Connect中导入USB-Key中未添加客户端CA证书及私钥的配置文件,单击“CONNECT”。 建连过程中,USB-Key需要保持插入状态。 建连成功后,拔出USB-Key,连接不会中断,需要手动断连;USB-Key拔出后,重新建连将失败。 出现类似下图所示界面,代表连接成功。 图1 连接成功
  • 操作步骤 根据Windows操作系统下载Easy-RSA安装包至“D:\”目录下。。 Windows 32位操作系统,可以下载EasyRSA-3.1.7-win32.zip。 Windows 64位操作系统,可以下载EasyRSA-3.1.7-win64.zip。 此处以安装EasyRSA-3.1.7-win64为示例。 解压缩“EasyRSA-3.1.7-win64.zip”至指定目录,如“D:\EasyRSA-3.1.7”。 进入“D:\EasyRSA-3.1.7”目录。 在地址栏中输入cmd并按回车键,打开命令行窗口。 执行“.\EasyRSA-Start.bat”命令,运行Easy-RSA。 系统显示如下类似信息: Welcome to the EasyRSA 3 Shell for Windows. Easy-RSA 3 is available under a GNU GPLv2 license. Invoke './easyrsa' to call the program. Without commands, help is displayed. EasyRSA Shell # 执行“./easyrsa init-pki”命令,初始化PKI环境。 系统显示如下类似信息: Notice ------ 'init-pki' complete; you may now create a CA or requests. Your newly created PKI dir is: * D:/EasyRSA-3.1.7/pki Using Easy-RSA configuration: * undefined EasyRSA Shell # 执行命令后,在“D:\EasyRSA-3.1.7”的目录下自动生成了“pki”的文件夹。 配置变量参数。 将“D:\EasyRSA-3.1.7”目录下的“vars.example”文件复制到“D:\EasyRSA-3.1.7\pki”目录下。 将“D:\EasyRSA-3.1.7\pki”目录下的“vars.example”重命名为“vars”。 默认按“vars.example”中描述的参数值进行配置。如需自定义参数值,按需设置“vars”文件的参数值。 执行“ ./easyrsa build-ca nopass”命令,生成CA证书。 系统显示如下类似信息: Using Easy-RSA 'vars' configuration: * D:/EasyRSA-3.1.7/pki/vars Using SSL: * openssl OpenSSL 3.1.2 1 Aug 2023 (Library: OpenSSL 3.1.2 1 Aug 2023) .....+..+.............+......+........+...+...+....+++++++++++++++++++++++++++++++++++++++*.+.+.....+..........+............+...+++++++++++++++++++++++++++++++++++++++*............+.....+......+...+....+..+..........+.....+....+...............+..+.........+.............+......+..+...+....+..+.+.........+.....+.........+....+............+...+...+.....+........................+...+.+.....+....+...+.........+...+...+...+.....+......+........................++++++ .+++++++++++++++++++++++++++++++++++++++*.........+..........+++++++++++++++++++++++++++++++++++++++*.+......++++++ ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Common Name (eg: your user, host, or server name) [Easy-RSA CA]:p2cvpn.com //设置CA证书名称 Notice ------ CA creation complete. Your new CA certificate is at: * D:/EasyRSA-3.1.7/pki/ca.crt EasyRSA Shell # 查看CA证书及其私钥。 生成的CA证书默认存放在“D:\EasyRSA-3.1.7\pki”目录下。 本示例中生成的证书为“ca.crt”。 生成的CA私钥默认存放在“D:\EasyRSA-3.1.7\pki\private”目录下。 本示例中生成的私钥为“ca.key”。 执行 “./easyrsa build-server-full p2cserver.com nopass”命令,生成服务端证书及其私钥。 此命令中,“p2cserver.com”为证书的CN,必须是域名格式,否则无法正常托管到 云证书管理 服务,请根据实际填写。 系统显示如下类似信息: Using Easy-RSA 'vars' configuration: * D:/EasyRSA-3.1.7/pki/vars Using SSL: * openssl OpenSSL 3.1.2 1 Aug 2023 (Library: OpenSSL 3.1.2 1 Aug 2023) .+............+........+............+............+.+...............+.....+....+....................+............+.+..+......+............+....+.........+..+.........+.+.........+..............+.........+++++++++++++++++++++++++++++++++++++++*...+......+.....+......+...+++++++++++++++++++++++++++++++++++++++*..+...+..........+......+...........+....+......+.....+....+.....+....+........+...+.......+...+..+.......+..+......+.............+..+....+......+...+.....+................+......+..+.............+..+................+.....+......+....+...........+....+.....+.........+.+..+.............+...........+..........+......+........+............+...+....+..+......+......................+.....+......+.+...+..+...+.+......+........+...+....+.....+......+....+...+..+................+..+...+.......+..+......+..........+.........+...+..+.........+......+......++++++ ........+.+......+...+......+.....+...+.+.....+.+........+......+++++++++++++++++++++++++++++++++++++++*...+.....+...+.+.........+......+........+++++++++++++++++++++++++++++++++++++++*......+........+.+...+.....+.+..............+.+.....+.+...+...+.....+.......+.................+.+............+..+......+...+....+...+..+.+.....+.....................+.+..+.+...................................+....+........+.............+.....+....+.....+...+..........+........+.+.....+...+.............+........+....+......+.....+.......+..+............+.........+.+......+...+...............+......+...........+............+.......+...........+.......+...............+......+.................+...+.+...+..+...+.+..........................+.+.........+......+............+..+....+..+....+........+.......+........+...+...+.+...+...+..+...............+...+..........+..+.......+.........+.....+.........+................+......+...+......+.....+.......+...+..............+.+.....+.+...+...........+.+...+...+...+............+..+.......+...........+.......+...+...+...........+.....................+...+....+...........+............+...+......+..........+........+.+.....+....+.....+.+..+..........+..............+...+......+.+...+...........+.+......+...++++++ ----- Notice ------ Private-Key and Public-Certificate-Request files created. Your files are: * req: D:/EasyRSA-3.1.7/pki/reqs/p2cserver.com.req * key: D:/EasyRSA-3.1.7/pki/private/p2cserver.com.key You are about to sign the following certificate: Request subject, to be signed as a server certificate for '825' days: subject= commonName = p2cserver.com Type the word 'yes' to continue, or any other input to abort. Confirm request details: yes //输入“yes”以继续 Using configuration from D:/EasyRSA-3.1.7/pki/openssl-easyrsa.cnf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows commonName :ASN.1 12:'p2cserver.com' Certificate is to be certified until Sep 22 09:56:54 2026 GMT (825 days) Write out database with 1 new entries Database updated Notice ------ Certificate created at: * D:/EasyRSA-3.1.7/pki/issued/p2cserver.com.crt Notice ------ Inline file created: * D:/EasyRSA-3.1.7/pki/inline/p2cserver.com.inline EasyRSA Shell # 查看服务端证书及其私钥。 生成的服务端证书默认存放在“D:\EasyRSA-3.1.7\pki\issued”目录下。 本示例中生成的证书为“p2cserver.com.crt”。 生成的服务端私钥默认存放在“D:\EasyRSA-3.1.7\pki\private”目录下。 本示例中生成的私钥为“p2cserver.com.key”。 执行“ ./easyrsa build-client-full p2cclient.com nopass”命令,生成客户端证书及其私钥。 此命令中,客户端证书的命名(如“p2cclient.com”)应与服务端证书的命名(如“p2cserver.com”)不一致。 系统显示如下类似信息: Using Easy-RSA 'vars' configuration: * D:/EasyRSA-3.1.7/pki/vars Using SSL: * openssl OpenSSL 3.1.2 1 Aug 2023 (Library: OpenSSL 3.1.2 1 Aug 2023) .......+++++++++++++++++++++++++++++++++++++++*...+...+...+.....+...+....+......+......+........+.+.....+............+++++++++++++++++++++++++++++++++++++++*.+.....+.+.....+.........+.......+..+...+.......+...+..+......+.+......+........+....+...+...+..+.......+......+.....+..........+...........+....+......+.....+.........+......+.+..+...+..........+........+......+....+......+...........+.......+.....+.............+..+.+...........+..........+...+..+.........+......+.+........+.........+.+...............+..+..........+...+............+...+.....+.+...........+....+.....+.........+....+.......................+....+...+..+....+..+.......+...+............+.....+............+.+........+.......+.....+....+.........+..+............+..........+..+.............+...+...+..++++++ ..+.....+.......+.....+.........+....+++++++++++++++++++++++++++++++++++++++*.....+......+..+++++++++++++++++++++++++++++++++++++++*.......+.+.....+....+.........+...+.....+.........+...+...............+...+....+.....+.+...+......+......+...+.........+..+...+...+....+.........+..+...+...................+......+.....+.+...+...+.........+.....+..................+...+...+......+.+..+......+.+......+.....+...+..........+..+............+.......+.........+.....+......+.+..+............+................+..+...+....+......+.....+...+....+..+......+.........+.........++++++ ----- Notice ------ Private-Key and Public-Certificate-Request files created. Your files are: * req: D:/EasyRSA-3.1.7/pki/reqs/p2cclient.com.req * key: D:/EasyRSA-3.1.7/pki/private/p2cclient.com.key You are about to sign the following certificate: Request subject, to be signed as a client certificate for '825' days: subject= commonName = p2cclient.com Type the word 'yes' to continue, or any other input to abort. Confirm request details: yes //输入“yes”以继续 Using configuration from D:/EasyRSA-3.1.7/pki/openssl-easyrsa.cnf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows commonName :ASN.1 12:'p2cclient.com' Certificate is to be certified until Sep 22 09:58:26 2026 GMT (825 days) Write out database with 1 new entries Database updated Notice ------ Certificate created at: * D:/EasyRSA-3.1.7/pki/issued/p2cclient.com.crt Notice ------ Inline file created: * D:/EasyRSA-3.1.7/pki/inline/p2cclient.com.inline EasyRSA Shell # 查看客户端证书及其私钥。 生成的客户端证书默认存放在“D:\EasyRSA-3.1.7\pki\issued”目录下。 本示例中生成的证书为“p2cclient.com.crt”。 生成的客户端私钥默认存放在“D:\EasyRSA-3.1.7\pki\private”目录下。 本示例中生成的私钥为“p2cclient.com.key”。
  • 操作流程 通过VPN实现数据中心和VPC互通的操作流程如图3所示。 图3 操作流程 表2 操作流程说明 序号 步骤 说明 1 步骤一:创建VPN网关 VPN网关需要绑定两个EIP作为出口公网IP。 如果您已经购买EIP,则此处可以直接绑定使用。 2 修订记录 添加数据中心的VPN设备为对端网关。 3 步骤三:创建第一条VPN连接 VPN网关的主EIP和对端网关组建第一条VPN连接。 4 步骤四:创建第二条VPN连接 VPN网关的主EIP2和对端网关组建第二条VPN连接。 第二条VPN连接的路由模式、预共享密钥、IKE/IPsec策略建议和第一条VPN连接配置保持一致。 5 步骤五:配置对端网关设备 对端网关配置的本端隧道接口地址/对端隧道接口地址需要和华为云VPN连接配置互为镜像配置。 对端网关配置的路由模式、预共享密钥、IKE/IPsec策略需要和华为云VPN连接配置保持一致。 6 步骤六:验证网络互通情况 登录E CS ,执行ping命令,验证网络互通情况。
  • 数据规划 表1 规划数据 类别 规划项 规划值 VPC 待互通子网 192.168.0.0/16 VPN网关 互联子网 用于VPN网关和VPC通信,请确保选择的互联子网存在4个及以上可分配的IP地址。 192.168.2.0/24 HA模式 双活 EIP地址 EIP地址在购买EIP时由系统自动生成,VPN网关默认使用2个EIP。本示例假设EIP地址生成如下: 主EIP:11.xx.xx.11 主EIP2:11.xx.xx.12 VPN连接 Tunnel接口地址 用于VPN网关和对端网关建立IPsec隧道,配置时两边需要互为镜像。 VPN连接1:169.254.70.1/30 VPN连接2:169.254.71.1/30 数据中心 待互通子网 172.16.0.0/16 对端网关 网关IP地址 网关IP地址由运营商统一分配。本示例假设网关IP地址如下: 22.xx.xx.22 Tunnel接口地址 VPN连接1:169.254.70.2/30 VPN连接2:169.254.71.2/30
  • 场景描述 由于业务发展,企业A需要将数据中心和VPC的数据进行互通。此时企业A可以通过VPN服务创建数据中心和VPC的连接,实现云上和云下数据互通。 如果用户数据中心仅有一个对端网关,且对端网关只能配置一个IP地址,推荐VPN网关使用双活模式,组网如图1所示。 双活模式下,如果连接1链路故障,流量自动切换至连接2进行传输,企业业务不受影响;连接1恢复正常后,VPN仍使用连接2进行数据交互。 图1 双活模式 如果用户数据中心存在两个对端网关,或一个对端网关可以配置两个IP地址,推荐VPN网关使用主备模式,组网如图2所示。 主备模式下,连接1和连接2互为主备,主链路为连接1,备链路为连接2。默认情况下流量仅通过主链路进行传输,如果主链路故障,流量自动切换至备链路进行传输,企业业务不受影响;主链路恢复正常后,VPN回切至主链路进行数据交互。 图2 主备模式
  • 创建访问策略操作步骤 在“终端入云VPN网关”页面,单击目标VPN网关操作列的“查看服务端”。 在“访问策略 ”页签中,单击“创建策略”。 根据界面提示配置参数,然后单击“确定”。 本示例仅对关键参数进行说明。 表4 创建策略参数说明 参数 说明 参数取值 名称 只能由中文、英文字母、数字、下划线、中划线组成。 Policy_01 目的网段 输入网段,多个以半角逗号隔开,例如:192.168.1.0/24,192.168.2.0/24。 192.168.1.0/24 用户组 选择用户组。 Testgroup_01
  • 结果验证 打开客户端设备的命令行窗口。 执行命令:ping 192.168.1.10,验证连通性。 其中,192.168.1.10为客户端需要访问的弹性云服务器的IP地址,请根据实际替换。 回显如下信息,表示网络已通。 来自 xx.xx.xx.xx 的回复: 字节=32 时间=28ms TTL=245 来自 xx.xx.xx.xx 的回复: 字节=32 时间=28ms TTL=245 来自 xx.xx.xx.xx 的回复: 字节=32 时间=28ms TTL=245 来自 xx.xx.xx.xx 的回复: 字节=32 时间=27ms TTL=245
  • 响应消息 响应参数 返回状态码为 201: successful operation。 表6 响应Body参数列表 名称 类型 描述 vpn_gateway ResponseVpnGateway object VPN网关对象。 request_id String 请求ID。 表7 ResponseVpnGateway 名称 类型 描述 id String 功能说明:VPN网关ID。 格式:36位UUID。 name String 功能说明:VPN网关名称,不填时会自动生成。 取值范围:1-64个字符,包括数字、英文字母、中文(\u4e00 - \u9fa5)、_(下划线)、-(中划线)。 network_type String 功能说明:VPN网关网络类型。 取值范围:public,private。 默认值:public。 attachment_type String 功能说明:关联模式。 取值范围:vpc,er。 certificate_id String 功能说明:证书ID。 格式:36位UUID。 er_id String VPN网关所连接的ER实例的ID。仅当attachment_type为er时返回。 vpc_id String 当attachment_type为vpc时,vpc_id是VPN网关关联的业务VPC的ID。 当attachment_type为er时,不返回此字段。可以通过access_vpc_id字段查看VPN网关的接入VPC的ID。 local_subnets Array of String 本端子网。本端子网是云上子网,该网段需要通过VPN与用户侧网络进行互通。单个网段格式示例:192.168.52.0/24。仅当attachment_type为vpc时返回。 connect_subnet String VPN网关所使用的VPC中的一个子网ID。 bgp_asn Long VPN网关的BGP自治域编号。 flavor String 功能说明:VPN网关的规格类型。实际可选范围请参考VPN控制台创建VPN网关页面的Specification选项。 取值范围: v300:最大转发带宽300Mbps。该取值已经废弃,但仍然保留兼容性支持,建议不要使用该取值。 v1g:最大转发带宽1Gbps。该取值已经废弃,但仍然保留兼容性支持,建议不要使用该取值。 Basic:最大转发带宽100Mbps。 Professional1:最大转发带宽300Mbps。 Professional1-NonFixedIP:最大转发带宽300Mbps。 Professional2:最大转发带宽1Gbps。 Professional2-NonFixedIP:最大转发带宽1Gbps。 GM: 最大转发带宽500Mbps。 connection_number Integer VPN网关下的最大VPN连接数。 used_connection_number Integer VPN网关下当前已经使用的VPN连接数。 used_connection_group Integer VPN网关下当前已经使用的VPN连接组个数。同一用户网关入云的两条连接组成一个连接组。VPN网关默认支持10个免费的VPN连接组。 enterprise_project_id String 功能说明:企业项目ID。 格式:36位UUID或者"0"。 access_vpc_id String 功能说明:VPN网关使用的接入VPC ID。 格式:36位UUID。 access_subnet_id String 功能说明:VPN网关使用的接入VPC中的子网ID。 格式:36位UUID。 ha_mode String 功能说明:网关的HA模式,"active-active"表示双活,"active-standby"表示主备。 取值范围:active-active,active-standby。 默认值:active-active。 policy_template PolicyTemplate object 非固定IP接入VPN网关网关的策略模板配置,只有在规格为非固定IP接入VPN网关时返回。 tags Array of VpnResourceTag objects 标签列表。 表8 VpnResourceTag 名称 类型 描述 key String 功能说明:标签的键。 取值范围:1-128个字符,支持数字、英文字母、中文、西班牙语、葡语、空格,以及以下字符:_.:=+-@。 value String 功能说明:标签的值。 取值范围:0-255个字符,支持数字、英文字母、中文、西班牙语、葡语、空格,以及以下字符:_.:=+-@。 表9 PolicyTemplate 名称 类型 描述 ike_policy IkePolicy object ike 策略对象。 ipsec_policy IpsecPolicy object ipsec 策略对象。 表10 IkePolicy 名称 类型 描述 encryption_algorithm String 功能说明:加密算法。 取值范围:aes-256-gcm-16,aes-128-gcm-16,aes-256,aes-192,aes-128。 dh_group String 功能说明:第一阶段密钥交换使用的DH组。 取值范围:group14,group15,group16,group19,group20,group21,disable。 authentication_algorithm String 功能说明:认证算法。 取值范围:sha2-512,sha2-384,sha2-256。 lifetime_seconds Integer 功能说明:表示SA的生存周期,当该生存周期超时后IKE SA将自动更新。 取值范围:60-604800,单位:秒。 表11 IpsecPolicy 名称 类型 描述 authentication_algorithm String 功能说明:认证算法。 取值范围:sha2-512,sha2-384,sha2-256。 encryption_algorithm String 功能说明:加密算法。 取值范围:aes-256-gcm-16,aes-128-gcm-16,aes-256,aes-192,aes-128。 pfs String 功能说明:PFS使用的DH密钥组。 取值范围:group14,group15,group16,group19,group20,group21,disable。 lifetime_seconds Integer 功能说明:表示配置IPSec连接建立的隧道以时间为基准的生存周期。 取值范围:30-604800,单位:秒。 响应样例 使用已有EIP创建关联VPC的VPN网关的响应。 { "vpn_gateway": { "id": "134f9fb1-demo-a8df-va86-2040a5c13325", "name": "vpngw-9f24", "network_type": "public", "attachment_type": "vpc", "vpc_id": "0cf79a3f-demo-a8df-va86-d7ace626b0fa", "local_subnets": ["192.168.0.0/24"], "connect_subnet": "f5741286-demo-a8df-va86-2c82bd9ee114", "bgp_asn": 64512, "flavor": "Professional1", "connection_number": 200, "used_connection_number": 0, "used_connection_group": 0, "enterprise_project_id": "0", "access_vpc_id": "0cf79a3f-demo-a8df-va86-d7ace626b0fa", "access_subnet_id": "f5741286-demo-a8df-va86-2c82bd9ee114", "ha_mode": "active-active" }, "request_id": "7b37532a-d6e4-46b9-98dc-9169ec2ca58f" } 新建EIP创建关联ER的VPN网关的响应。 { "vpn_gateway": { "id": "80ac167b-demo-a8df-va86-a9a2a23223b8", "name": "vpngw-1234", "network_type": "public", "attachment_type": "er", "er_id": "cb4a631d-demo-a8df-va86-ca3fa348c36c", "bgp_asn": 65533, "flavor": "Professional2", "connection_number": 200, "used_connection_number": 0, "used_connection_group": 0, "enterprise_project_id": "0", "access_vpc_id": "0cf79a3f-demo-a8df-va86-d7ace626b0fa", "access_subnet_id": "f5741286-demo-a8df-va86-2c82bd9ee114", "ha_mode": "active-active" }, "request_id": "cd71cade-bfbd-410b-b672-4bfe46cfc311" } 创建私网关联VPC的VPN网关的响应。 { "vpn_gateway": { "id": "80ac167b-demo-a8df-va86-a9a2a23223b8", "name": "vpngw-1234", "network_type": "private", "attachment_type": "vpc", "vpc_id": "cb4a631d-demo-a8df-va86-ca3fa348c36c", "local_subnets": ["192.168.0.0/24", "192.168.1.0/24"], "connect_subnet": "f5741286-demo-a8df-va86-2c82bd9ee114", "bgp_asn": 65533, "flavor": "Professional2", "connection_number": 200, "used_connection_number": 0, "used_connection_group": 0, "enterprise_project_id": "0", "access_vpc_id": "cb4a631d-demo-a8df-va86-ca3fa348c36c", "access_subnet_id": "f5741286-demo-a8df-va86-2c82bd9ee114", "ha_mode": "active-active" }, "request_id": "cd71cade-bfbd-410b-b672-4bfe46cfc311" }