• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

02-典型配置举例

64-H3C MSR系列路由器 IPsec数字证书认证典型配置举例

本章节下载  (315.85 KB)

docurl=/cn/Service/Document_Software/Document_Center/Home/Routers/00-Public/Configure/Typical_Configuration_Example/H3C_MSR_R6728-10884/99/202305/1843919_30005_0.htm

64-H3C MSR系列路由器 IPsec数字证书认证典型配置举例

H3C MSR系列路由器

IPsec数字证书认证配置举例

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Copyright © 2022-2023 新华三技术有限公司 版权所有,保留一切权利。

非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部,并不得以任何形式传播。

除新华三技术有限公司的商标外,本手册中出现的其它公司的商标、产品标识及商品名称,由各自权利人拥有。

本文档中的信息可能变动,恕不另行通知。



1  简介

本文档介绍H3C MSR系列路由器IPsec数字证书认证典型配置举例。

2  配置前提

本文档适用于使用Comware V7软件版本的MSR系列路由器,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。

本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。

本文档假设您已了解IPsec、IKE和IKEv2特性。

3  IKE野蛮模式及RSA数字签名认证配置举例

说明

设备运行于FIPS模式时,不支持本例。

 

3.1  组网需求

在Device A和Device B之间建立一个IPsec隧道,对Host A所在的子网(10.1.1.0/24)与Host B所在的子网(10.1.2.0/24)之间的数据流进行安全保护。

·     Device A和Device B之间采用IKE协商方式建立IPsec SA。

·     Device A和DeviceB均使用RSA数字签名的认证方法。

·     IKE第一阶段的协商模式为野蛮模式。

·     Device A侧子网的IP地址为动态分配,并作为发起方。

图1 IKE野蛮模式及RSA数字签名认证典型组网图

 

3.2  配置步骤

说明

在开始下面的配置之前,假设已完成如下配置:

·     DeviceA和DeviceB已获取到CA证书ca.cer和服务器证书server.pfx。

 

3.2.1  配置Device A

# 配置各接口的IP地址,具体略。

# 配置IPv4高级ACL 3101,定义要保护由子网10.1.1.0/24去往子网10.1.2.0/24的数据流。

<DeviceA> system-view

[DeviceA] acl advanced 3101

[DeviceA-acl-ipv4-adv-3101] rule permit ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255

[DeviceA-acl-ipv4-adv-3101] quit

# 创建IPsec安全提议tran1。

[DeviceA] ipsec transform-set tran1

# 配置安全协议对IP报文的封装形式为隧道模式。

[DeviceA-ipsec-transform-set-tran1] encapsulation-mode tunnel

# 配置采用的安全协议为ESP。

[DeviceA-ipsec-transform-set-tran1] protocol esp

# 配置ESP协议采用的加密算法为DES,认证算法为HMAC-SHA1。

[DeviceA-ipsec-transform-set-tran1] esp encryption-algorithm des-cbc

[DeviceA-ipsec-transform-set-tran1] esp authentication-algorithm sha1

[DeviceA-ipsec-transform-set-tran1] quit

# 创建PKI实体entity1。

[DeviceA] pki entity entity1

# 配置PKI实体的通用名。

[DeviceA-pki-entity-entity1] common-name devicea

[DeviceA-pki-entity-entity1] quit

# 配置PKI域domain1。

<DeviceA> system-view

[DeviceA] pki domain domain1

[DeviceA-pki-domain-domain1] public-key rsa general name rsa1

[DeviceA-pki-domain-domain1] undo crl check enable

[DeviceA-pki-domain-domain1] quit

# 导入CA证书ca.cer和服务器证书server.pfx。

[DeviceA] pki import domain domain1 der ca filename ca.cer

[DeviceA] pki import domain domain1 p12 local filename server.pfx

# 配置证书访问策略policy1。

<DeviceA> system-view

[DeviceA] pki certificate access-control-policy policy1

[DeviceA-pki-cert-acp-policy1] rule 1 permit group1

# 配置证书属性规则。

[DeviceA] pki certificate attribute-group group1

[DeviceA-pki-cert-attribute-group-group1] attribute 1 subject-name dn ctn 1

对端证书subject-name DN中需包含(ctn)规则中定义的字符串才被认为是有效的证书。本例使用的证书subject-name DN中包含字符“1”,因此在这里使用参数ctn 1。

# 创建IKE profile,名称为profile1。

[DeviceA] ike profile profile1

# 指定引用的PKI域为domain1。

[DeviceA-ike-profile-profile1] certificate domain domain1

# 配置第一阶段的协商模式为野蛮模式。

[DeviceA-ike-profile-profile1] exchange-mode aggressive

# 配置使用本端数字证书中获得的DN名作为本端身份标识。

[DeviceA-ike-profile-profile1] local-identity dn

# 配置匹配对端身份规则为对端数字证书中的DN名。

[DeviceA-ike-profile-profile1] match remote certificate policy1

[DeviceA-ike-profile-profile1] quit

# 创建IKE提议10。

[DeviceA] ike proposal 10

# 指定IKE提议使用的认证算法为HMAC-MD5。

[DeviceA-ike-proposal-10] authentication-algorithm md5

