华为技术和ipsec安全策略模拟实验配置步骤

描述

 

ACL

网段地址:
R1
G0/0/0 192.168.1.100 24
G0/0/1 200.1.13.1 24

R3
G0/0/0 200.1.13.2 24
G0/0/1 200.1.23.2 24

R2
G0/0/0 192.168.2.100 24
G0/0/1 200.1.23.1 24

PC1:192.168.1.1 24
PC2:192.168.2.1 24

第一步

配置Security ACL,用于匹配站点间通信网络之间的感兴趣流。
配置:

 

[R1-acl-adv-3000]rule 2 permit ip source 192.168.1.0 0.0.0.255 destination 192.168.2.0 0.0.0.255 

 

IPSec使用高级ACL定义需要保护的数据流。IPSec根据ACL的规则来确定哪些报文需要安全保护,哪些报文不需要安全保护。
在隧道发起端,匹配(permit)高级ACL的数据流将被保护,即经过IPSec加密处理后再发送;不能匹配高级ACL的数据流则直接转发。
在隧道接收端,对数据流进行解密,并检查解密后的数据流是否匹配了ACL规则,丢弃不匹配ACL规则的报文。

ACL配置原则

1.若不同的数据流需要采用不同的安全策略来保护,则需要为之创建不同的ACL。

2.若不同的数据流可以采用相同的安全策略来保护,则可以在一条ACL中配置多条rule来保护不同的数据流。但是ACL中序列号大的rule不能完全包含序列号小的rule 的内容。

3.IPSec两端ACL规则定义的协议类型要一致,如:一端使用IP协议,另一端也必须使用IP协议。

4.同一个安全策略组中配置的ACL不能包含相同的rule规则。采用IKEv2进行协商时,同一个安全策略组中所有安全策略的引用的ACL的rule之间不能存在交集。

5.建议IPSec隧道两端配置的ACL规则互为镜像,即一端ACL规则的源地址和目的地址分别为另一端ACL规则的目的地址和源地址。

第二步

配置IKE安全提议,决定处理IKE流量的安全机制(可选:可以采用默认
IKE安全提议)

IKE对等体通过IKE安全提议来协商建立IKE SA所需要的
加密算法、
认证方法、
认证算法、
Diffie-Hellman组标识
安全联盟生存周期

 

[R1]ike proposal 10 (创建IKE安全提议)
[R1-ike-proposal-10]authentication-algorithm ?(配置认证算法)
  aes-xcbc-mac-96  Select aes-xcbc-mac-96 as the hash algorithm
  md5              Select MD5 as the hash algorithm
  sha1             Select SHA as the hash algorithm
  sm3              Select sm3 as the hash algorithm
[R1-ike-proposal-10]authentication-algorithm md5 
[R1-ike-proposal-10]encryption-algorithm ?(配置加密算法)
  3des-cbc     168 bits 3DES-CBC
  aes-cbc-128  Use AES-128
  aes-cbc-192  Use AES-192
  aes-cbc-256  Use AES-256
  des-cbc      56 bits DES-CBC
[R1-ike-proposal-10]encryption-algorithm aes-cbc-128
[R1-ike-proposal-10]authentication-method ?(配置认证方法)
  digital-envelope  Select digital envelope  key as the authentication method
  pre-share         Select pre-shared key as the authentication method
  rsa-signature     Select rsa-signature key as the authentication method
[R1-ike-proposal-10]authentication-method  pre-share 
[R1-ike-proposal-10]dh ?(配置Diffie-Hellman组标识)
  group1   768 bits Diffie-Hellman group
  group14  2048 bits Diffie-Hellman group
  group2   1024 bits Diffie-Hellman group
  group5   1536 bits Diffie-Hellman group
[R1-ike-proposal-10]dh group2

 

可选:执行命令integrity-algorithm { aes-xcbc-96 | hmac-md5-96 | hmac-sha1-96 |
hmac-sha2-256 | hmac-sha2-384 | hmac-sha2-512 } 配置完整性算法。

 

[R1-ike-proposal-10]sa duration ? (配置IKE密钥有效期) 
  INTEGER<60-604800>  Value of time(in seconds), default is 86400
