IPSec VPN
概述
- IPSec是IETF(Internet Engineering Task Force)制定的一组开放的网络安全协议。它并不是一个单独的协议,而是一系列为IP网络提供安全性的协议和服务的集合,包括认证头AH(Authentication Header)和封装安全载荷ESP(Encapsulating Security Payload)两个安全协议、密钥交换和用于验证及加密的一些算法等。通过这些协议,在两个设备之间建立一条IPSec隧道。数据通过IPSec隧道进行转发,实现保护数据的安全性。
特点
- 数据来源验证:接收方验证发送方身份是否合法。
- 数据加密:发送方对数据进行加密,以密文的形式在Internet上传送,接收方对接收的加密数据进行解密后处理或直接转发。
- 数据完整性:接收方对接收的数据进行验证,以判定报文是否被篡改。
- 抗重放:接收方拒绝旧的或重复的数据包,防止恶意用户通过重复发送捕获到的数据包所进行的攻击。
两种协议
- AH:鉴别算法(摘要算法,sha1、md5)
- ESP:鉴别算法(摘要算法,sha1、md5)、加密算法(DES、3DES、AES)
IKE协商
- 用于协商安全的对称密钥,使用DH算法;
两种工作模式
- 传输模式:不会增加新的IP头部,原始IP头部会被暴露出来,只对数据本身进行加密保护;
- 隧道模式:会增加新的IP头部,新的IP头部的源IP和目标IP分别为发送方的VPN网关和接收方VPN网关IP,会对整个数据进行加密保护(包含原始IP头部);
推荐
- 推荐使用ESP协议配合隧道模式实现IPSec VPN;
- 将原始数据进行加密放到ESP头部;
- 将加密后数据进行摘要算法,生成摘要值,将摘要值放入ESP鉴定中;
- 新增IP头部,原始IP为发送方VPN网关IP,目标IP为接收方VPN网关IP;
命令
配置感兴趣流
- 确定要通过VPN隧道传输的数据流。
- 配置ACL允许流量;
配置IPSec安全提议
- 确定要使用的协议类型:ESP、AH
ipsec proposal 自定义提议名称协议类型 authentication-algorithm 摘要算法名称;协议类型 encryption-algorithm 加密算法;
配置IKE安全提议
- 确定密钥协商相关参数
- dh组号值越大安全系数越高
ike proposal 编号encryption-algorithm 算法名称dh group组号
配置对等体
- 确定对端的VPN设备信息
ike peer 自定义名称 v1pre-shared-key cipher 对等体密码ike-proposal ike编号remote-address 对端设备IP地址
配置IPSec策略
- 将IPSec安全提议、IKE安全提议、对等体配置绑定到策略中。
ipsec policy 名称 编号 isakmpsecurity acl 编号ike-peer IKE对等体名称proposal IPSec提议名称
将策略应用到接口
int g编号ipsec policy 策略名称
案例
AR2:sysint g0/0/0ip add 22.33.44.2 24int g0/0/1ip add 33.44.55.1 24qrip 10version 2network 33.0.0.0network 22.0.0.0- ``
AR3:sysint g0/0/0ip add 33.44.55.2 24int g0/0/1ip add 44.55.66.1 24qrip 10version 2network 33.0.0.0network 44.0.0.0- ``
AR1:sysint g0/0/0ip add 192.168.10.254 24int g0/0/1ip add 22.33.44.1 24qrip 10version 2network 192.168.10.0network 22.0.0.0q#配置感兴趣流acl 3000rule permit ip source 192.168.10.0 0.0.0.255 destination 192.168.100.0 0.0.0.255q#配置IPSec安全提议ipsec proposal ty1esp authentication-algorithm sha1esp encryption-algorithm aes-128q#配置IKE安全提议ike proposal 8encryption-algorithm aes-cbc-128dh group14q#配置对等体ike peer ddt1 v1pre-shared-key cipher 123456ike-proposal 8remote-address 44.55.66.2q#配置IPSec策略ipsec policy cl1 10 isakmpsecurity acl 3000ike-peer ddt1proposal ty1q#引用IPSec安全策略到物理接口int g0/0/1ipsec policy cl1- ``
AR4:sysint g0/0/0ip add 44.55.66.2 24int g0/0/1ip add 192.168.100.254 24qrip 10version 2network 44.0.0.0network 192.168.100.0q#感兴趣流acl 3000rule permit ip source 192.168.100.0 0.0.0.255 destination 192.168.10.0 0.0.0.255q#配置IPSec安全提议ipsec proposal ty1esp authentication-algorithm sha1esp encryption-algorithm aes-128q#配置IKE安全提议ike proposal 8encryption-algorithm aes-cbc-128dh group14q#配置对等体ike peer ddt1 v1pre-shared-key cipher 123456ike-proposal 8remote-address 22.33.44.1q#配置IPSec策略ipsec policy cl1 10 isakmpsecurity acl 3000ike-peer ddt1proposal ty1q#引用IPSec安全策略到物理接口int g0/0/0ipsec policy cl1