# 指定使用RSA数字签名认证方法。

[DeviceA-ike-proposal-10] authentication-method rsa-signature

[DeviceA-ike-proposal-10] quit

# 创建一条IKE协商方式的IPsec安全策略,名称为map1,顺序号为10。

[DeviceA] ipsec policy map1 10 isakmp

# 配置IPsec隧道的对端IP地址为2.2.2.2。

[DeviceA-ipsec-policy-isakmp-map1-10] remote-address 2.2.2.2

# 指定引用的安全提议为tran1。

[DeviceA-ipsec-policy-isakmp-map1-10] transform-set tran1

# 指定引用ACL 3101。

[DeviceA-ipsec-policy-isakmp-map1-10] security acl 3101

# 指定引用的IKE profile为profile1。

[DeviceA-ipsec-policy-isakmp-map1-10] ike-profile profile1

[DeviceA-ipsec-policy-isakmp-map1-10] quit

# 在接口GigabitEthernet1/0/1上应用IPsec安全策略map1。

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ipsec apply policy map1

[DeviceA-GigabitEthernet1/0/1] quit

# 配置到Host B所在子网的静态路由。1.1.1.2为本例中的直连下一跳地址,实际使用中请以具体组网情况为准。

[DeviceA] ip route-static 10.1.2.0 255.255.255.0 1.1.1.2

3.2.2  配置Device B

# 配置各接口的IP地址,具体略。

# 配置IPv4高级ACL 3101,定义要保护由子网10.1.2.0/24去往子网10.1.1.0/24的数据流。

<DeviceB> system-view

[DeviceB] acl advanced 3101

[DeviceB-acl-ipv4-adv-3101] rule permit ip source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255

[DeviceB-acl-ipv4-adv-3101] quit

# 创建IPsec安全提议tran1。

[DeviceB] ipsec transform-set tran1

# 配置安全协议对IP报文的封装形式为隧道模式。

[DeviceB-ipsec-transform-set-tran1] encapsulation-mode tunnel

# 配置采用的安全协议为ESP。

[DeviceB-ipsec-transform-set-tran1] protocol esp

# 配置ESP协议采用的加密算法为DES,认证算法为HMAC-SHA1。

[DeviceB-ipsec-transform-set-tran1] esp encryption-algorithm des-cbc

[DeviceB-ipsec-transform-set-tran1] esp authentication-algorithm sha1

[DeviceB-ipsec-transform-set-tran1] quit

# 创建PKI实体entity2。

[DeviceB] pki entity entity2

# 配置PKI实体的通用名。

[DeviceB-pki-entity-entity2] common-name deviceb

[DeviceB-pki-entity-entity2] quit

# 配置PKI域domain2。

<DeviceB> system-view

[DeviceB] pki domain domain2

[DeviceB-pki-domain-domain2] public-key rsa general name rsa1

[DeviceB-pki-domain-domain2] undo crl check enable

[DeviceB-pki-domain-domain2] quit

# 导入CA证书ca.cer和服务器证书server.pfx。

[DeviceB] pki import domain domain2 der ca filename ca.cer

[DeviceB] pki import domain domain2 p12 local filename server.pfx

# 配置证书访问策略policy1。

<DeviceB> system-view

[DeviceB] pki certificate access-control-policy policy1

[DeviceB-pki-cert-acp-policy1] rule 1 permit group1

# 配置证书属性规则。

[DeviceB] pki certificate attribute-group group1

[DeviceB-pki-cert-attribute-group-group1] attribute 1 subject-name dn ctn 1

对端证书subject-name DN中需包含(ctn)规则中定义的字符串才被认为是有效的证书。本例使用的证书subject-name DN中包含字符“1”,因此在这里使用参数ctn 1。

# 创建IKE profile,名称为profile2。

[DeviceB] ike profile profile2

# 指定引用的PKI域为domain2。

[DeviceB-ike-profile-profile2] certificate domain domain2

# 配置第一阶段的协商模式为野蛮模式。

[DeviceB-ike-profile-profile2] exchange-mode aggressive

# 配置使用本端数字证书中获得的DN名作为本端身份标识。

[DeviceB-ike-profile-profile2] local-identity dn

# 配置匹配对端身份规则为对端数字证书中的DN名。

[DeviceB-ike-profile-profile2] match remote certificate policy1

[DeviceB-ike-profile-profile2] quit

# 创建IKE提议10。

[DeviceB] ike proposal 10

# 指定IKE提议使用的认证算法为HMAC-MD5。

[DeviceB-ike-proposal-10] authentication-algorithm md5

# 指定使用RSA数字签名认证方法。

[DeviceB-ike-proposal-10] authentication-method rsa-signature

[DeviceB-ike-proposal-10] quit

# 创建一条IPsec安全策略模板,名称为template1,顺序号为1。

[DeviceB] ipsec policy-template template1 1

# 指定引用的安全提议为tran1。

[DeviceB-ipsec-policy-template-template1-1] transform-set tran1

# 指定引用ACL 3101。

[DeviceB-ipsec-policy-template-template1-1] security acl 3101

# 指定引用的IKE profile为profile2。

[DeviceB-ipsec-policy-template-template1-1] ike-profile profile2