[R1-ike-proposal-10]sa duration  10000
配置完成:
[R1-ike-proposal-10]display  this 
[V200R003C00]
#
ike proposal 10
 encryption-algorithm aes-cbc-128
 dh group2
 authentication-algorithm md5
 sa duration 10000
#
return

 

display ike proposal
//查看IKE默认Proposal,如果没有特殊安全需求建议保
持默认的IKE Proposal

第三步

配置IKE对等体,
调用第二步配置的IKE安全提议,
选择IKE版本(version1/version 2),
配置IKE身份认证参数,
决定IKE version 1第一阶段的交换模式,
可以选择主模式或野蛮模式。

 

[R1]ike peer xwl ?  (配置 IKE peer 和 IKE版本号)
  v1    Only V1 SA's can be created
  v2    Only V2 SA's can be created
    Please press ENTER to execute command 
[R1]ike peer xwl v1

 

IKEv1要求两端配置的ACL规则互为镜像(IKE方式的IPSec安全策略)或发起方配置的ACL
规则为响应方的子集(模板方式的IPSec安全策略)。
IKEv2取双方ACL规则交集作为协商结果。

修改ACL时注意:
ACL参数的修改是实时生效的,修改后隧道立即被拆除,在下次进行隧道协商时使用新
的参数。

 

[R1-ike-peer-xwl]remote-address ?
  IP_ADDR  IP address
  STRING<1-254>     Host name
[R1-ike-peer-xwl]remote-address 200.1.23.1  (配置对端IP地址或地址段。)
[R1-ike-peer-xwl]pre-shared-key cipher huawei (配置身份认证参数)
[R1-ike-peer-xwl]ike-proposal 10(引用已配置的IKE安全提议。)
[R1-ike-peer-xwl]exchange-mode ?(配置模式为主模式或者野蛮模式)
  aggressive  Aggressive mode
  main        Main mode
[R1-ike-peer-xwl]exchange-mode main
[R1-ike-peer-xwl]peer-id-type ? (配置peer建立时ID的类型)
  ip    Select IP address as the peer ID
  name  Select name as the peer ID
配置完成
[R1-ike-peer-xwl]display this 
[V200R003C00]
#
ike peer xwl v1
 pre-shared-key cipher %$%$}H"z!S,^u*;l(AQmOU4+,.2n%$%$
 ike-proposal 10
remote-address 200.1.23.1
#
return

 

第四步

配置IPSec安全提议,配置处理实际感兴趣的安全机制,
包括封装模式,ESP的加密与验证算法,AH的验证算法。

如果只创建ipsec proposal ,则继承默认策略

 

[R1]ipsec proposal xwl (创建安全提议)
[R1-ipsec-proposal-xwl]encapsulation-mode ?(配置报文封装模式)
  transport  Only the payload of IP packet is protected(transport mode)
  tunnel     The entire IP packet is protected(tunnel mode)
[R1-ipsec-proposal-xwl]encapsulation-mode tunnel 
[R1-ipsec-proposal-xwl]esp authentication-algorithm ?(配置ESP方式采用的认证算法)
  md5       Use HMAC-MD5-96 algorithm
  sha1      Use HMAC-SHA1-96 algorithm
  sha2-256  Use SHA2-256 algorithm
  sha2-384  Use SHA2-384 algorithm
  sha2-512  Use SHA2-512 algorithm
  sm3       Use SM3 algorithm
[R1-ipsec-proposal-xwl]esp authentication-algorithm md5
[R1-ipsec-proposal-xwl]esp encryption-algorithm ?(配置ESP协议使用的加密算法)
  3des     Use 3DES
  aes-128  Use AES-128
  aes-192  Use AES-192
  aes-256  Use AES-256
  des      Use DES
  sm1      Use SM1
       Please press ENTER to execute command 
[R1-ipsec-proposal-xwl]esp encryption-algorithm aes-128
[R1-ipsec-proposal-xwl]transform ?(配置传送数据时采用的安全协议)
  ah      AH protocol defined in RFC2402
  ah-esp  ESP protocol first, then AH protocol
  esp     ESP protocol defined in RFC2406
