当前位置:   article > 正文

Ipsec vpn的原理及场景应用_ipsec感兴趣流

ipsec感兴趣流

1、安全协议

IPSec使用认证头AH(Authentication Header)和封装安全载荷ESP(Encapsulating Security Payload)两种安全协议来传输和封装数据,提供认证或加密等安全服务。

2、封装模式

封装模式是指将AH或ESP相关的字段插入到原始IP报文中,以实现对报文的认证和加密,封装模式有传输模式和隧道模式两种。

3、加密

加密是一种将数据按照某种算法从明文转换成密文的过程,接收方只有在拥有正确的密钥的情况下才能对密文进行解密,从而保证数据的机密性,防止数据在传输过程中被窃听。IPSec工作过程中涉及数据加密和协议消息加密两种加密情况。

4、验证

IPSec发送方,加密和验证通常配合使用。加密后的报文经HMAC生成数字签名,IP报文和数字签名同时发给对端(数字签名填写在AH和ESP报文头的完整性校验值ICV字段);

在IPSec接收方,通过比较数字签名进行数据完整性和真实性验证,验证不通过的报文直接丢弃,验证通过的报文再进行解密。加密和HMAC验证配合使用的过程如图所示。

5、IKE协议

因特网密钥交换IKE(Internet Key Exchange)协议建立在Internet安全联盟和密钥管理协议ISAKMP定义的框架上,是基于UDP(User Datagram Protocol)的应用层协议。它为IPSec提供了自动协商密钥、建立IPSec安全联盟的服务,能够简化IPSec的使用和管理,大大简化IPSec的配置和维护工作。

IKE的安全机制

           IKE具有一套自保护机制,可以在不安全的网络上安全地认证身份、分发密钥、建立IPsec SA

  • 身份认证:包括预共享密钥PSK(pre-shared key)认证、数字证书RSA(rsa-signature)认证和数字信封认证。

  • 身份保护:身份数据在密钥产生之后加密传送,实现了对身份数据的保护。

  • DH:DH是一种公共密钥交换方法,它用于产生密钥材料,并通过ISAKMP消息在发送和接收设备之间进行密钥材料交换。

  • PFS:完善的前向安全性PFS(Perfect Forward Secrecy)是一种安全特性,指一个密钥被破解,并不影响其他密钥的安全性,因为这些密钥间没有派生关系。

 6、IPSec基本原理

      IPSec通过在IPSec对等体间建立双向安全联盟形成一个安全互通的IPSec隧道,并通过定义IPSec保护的数据流将要保护的数据引入该IPSec隧道,然后对流经IPSec隧道的数据通过安全协议进行加密和验证,进而实现在Internet上安全传输指定的数据。

IPSec对需要保护的数据流的定义基于以下两种方式:
  • 基于ACL方式:ACL规则允许(permit)的报文将被保护,ACL规则拒绝(deny)的报文将不被保护。这种方式可以利用ACL的丰富配置功能,根据IP地址、端口、协议类型等对报文进行过滤进而灵活制定IPSec的保护方法。

  • 基于虚拟隧道接口方式:IPSec虚拟隧道接口是一种三层逻辑接口,所有路由到IPSec虚拟隧道接口的报文都将进行IPSec保护。

7、通过策略模板方式建立IPsec隧道(分支采用相同的预共享密钥认证)实际场景中很多公司首选

背景信息:总部和两个分支网络分别通过DeviceA、DeviceB和DeviceC接入Internet,DeviceA和DeviceB、DeviceA和DeviceC之间路由可达。DeviceA和DeviceB、DeviceA和DeviceC之间通过公网接口分别建立IPsec隧道,采用相同的预共享密钥进行身份认证,保护总部网络和两个分支网络之间特定网段数据流的安全传输。

总支:步骤如下

  • 配置两边设备能正常上网功能

  • 配置IPsec安全提议

  • 配置IKE安全提议。

  • 配置IKE peer。

  • 配置IPsec策略模板。

  • 在IPsec策略组map1的序号为10的IPsec策略中引用IPsec策略模板map_temp。

  • 在接口10GE0/0/1上应用IPsec策略组

分支:步骤如下

  • 定义被保护的数据流

  • 配置IPsec安全提议

  • 配置IKE安全提议。

  • 配置IKE peer。

  • 配置IPsec策略。

  • 在接口10GE0/0/1上应用IPsec策略组。

 1、定义感兴趣流