[DeviceB-ipsec-policy-template-template1-1] quit

# 引用IPsec安全策略模板创建一条IPsec安全策略,名称为use1,顺序号为1。

[DeviceB] ipsec policy use1 1 isakmp template template1

# 在接口GigabitEthernet1/0/1上应用IPsec安全策略use1。

[DeviceB] interface gigabitethernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] ipsec apply policy use1

[DeviceB-GigabitEthernet1/0/1] quit

# 配置到Host A所在子网的静态路由。2.2.2.1为本例中的直连下一跳地址,实际使用中请以具体组网情况为准。

[DeviceB] ip route-static 10.1.1.0 255.255.255.0 2.2.2.1

3.3  验证配置

以上配置完成后,Device A和Device B之间如果有子网10.1.1.0/24与子网10.1.2.0/24之间的报文通过,将触发IKE协商。

# 可通过如下显示信息查看到Device A和Device B上的IKE提议。

[DeviceA] display ike proposal

 Priority Authentication Authentication Encryption  Diffie-Hellman Duration

              method       algorithm    algorithm       group      (seconds)

----------------------------------------------------------------------------

 10       RSA-SIG            MD5        DES-CBC     Group 1        86400

 default  PRE-SHARED-KEY     SHA1       DES-CBC     Group 1        86400

 

[DeviceB] display ike proposal

 Priority Authentication Authentication Encryption  Diffie-Hellman Duration

              method       algorithm    algorithm       group      (seconds)

----------------------------------------------------------------------------

 10       RSA-SIG            MD5        DES-CBC     Group 1        86400

 default  PRE-SHARED-KEY     SHA1       DES-CBC     Group 1        86400

# 可通过如下显示信息查看到Device A上IKE第一阶段协商成功后生成的IKE SA。

[DeviceA] display ike sa

    Connection-ID   Remote                Flag         DOI

------------------------------------------------------------------

    1               2.2.2.2               RD           IPsec

Flags:

RD--READY RL--REPLACED FD-FADING RK-REKEY

# 可通过如下显示信息查看到Device A上IKE第二阶段协商生成的IPsec SA。

[DeviceA] display ipsec sa

-------------------------------

Interface: GigabitEthernet1/0/1

-------------------------------

 

  -----------------------------

  IPsec policy: map1

  Sequence number: 10

  Mode: ISAKMP

  -----------------------------

    Tunnel id: 0

    Encapsulation mode: tunnel

    Perfect Forward Secrecy:

    Inside VPN:

    Extended Sequence Numbers enable: N

    Traffic Flow Confidentiality enable: N

    Path MTU: 1456

    Tunnel:

        local  address: 1.1.1.1

        remote address: 2.2.2.2

    Flow:

        sour addr: 10.1.1.0/255.255.255.0  port: 0  protocol: ip

        dest addr: 10.1.2.0/255.255.255.0  port: 0  protocol: ip

    [Inbound ESP SAs]

      SPI: 3264152513 (0xc28f03c1)

      Connection ID: 90194313219

      Transform set: ESP-ENCRYPT-DES-CBC ESP-AUTH-SHA1

      SA duration (kilobytes/sec): 1843200/3600

      SA remaining duration (kilobytes/sec): 1843200/3484

      Max received sequence-number:

      Anti-replay check enable: Y

      Anti-replay window size: 64

      UDP encapsulation used for NAT traversal: N

      Status: Active

 

    [Outbound ESP SAs]

      SPI: 738451674 (0x2c03e0da)

      Connection ID: 64424509441

      Transform set: ESP-ENCRYPT-DES-CBC ESP-AUTH-SHA1

      SA duration (kilobytes/sec): 1843200/3600

      SA remaining duration (kilobytes/sec): 1843200/3484

      Max sent sequence-number:

      UDP encapsulation used for NAT traversal: N

      Status: Active

Device B上也会产生相应的IKE SA和IPsec SA,查看方式与Device A同,此处略。

4  IKE国密主模式及SM2-DE数字信封认证配置举例

4.1  组网需求

在Device A和Device B之间建立一个IPsec隧道,对Host A所在的子网(10.1.1.0/24)与Host B所在的子网(10.1.2.0/24)之间的数据流进行安全保护。

·     Device A和Device B之间采用IKE协商方式建立IPsec SA。

·     Device A和DeviceB均使用SM2-DE数字信封的认证方法。

·     IKE第一阶段的协商模式为国密主模式。

图2 IKE国密主模式及SM2-DE数字信封认证配置组网图

 

4.2  配置步骤

说明

在开始下面的配置之前,假设已完成如下配置:

·     DeviceA和DeviceB已获取到CA证书ca.cer和服务器证书server.pfx。

 

4.2.1  配置Device A

# 配置各接口的IP地址,具体略。

# 配置IPv4高级ACL 3101,定义要保护由子网10.1.1.0/24去子网10.1.2.0/24的数据流。

<DeviceA> system-view

[DeviceA] acl advanced 3101

[DeviceA-acl-ipv4-adv-3101] rule permit ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255

[DeviceA-acl-ipv4-adv-3101] quit

# 创建IPsec安全提议tran1。

[DeviceA] ipsec transform-set tran1

# 配置安全协议对IP报文的封装形式为隧道模式。