[R1-ipsec-proposal-xwl]transform esp 
如果配置为ah  
[R1-ipsec-proposal-xwl]ah authentication-algorithm ?
  md5       Use HMAC-MD5-96 algorithm
  sha1      Use HMAC-SHA1-96 algorithm
  sha2-256  Use SHA2-256 algorithm
  sha2-384  Use SHA2-384 algorithm
  sha2-512  Use SHA2-512 algorithm
  sm3       Use SM3 algorithm
配置完成
[R1-ipsec-proposal-xwl]display this 
[V200R003C00]
#
ipsec proposal xwl
 esp encryption-algorithm aes-128
#
return

 

第五步

配置IPSec安全策略,
调用第一步配置的Security ACL;
第二步配置的IKE Peer;
第三步配置的IPSec安全提议。

模板方式的IPSec安全策略配置原则:
1.IPSec隧道只能有一端配置模板方式的IPSec安全策略,另一端必须配置IKE方式的
IPSec安全策略。
2.一个IPSec策略组中只能有一条安全策略引用安全策略模板,该策略的序号推荐比
其它策略的序号大,否则可能导致其它策略不生效。

3.IPSec安全策略模板中ACL、IPSec安全提议和IKE对等体为必选配置,而其它参数为
可选配置。

4.在IKE协商时,要求安全策略模板中定义的参数必须与对端匹配;安全策略模板中
没有定义的参数由发起方来决定,响应方接受发起方的建议。

5.一个安全策略模板可以引用多个IPSec安全提议,在响应不同对端发起的连接时匹
配不同的IPSec安全提议。

6.一个安全策略模板只能引用一条ACL,引用新的ACL时必须先取消引用原有ACL。
如果接口上应用了IPSec安全策略,则修改IPSec和IKE的各项参数时,需注意在修
改IPSec安全策略时可以直接新增或删除IPSec安全策略或者修改IPSec安全策略中
的各项配置。

对于模板方式建立的IPSec安全策略:
1.修改PFS参数在下次协商时生效,对已经协商起来的隧道不生效。
2. 除PFS外的其它参数只能先在接口上取消应用IPSec策略,再进行修改。
pfs 完美向前 第一个密钥失效后第二个密钥和第一个密钥是有关系的 设置了pfs后,这密钥之间没有关系

PFS(Perfect Forward Secrecy,完善的前向安全性)是一种安全特性,指一个密钥被破解,并不影响其他密钥的安全性,因为这些密钥间没有派生关系。此特性是通过在IKE阶段2的协商中增加密钥交换来实现的

 

[R1]ipsec policy xwl ?
  INTEGER<1-10000>  The sequence number of IPSec policy
  shared            Shared
[R1]ipsec policy xwl 10 ?
  isakmp  Indicates use IKE to establish the IPSec SA
  manual  Indicates use manual to establish the IPSec SA
      Please press ENTER to execute command 
[R1]ipsec policy xwl 10 isakmp 
[R1-ipsec-policy-isakmp-xwl-10]ike-peer xwl (调用第二步配置的IKE Peer)
[R1-ipsec-policy-isakmp-xwl-10]proposal xwl (调用第二步配置的IKE Peer)
[R1-ipsec-policy-isakmp-xwl-10]security acl 3000(调用第一步配置的Security ACL)
配置完成:
[R1-ipsec-policy-isakmp-xwl-10]display this 
[V200R003C00]
#
ipsec policy xwl 10 isakmp
 security acl 3000
 ike-peer xwl
 proposal xwl
#
Return

 

第六步

 

在接口上调用IPSec安全策略。
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ipsec policy xwl ?
    Please press ENTER to execute command 

 

配置完成后,需要流量进行激活隧道的建立

 

[R1]ip route-static 192.168.2.0 24 200.1.13.2
[R2]ip route-static 192.168.1.0 24 200.1.23.2

 

查看相关信息

ipsec第一阶段形成ike sa 的通道 使用的是udp 500的流量,源端口,目的端口都是500

ACL

Reset ike sa all 清除建立的SA 通道

PC1:

ACL

协商后的Iipsec proposal 参数

ACL

协商后的ike peer 参数

ACL

IKE第二阶段

ACL

IKE第一和第二阶段

ACL

  审核编辑:汤梓红
 
打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分