[DeviceB] acl 3000
[DeviceB-acl4-advance-3000] rule 5 permit ip source 10.1.1.0 0.0.0.255 destination 10.1.0.0 0.0.0.255
[DeviceB-acl4-advance-3000] quit
配置IPsec安全提议。
[DeviceB] ipsec proposal tran1
[DeviceB-ipsec-proposal-tran1] esp authentication-algorithm sha2-256  //采用的安全协议是esp,认证算法用sha2-256
[DeviceB-ipsec-proposal-tran1] esp encryption-algorithm aes-256-gcm-128  //采用的安全协议是esp,加密算法用sha2-256
[DeviceB-ipsec-proposal-tran1] quit
配置IKE安全提议。
[DeviceB] ike proposal 10
[DeviceB-ike-proposal-10] authentication-method pre-share //ike的安全认证方式使用其中的共享密钥PSK(pre-shared key)认证
[DeviceB-ike-proposal-10] prf hmac-sha2-256   //默认不启用,完美的前向安全PFS(Perfect Forward Secrecy)在IPSec使用安全策略发起一个协商时,在阶段2的协商中进行一次附加的密钥交换以提高通讯的安全性
[DeviceB-ike-proposal-10] encryption-algorithm aes-gcm-256 //加密算法
[DeviceB-ike-proposal-10] dh group14 //DH是一种公共密钥交换方法,数字越大,越复杂
[DeviceB-ike-proposal-10] integrity-algorithm hmac-sha2-256  //完整性算法
[DeviceB-ike-proposal-10] quit
配置IKE peer。
[DeviceB] ike peer a
[DeviceB-ike-peer-a] ike-proposal 10  //调用ike安全提议
[DeviceB-ike-peer-a] remote-address 1.1.1.1  //指定远端地址
[DeviceB-ike-peer-a] pre-shared-key YsHsjx_202206  //配置预共享密钥
[DeviceB-ike-peer-a] quit
配置IPsec策略。
[DeviceB] ipsec policy map1 10 isakmp(密钥管理协议)
[DeviceB-ipsec-policy-isakmp-map1-10] security acl 3000  //调用acl
[DeviceB-ipsec-policy-isakmp-map1-10] proposal tran1   //调用ipsec安全提议
[DeviceB-ipsec-policy-isakmp-map1-10] ike-peer a  //调用对等体
[DeviceB-ipsec-policy-isakmp-map1-10] sa trigger-mode auto //缺省情况下,IPsec隧道建立的触发方式是流量触发。如果希望自动触发协商建立IPsec隧道,请执行sa trigger-mode auto命令。
[DeviceB-ipsec-policy-isakmp-map1-10] quit
[DeviceB] interface 10ge 0/0/1
[DeviceB-10GE0/0/1] ipsec policy map1  //接口应用ipsec策略
[DeviceB-10GE0/0/1] quit

配置IPsec安全提议。
[DeviceA] ipsec proposal tran1
[DeviceA-ipsec-proposal-tran1] esp authentication-algorithm sha2-256
[DeviceA-ipsec-proposal-tran1] esp encryption-algorithm aes-256-gcm-128
[DeviceA-ipsec-proposal-tran1] quit
配置IKE安全提议。
[DeviceA] ike proposal 10
[DeviceA-ike-proposal-10] authentication-method pre-share
[DeviceA-ike-proposal-10] prf hmac-sha2-256
[DeviceA-ike-proposal-10] encryption-algorithm aes-gcm-256
[DeviceA-ike-proposal-10] dh group14
[DeviceA-ike-proposal-10] integrity-algorithm hmac-sha2-256  
[DeviceA-ike-proposal-10] quit
配置IKE peer。
[DeviceA] ike peer b
[DeviceA-ike-peer-b] ike-proposal 10
[DeviceA-ike-peer-b] pre-shared-key YsHsjx_202206
[DeviceA-ike-peer-b] quit
配置IPsec策略模板。
[DeviceA] ipsec policy-template map_temp 1
[DeviceA-ipsec-policy-templet-map_temp-1] proposal tran1
[DeviceA-ipsec-policy-templet-map_temp-1] ike-peer b
[DeviceA-ipsec-policy-templet-map_temp-1] quit
在IPsec策略组map1的序号为10的IPsec策略中引用IPsec策略模板map_temp。
[DeviceA] ipsec policy map1 10 isakmp template map_temp
在接口10GE0/0/1上应用IPsec策略组。
[DeviceA] interface 10ge 0/0/1
[DeviceA-10GE0/0/1] ipsec policy map1
[DeviceA-10GE0/0/1] quit

通过上图可以看出,ipsec在实际场景中形式多样。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/814508
推荐阅读
相关标签
  

闽ICP备14008679号