[DeviceA-ipsec-transform-set-tran1] encapsulation-mode tunnel

# 配置采用的安全协议为ESP。

[DeviceA-ipsec-transform-set-tran1] protocol esp

# 配置ESP协议采用的加密算法为SM4-CBC,认证算法为SM3。

[DeviceA-ipsec-transform-set-tran1] esp encryption-algorithm sm4-cbc

[DeviceA-ipsec-transform-set-tran1] esp authentication-algorithm sm3

[DeviceA-ipsec-transform-set-tran1] quit

# 创建PKI实体entity1。

[DeviceA] pki entity entity1

# 配置PKI实体的通用名。

[DeviceA-pki-entity-entity1] common-name devicea

[DeviceA-pki-entity-entity1] quit

# 配置PKI域domain1。

<DeviceA> system-view

[DeviceA] pki domain domain1

[DeviceA-pki-domain-domain1] public-key sm2 general name sm2-1

[DeviceA-pki-domain-domain1] undo crl check enable

[DeviceA-pki-domain-domain1] quit

# 导入CA证书ca.cer和服务器证书server.pfx。

[DeviceA] pki import domain domain1 der ca filename ca.cer

[DeviceA] pki import domain domain1 p12 local filename server.pfx

# 创建IKE提议10。

[DeviceA] ike proposal 10

# 指定IKE提议使用的认证方法为SM2-DE。

[DeviceA-ike-proposal-10] authentication-method sm2-de

# 指定IKE提议使用的认证算法为SM3

[DeviceA-ike-proposal-10] authentication-algorithm sm3

# 指定IKE提议使用的加密算法为SM4-CBC

[DeviceA-ike-proposal-10] encryption-algorithm sm4-cbc

[DeviceA-ike-proposal-10] quit

# 创建IKE profile,名称为profile1。

[DeviceA] ike profile profile1

# 配置第一阶段的协商模式为国密主模式。

[DeviceA-ike-profile-profile1] exchange-mode gm-main

# 配置IKE协商采用SM2-DE数字信封认证时使用的PKI域为domain1。

[DeviceA-ike-profile-profile1] certificate domain domain1

# 配置引用序号为10的IKE安全提议。

[DeviceA-ike-profile-profile1] proposal 10

# 配置本端的身份信息为IP地址1.1.1.1。

[DeviceA-ike-profile-profile1] local-identity address 1.1.1.1

# 配置匹配对端身份的规则为IP地址2.2.2.2/16。

[DeviceA-ike-profile-profile1] match remote identity address 2.2.2.2 255.255.0.0

[DeviceA-ike-profile-profile1] quit

# 创建一条IKE协商方式的IPsec安全策略,名称为map1,顺序号为10。

[DeviceA] ipsec policy map1 10 isakmp

# 配置IPsec隧道的对端IP地址为2.2.2.2。

[DeviceA-ipsec-policy-isakmp-map1-10] remote-address 2.2.2.2

# 指定引用ACL 3101。

[DeviceA-ipsec-policy-isakmp-map1-10] security acl 3101

# 指定引用的安全提议为tran1。

[DeviceA-ipsec-policy-isakmp-map1-10] transform-set tran1

# 指定引用的IKE profile为profile1。

[DeviceA-ipsec-policy-isakmp-map1-10] ike-profile profile1

[DeviceA-ipsec-policy-isakmp-map1-10] quit

# 在接口GigabitEthernet1/0/1上应用IPsec安全策略map1。

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ipsec apply policy map1

[DeviceA-GigabitEthernet1/0/1] quit

# 配置到Host B所在子网的静态路由。1.1.1.2为本例中的直连下一跳地址,实际使用中请以具体组网情况为准。

[DeviceA] ip route-static 10.1.2.0 255.255.255.0 1.1.1.2

4.2.2  配置Device B

# 配置各接口的IP地址,具体略。

# 配置IPv4高级ACL 3101,定义要保护由子网10.1.2.0/24去往子网10.1.1.0/24的数据流。

<DeviceB> system-view

[DeviceB] acl advanced 3101

[DeviceB-acl-ipv4-adv-3101] rule permit ip source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255

[DeviceB-acl-ipv4-adv-3101] quit

# 创建IPsec安全提议tran1。

[DeviceB] ipsec transform-set tran1

# 配置安全协议对IP报文的封装形式为隧道模式。

[DeviceB-ipsec-transform-set-tran1] encapsulation-mode tunnel

# 配置采用的安全协议为ESP。

[DeviceB-ipsec-transform-set-tran1] protocol esp

# 配置ESP协议采用的加密算法为SM4-CBC,认证算法为SM3。

[DeviceB-ipsec-transform-set-tran1] esp encryption-algorithm sm4-cbc

[DeviceB-ipsec-transform-set-tran1] esp authentication-algorithm sm3

[DeviceB-ipsec-transform-set-tran1] quit

# 创建PKI实体entity2。

[DeviceB] pki entity entity2

# 配置PKI实体的通用名。

[DeviceB-pki-entity-entity2] common-name deviceb

[DeviceB-pki-entity-entity2] quit

# 配置PKI域domain2。

<DeviceB> system-view

[DeviceB] pki domain domain2

