IPSec是基于定义的感兴趣流触发对特定数据的保护,至于什么样的数据是需要IPSec保护的,可以通过以下两种方式定义。其中IPSec感兴趣流即需要IPSec保护的数据流。
此前使用的都是acl方式定义的感兴趣流。
还有一种方式是路由方式。
通过ipsec虚拟隧道接口建立ipsec隧道,将所有路由到ipsec虚拟隧道接口的报文都进行ipsec保护,根据该路由的目的地址确定哪些数据流需要ipsec保护,其中ipsec虚拟隧道接口具有以下优点。
简化配置:不需使用acl定义流量特征
支持动态路由协议
通过gre over ipsec支持对组播流量的保护
虚拟隧道接口(即tunnel接口)是一种三层逻辑接口,通过配置tunnel接口,并在tunnel接口上应用ipsec安全框架建立ipsec隧道。在tunnel接口上应用ipsec安全框架后,系统只会生成一条ipsec隧道,并对所有路由到该隧道接口的数据流进行ipsec保护。
ipsec的tunnel接口的ip地址可以手工配置,可以ikev2协商申请。后者适用于大规模分支接入总部场景。
需求和拓扑
网络A和网络B分别通过FW_A和FW_B连接到Internet。网络环境描述如下:
网络A属于10.1.1.0/24子网,通过接口GigabitEthernet 0/0/3与FW_A连接。
网络B属于10.1.2.0/24子网,通过接口GigabitEthernet 0/0/3与FW_B连接。
FW_A和FW_B路由可达。
通过组网实现如下需求:在FW_A和FW_B之间建立基于路由的IPSec隧道,使网络A和网络B的用户可通过IPSec隧道互相访问。
操作步骤
1、配置接口地址和安全区域
2、配置公网路由可达
3、配置安全策略全通
4、配置tunnel接口
//f1interface Tunnel1ip address 172.16.1.2 255.255.255.0tunnel-protocol ipsecsource 1.1.3.1destination 1.1.5.1//f2interface Tunnel1ip address 172.16.2.2 255.255.255.0tunnel-protocol ipsecsource 1.1.5.1destination 1.1.3.1
4.1、配置路由,将需要经过ipsec隧道传输的流量引入ipsec隧道中。
//f1ip route-static 10.1.2.0 255.255.255.0 Tunnel1//f2ip route-static 10.1.1.0 255.255.255.0 Tunnel1
5、配置ipsec
5.1、配置ipsec安全提议
ipsec proposal tran1esp authentication-algorithm sha2-256esp encryption-algorithm aes-256
5.2、配置ike安全提议
ike proposal 10encryption-algorithm aes-256dh group14authentication-algorithm sha2-256authentication-method pre-shareintegrity-algorithm hmac-sha2-256prf hmac-sha2-256
5.3、配置ike peer(注意不配remote-address)
//f1ike peer bpre-shared-key Test!1234ike-proposal 10//f2ike peer apre-shared-key Test!1234ike-proposal 10
5.4、配置ipsec安全框架
ipsec安全框架定义了对数据流的保护方法,比如使用的ipsec安全提议、自动协商sa的ike协商参数、sa的生存周期等。一个ipsec安全框架相当一个ipsec安全策略,但是与ipsec安全策略不同的是:安全框架由名称唯一确定,且只能通过ike协商方式配置。
为了保证ike协商成功,安全框架中所有配置的参数都必须在本端和对端相匹配。
ipsec安全框架无需通过acl定义数据流,而是保护所有引入到ipsec隧道即tunnel的数据流。
//f1ipsec profile pro1ike-peer b proposal tran1//f2ipsec profile pro1ike-peer aproposal tran1
5.5、在tunnel接口上应用ipsec安全框架
在ipsec虚拟隧道接口下应用ipsec安全框架后只会生成一条ipsec隧道,并对所有路由到该隧道接口的数据流进行ipsec保护,简化了安全策略管理的复杂度。
interface tunnel 1ipsec profile pro1
验证和分析
1、检查ike sa和ipsec sa的建立情况
[f2]dis ike sa-03-20 14:15:26.690 IKE SA information :Conn-ID Peer VPN Flag(s)Phase RemoteType RemoteID ------------------------------------------------------------------------------------------------------------------------------------15 1.1.3.1:500 RD|ST|Av2:2 IP1.1.3.1 14 1.1.3.1:500 RD|ST|Av2:1 IP1.1.3.1 Number of IKE SA : 2------------------------------------------------------------------------------------------------------------------------------------Flag Description:RD--READY ST--STAYALIVE RL--REPLACED FD--FADING TO--TIMEOUTHRT--HEARTBEAT LKG--LAST KNOWN GOOD SEQ NO. BCK--BACKED UPM--ACTIVE S--STANDBY A--ALONE NEG--NEGOTIATING
[f2]dis ipsec sa brief -03-20 14:15:42.870 IPSec SA information:Src address Dst addressSPIVPN Protocol Algorithm--------------------------------------------------------------------------------------------------------------------------1.1.3.1 1.1.5.1186134018 ESP E:AES-256 A:SHA2_256_1281.1.5.1 1.1.3.1196568654 ESP E:AES-256 A:SHA2_256_128Number of IPSec SA : 2-------------------------------------------------------------------------------------------------------------------