[DeviceB-pki-domain-domain2] public-key sm2 general name sm2-1

[DeviceB-pki-domain-domain2] undo crl check enable

[DeviceB-pki-domain-domain2] quit

# 导入CA证书ca.cer和服务器证书server.pfx。

[DeviceB] pki import domain domain2 der ca filename ca.cer

[DeviceB] pki import domain domain2 p12 local filename server.pfx

# 创建IKE提议10。

[DeviceB] ike proposal 10

# 指定IKE提议使用的认证方法为SM2-DE。

[DeviceB-ike-proposal-10] authentication-method sm2-de

# 指定IKE提议使用的认证算法为SM3

[DeviceB-ike-proposal-10] authentication-algorithm sm3

# 指定IKE提议使用的加密算法为SM4-CBC

[DeviceB-ike-proposal-10] encryption-algorithm sm4-cbc

[DeviceB-ike-proposal-10] quit

# 创建IKE profile,名称为profile1。

[DeviceB] ike profile profile1

# 配置第一阶段的协商模式为国密主模式。

[DeviceB-ike-profile-profile1] exchange-mode gm-main

# 配置IKE协商采用SM2-DE数字信封认证时使用的PKI域为domain2。

[DeviceB-ike-profile-profile1] certificate domain domain2

# 配置引用序号为10的IKE安全提议。

[DeviceB-ike-profile-profile1] proposal 10

# 配置本端的身份信息为IP地址2.2.2.2。

[DeviceB-ike-profile-profile1] local-identity address 2.2.2.2

# 配置匹配对端身份的规则为IP地址1.1.1.1/16。

[DeviceB-ike-profile-profile1] match remote identity address 1.1.1.1 255.255.0.0

[DeviceB-ike-profile-profile1] quit

# 创建一条IKE协商方式的IPsec安全策略,名称为use1,顺序号为10。

[DeviceB] ipsec policy use1 10 isakmp

# 配置IPsec隧道的对端IP地址为1.1.1.1。

[DeviceB-ipsec-policy-isakmp-use1-10] remote-address 1.1.1.1

# 指定引用ACL 3101。

[DeviceB-ipsec-policy-isakmp-use1-10] security acl 3101

# 指定引用的安全提议为tran1。

[DeviceB-ipsec-policy-isakmp-use1-10] transform-set tran1

# 指定引用的IKE profile为profile1。

[DeviceB-ipsec-policy-isakmp-use1-10] ike-profile profile1

[DeviceB-ipsec-policy-isakmp-use1-10] quit

# 在接口GigabitEthernet1/0/1上应用IPsec安全策略use1。

[DeviceB] interface gigabitethernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] ipsec apply policy use1

# 配置到Host A所在子网的静态路由。2.2.2.1为本例中的直连下一跳地址,实际使用中请以具体组网情况为准。

[DeviceB] ip route-static 10.1.1.0 255.255.255.0 2.2.2.1

4.3  验证配置

以上配置完成后,Device A和Device B之间如果有子网10.1.1.0/24与子网10.1.2.0/24之间的报文通过,将触发IKE协商。

# 可通过如下显示信息查看到Device A和Device B上的IKE提议。

[DeviceA] display ike proposal

 Priority Authentication Authentication Encryption  Diffie-Hellman Duration

              method       algorithm    algorithm       group      (seconds)

----------------------------------------------------------------------------

10       SM2-DE             SM3         SM4-CBC         Group 1       86400

default  PRE-SHARED-KEY     SHA1        DES-CBC         Group 1       86400

 

[DeviceB] display ike proposal

 Priority Authentication Authentication Encryption  Diffie-Hellman Duration

              method       algorithm    algorithm       group      (seconds)

----------------------------------------------------------------------------

10       SM2-DE             SM3         SM4-CBC         Group 1       86400

default  PRE-SHARED-KEY     SHA1        DES-CBC         Group 1       86400

# 可通过如下显示信息查看到Device A上IKE第一阶段协商成功后生成的IKE SA。

[DeviceA] display ike sa

    Connection-ID   Remote                Flag         DOI

------------------------------------------------------------------

    1               2.2.2.2               RD           IPsec

Flags:

RD--READY RL--REPLACED FD-FADING RK-REKEY

# 可通过如下显示信息查看到IKE第二阶段协商生成的IPsec SA。

[DeviceA] display ipsec sa

-------------------------------

Interface: GigabitEthernet1/0/1

-------------------------------

 

  -----------------------------

  IPsec policy: map1

  Sequence number: 10

  Mode: ISAKMP

  -----------------------------

    Tunnel id: 0

    Encapsulation mode: tunnel

    Perfect Forward Secrecy:

    Inside VPN:

    Extended Sequence Numbers enable: N

    Traffic Flow Confidentiality enable: N

    Path MTU: 1456

    Tunnel:

        local  address: 1.1.1.1

        remote address: 2.2.2.2

    Flow:

        sour addr: 10.1.1.0/255.255.255.0  port: 0  protocol: ip

        dest addr: 10.1.2.0/255.255.255.0  port: 0  protocol: ip

 

    [Inbound ESP SAs]

      SPI: 1451246811 (0x568044db)

      Connection ID: 90194313219

      Transform set: ESP-ENCRYPT-SM4-CBC ESP-AUTH-SM3

      SA duration (kilobytes/sec): 1843200/3600

      SA remaining duration (kilobytes/sec): 1843200/3484

      Max received sequence-number:

      Anti-replay check enable: Y

      Anti-replay window size: 64

      UDP encapsulation used for NAT traversal: N

      Status: Active

 

    [Outbound ESP SAs]

      SPI: 2692887942 (0xa0823586)

      Connection ID: 64424509441

      Transform set: ESP-ENCRYPT-SM4-CBC ESP-AUTH-SM3

      SA duration (kilobytes/sec): 1843200/3600

      SA remaining duration (kilobytes/sec): 1843200/3484

      Max sent sequence-number:

      UDP encapsulation used for NAT traversal: N

      Status: Active

# Device B上也会产生相应的IKE SA和IPsec SA,查看方式与Device A同,此处略。

5  IKEv2 RSA数字签名认证配置举例

5.1  组网需求

在Device A和Device B之间建立IPsec隧道,对Host A所在的子网(10.1.1.0/24)与Host B所在的子网(10.1.2.0/24)之间的数据流进行安全保护。

·     Device A和Device B之间采用IKEv2协商方式建立IPsec SA。

·     Device A和DeviceB均使用RSA数字签名的认证方法。

·     Device A侧子网的IP地址为动态分配,并作为发起方。

图3 IKEv2 RSA数字签名认证典型组网图

 

5.2  配置步骤

说明

在开始下面的配置之前,假设已完成如下配置:

·     DeviceA和DeviceB已获取到CA证书ca.cer和服务器证书server.pfx。

 

5.2.1  配置Device A

# 配置各接口的IP地址,具体略。

# 配置ACL 3101,定义要保护由子网10.1.1.0/24去往子网10.1.2.0/24的数据流。

<DeviceA> system-view

[DeviceA] acl advanced 3101

[DeviceA-acl-ipv4-adv-3101] rule permit ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255

[DeviceA-acl-ipv4-adv-3101] quit

# 创建IPsec安全提议tran1。

[DeviceA] ipsec transform-set tran1

# 配置安全协议对IP报文的封装形式为隧道模式。

[DeviceA-ipsec-transform-set-tran1] encapsulation-mode tunnel

# 配置采用的安全协议为ESP。

[DeviceA-ipsec-transform-set-tran1] protocol esp

# 配置ESP协议采用的加密算法为DES,认证算法为HMAC-SHA1。

[DeviceA-ipsec-transform-set-tran1] esp encryption-algorithm des-cbc

[DeviceA-ipsec-transform-set-tran1] esp authentication-algorithm sha1

[DeviceA-ipsec-transform-set-tran1] quit

# 创建PKI实体entity1。

[DeviceA] pki entity entity1

# 配置PKI实体的通用名。

[DeviceA-pki-entity-entity1] common-name devicea

[DeviceA-pki-entity-entity1] quit

# 配置PKI域domain1。

<DeviceA> system-view

[DeviceA] pki domain domain1

[DeviceA-pki-domain-domain1] public-key rsa general name rsa1

[DeviceA-pki-domain-domain1] undo crl check enable

[DeviceA-pki-domain-domain1] quit

# 导入CA证书ca.cer和服务器证书server.pfx。

[DeviceA] pki import domain domain1 der ca filename ca.cer

[DeviceA] pki import domain domain1 p12 local filename server.pfx

# 配置证书访问策略policy1。

<DeviceA> system-view

[DeviceA] pki certificate access-control-policy policy1

[DeviceA-pki-cert-acp-policy1] rule 1 permit group1

# 配置证书属性规则。

[DeviceA] pki certificate attribute-group group1

[DeviceA-pki-cert-attribute-group-group1] attribute 1 subject-name dn ctn 1

对端证书subject-name DN中需包含(ctn)规则中定义的字符串才被认为是有效的证书。本例使用的证书subject-name DN中包含字符“1”,因此在这里使用参数ctn 1。

# 创建IKEv2 profile,名称为profile1。

[DeviceA] ikev2 profile profile1

# 指定本端的身份认证方式为RSA数字签名。

[DeviceA-ikev2-profile-profile1] authentication-method local rsa-signature

# 指定对端的身份认证方式为RSA数字签名。

[DeviceA-ikev2-profile-profile1] authentication-method remote rsa-signature

# 指定引用的PKI域为domain1。

[DeviceA-ikev2-profile-profile1] certificate domain domain1

# 配置使用本端数字证书中获得的DN名作为本端身份标识。

[DeviceA-ikev2-profile-profile1] identity local dn

# 配置匹配对端身份规则为对端数字证书中的DN名。

[DeviceA-ikev2-profile-profile1] match remote certificate policy1

[DeviceA-ikev2-profile-profile1] quit

# 创建IKEv2提议10。

[DeviceA] ikev2 proposal 10

# 指定IKEv2提议使用的完整性校验算法为HMAC-MD5。

[DeviceA-ikev2-proposal-10] integrity md5

# 指定IKEv2提议使用的加密算法为3DES。

[DeviceA-ikev2-proposal-10] encryption 3des-cbc

# 指定IKEv2提议使用的DH group为group1。

[DeviceA-ikev2-proposal-10] dh group1

# 指定IKEv2提议使用的PRF算法为HMAC-MD5。

[DeviceA-ikev2-proposal-10] prf md5

[DeviceA-ikev2-proposal-10] quit

# 创建IKEv2安全策略1。

[DeviceA] ikev2 policy 1

# 指定引用的IKEv2 proposal 10。

[DeviceA-ikev2-policy-1] proposal 10

[DeviceA-ikev2-policy-1] quit

# 创建一条IKEv2协商方式的IPsec安全策略,名称为map1,顺序号为10。

[DeviceA] ipsec policy map1 10 isakmp

# 配置IPsec隧道的对端IP地址为2.2.2.2。

[DeviceA-ipsec-policy-isakmp-map1-10] remote-address 2.2.2.2

# 指定引用的安全提议为tran1。

[DeviceA-ipsec-policy-isakmp-map1-10] transform-set tran1

# 指定引用ACL 3101。

[DeviceA-ipsec-policy-isakmp-map1-10] security acl 3101

# 指定引用的IKEv2 profile为profile1。

[DeviceA-ipsec-policy-isakmp-map1-10] ikev2-profile profile1

[DeviceA-ipsec-policy-isakmp-map1-10] quit

# 在接口GigabitEthernet1/0/1上应用IPsec安全策略map1。

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ipsec apply policy map1

[DeviceA-GigabitEthernet1/0/1] quit

# 配置到Host B所在子网的静态路由。1.1.1.2为本例中的直连下一跳地址,实际使用中请以具体组网情况为准。

[DeviceA] ip route-static 10.1.2.0 255.255.255.0 1.1.1.2

5.2.2  配置Device B

# 配置各接口的IP地址,具体略。

# 配置ACL 3101,定义要保护由子网10.1.2.0/24去子网10.1.1.0/24的数据流。

[DeviceB] acl advanced 3101

[DeviceB-acl-ipv4-adv-3101] rule permit ip source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255

[DeviceB-acl-ipv4-adv-3101] quit

# 创建IPsec安全提议tran1。

[DeviceB] ipsec transform-set tran1

# 配置安全协议对IP报文的封装形式为隧道模式。

[DeviceB-ipsec-transform-set-tran1] encapsulation-mode tunnel

# 配置采用的安全协议为ESP。

[DeviceB-ipsec-transform-set-tran1] protocol esp

# 配置ESP协议采用的加密算法为DES,认证算法为HMAC-SHA-1-96。

[DeviceB-ipsec-transform-set-tran1] esp encryption-algorithm des-cbc

[DeviceB-ipsec-transform-set-tran1] esp authentication-algorithm sha1

[DeviceB-ipsec-transform-set-tran1] quit

# 创建PKI实体entity2。

[DeviceB] pki entity entity2

# 配置PKI实体的通用名。

[DeviceB-pki-entity-entity2] common-name deviceb

[DeviceB-pki-entity-entity2] quit

# 配置PKI域domain2。

<DeviceB> system-view

[DeviceB] pki domain domain2

[DeviceB-pki-domain-domain2] public-key rsa general name rsa1

[DeviceB-pki-domain-domain2] undo crl check enable

[DeviceB-pki-domain-domain2] quit

# 导入CA证书ca.cer和服务器证书server.pfx。

[DeviceB] pki import domain domain2 der ca filename ca.cer

[DeviceB] pki import domain domain2 p12 local filename server.pfx

# 配置证书访问策略policy1。

<DeviceB> system-view

[DeviceB] pki certificate access-control-policy policy1

[DeviceB-pki-cert-acp-policy1] rule 1 permit group1

# 配置证书属性规则。

[DeviceB] pki certificate attribute-group group1

[DeviceB-pki-cert-attribute-group-group1] attribute 1 subject-name dn ctn 1

对端证书subject-name DN中需包含(ctn)规则中定义的字符串才被认为是有效的证书。本例使用的证书subject-name DN中包含字符“1”,因此在这里使用参数ctn 1。

# 创建IKEv2 profile,名称为profile2。

[DeviceB] ikev2 profile profile2

# 指定本端的身份认证方式为RSA数字签名。

[DeviceB-ikev2-profile-profile2] authentication-method local rsa-signature

# 指定对端的身份认证方式为RSA数字签名。

[DeviceB-ikev2-profile-profile2] authentication-method remote rsa-signature

# 配置使用本端数字证书中获得的DN名作为本端身份标识。

[DeviceB-ikev2-profile-profile2] identity local dn

# 配置匹配对端身份规则为对端数字证书中的DN名。

[DeviceB-ikev2-profile-profile2] match remote certificate policy1

[DeviceB-ikev2-profile-profile2] quit

# 创建IKEv2提议10。

[DeviceB] ikev2 proposal 10

# 指定IKEv2提议使用的完整性校验算法为HMAC-MD5。

[DeviceB-ikev2-proposal-10] integrity md5

# 指定IKEv2提议使用的加密算法为3DES。

[DeviceB-ikev2-proposal-10] encryption 3des-cbc

# 指定IKEv2提议使用的DH group为group1。

[DeviceB-ikev2-proposal-10] dh group1

# 指定IKEv2提议使用的PRF算法为HMAC-MD5。

[DeviceB-ikev2-proposal-10] prf md5

[DeviceB-ikev2-proposal-10] quit

# 创建IKEv2安全策略1。

[DeviceB] ikev2 policy 1

# 指定引用的IKEv2 proposal 10。

[DeviceB-ikev2-policy-1] proposal 10

[DeviceB-ikev2-policy-1] quit

# 创建一条IPsec安全策略模板,名称为template1,顺序号为1。

[DeviceB] ipsec policy-template template1 1

# 配置IPsec隧道的对端IP地址为1.1.1.1。

[DeviceB-ipsec-policy-template-template1-1] remote-address 1.1.1.1

# 指定引用ACL 3101。

[DeviceB-ipsec-policy-template-template1-1] security acl 3101

# 指定引用的安全提议为tran1。

[DeviceB-ipsec-policy-template-template1-1] transform-set tran1

# 指定引用的IKEv2 profile为profile2。

[DeviceB-ipsec-policy-template-template1-1] ikev2-profile profile2

[DeviceB-ipsec-policy-template-template1-1] quit

# 引用IPsec安全策略模板创建一条IPsec安全策略,名称为use1,顺序号为1。

[DeviceB] ipsec policy use1 1 isakmp template template1

# 在接口GigabitEthernet1/0/1上应用IPsec安全策略use1。

[DeviceB] interface gigabitethernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] ipsec apply policy use1

[DeviceB-GigabitEthernet1/0/1] quit

# 配置到Host A所在子网的静态路由。2.2.2.1为本例中的直连下一跳地址,实际使用中请以具体组网情况为准。

[DeviceB] ip route-static 10.1.1.0 255.255.255.0 2.2.2.1

5.3  验证配置

以上配置完成后,Device A和Device B之间如果有子网10.1.1.0/24与子网10.1.2.0/24之间的报文通过,将触发IKEv2协商。

# 可通过如下显示信息查看到Device A和Device B上的IKEv2提议。

[DeviceA] display ikev2 proposal 10

IKEv2 proposal : 10

  Encryption : 3DES-CBC

  Integrity : MD5

  PRF : MD5

  DH Group : MODP768/Group1

[DeviceB] display ikev2 proposal 10

IKEv2 proposal : 10

  Encryption : 3DES-CBC

  Integrity : MD5

  PRF : MD5

  DH Group : MODP768/Group1

# 可通过如下显示信息查看到Device A和Device B上的IKEv2安全策略。

[DeviceA] display ikev2 policy 1

IKEv2 policy : 1

  Priority: 100

  Match Local : any

  Match VRF : public

  Proposal : 10

[DeviceB] display ikev2 policy 1

IKEv2 policy : 1

  Priority: 100

  Match Local : any

  Match VRF : public

  Proposal : 10

# 可通过如下显示信息查看到Device A上IKEv2协商成功后生成的IKEv2 SA。

[DeviceA] display ikev2 sa

Tunnel ID   Local                       Remote                      Status

---------------------------------------------------------------------------

  1        1.1.1.1/500                  2.2.2.2/500                  EST

Status:

IN-NEGO: Negotiating, EST: Established, DEL:Deleting

# 可通过如下显示信息查看到Device A上IKEv2协商生成的IPsec SA。

[DeviceA] display ipsec sa

-------------------------------

Interface: GigabitEthernet1/0/1

-------------------------------

 

  -----------------------------

  IPsec policy: map1

  Sequence number: 10

  Mode: ISAKMP

  -----------------------------

    Tunnel id: 0

    Encapsulation mode: tunnel

    Perfect Forward Secrecy:

    Inside VPN:

    Extended Sequence Numbers enable: N

    Traffic Flow Confidentiality enable: N

    Path MTU: 1456

    Tunnel:

        local  address: 1.1.1.1

        remote address: 2.2.2.2

    Flow:

        sour addr: 10.1.1.0/255.255.255.0   port: 0  protocol: ip

        dest addr: 10.1.2.0/255.255.255.0  port: 0  protocol: ip

 

    [Inbound ESP SAs]

      SPI: 3264152513 (0xc28f03c1)

      Connection ID: 141733920771

      Transform set: ESP-ENCRYPT-DES-CBC ESP-AUTH-SHA1

      SA duration (kilobytes/sec): 1843200/3600

      SA remaining duration (kilobytes/sec): 1843200/3484

      Max received sequence-number:

      Anti-replay check enable: Y

      Anti-replay window size: 64

      UDP encapsulation used for NAT traversal: N

      Status: Active

 

    [Outbound ESP SAs]

      SPI: 738451674 (0x2c03e0da)

      Connection ID: 141733920770

      Transform set: ESP-ENCRYPT-DES-CBC ESP-AUTH-SHA1

      SA duration (kilobytes/sec): 1843200/3600

      SA remaining duration (kilobytes/sec): 1843200/3484

      Max sent sequence-number:

      UDP encapsulation used for NAT traversal: N

      Status: Active

Device B上也会产生相应的IKEv2 SA和IPsec SA,并自动获取CA证书,自动申请本地证书,查看方式与Device A同,此处略。

 

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们