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 自定义名称 v1
pre-shared-key cipher 对等体密码
ike-proposal ike编号
remote-address 对端设备IP地址
配置IPSec策略
- 将IPSec安全提议、IKE安全提议、对等体配置绑定到策略中。
ipsec policy 名称 编号 isakmp
security acl 编号
ike-peer IKE对等体名称
proposal IPSec提议名称
将策略应用到接口
int g编号
ipsec policy 策略名称
案例
AR2:
sys
int g0/0/0
ip add 22.33.44.2 24
int g0/0/1
ip add 33.44.55.1 24
q
rip 10
version 2
network 33.0.0.0
network 22.0.0.0
- ``
AR3:
sys
int g0/0/0
ip add 33.44.55.2 24
int g0/0/1
ip add 44.55.66.1 24
q
rip 10
version 2
network 33.0.0.0
network 44.0.0.0
- ``
AR1:
sys
int g0/0/0
ip add 192.168.10.254 24
int g0/0/1
ip add 22.33.44.1 24
q
rip 10
version 2
network 192.168.10.0
network 22.0.0.0
q
#配置感兴趣流
acl 3000
rule permit ip source 192.168.10.0 0.0.0.255 destination 192.168.100.0 0.0.0.255
q
#配置IPSec安全提议
ipsec proposal ty1
esp authentication-algorithm sha1
esp encryption-algorithm aes-128
q
#配置IKE安全提议
ike proposal 8
encryption-algorithm aes-cbc-128
dh group14
q
#配置对等体
ike peer ddt1 v1
pre-shared-key cipher 123456
ike-proposal 8
remote-address 44.55.66.2
q
#配置IPSec策略
ipsec policy cl1 10 isakmp
security acl 3000
ike-peer ddt1
proposal ty1
q
#引用IPSec安全策略到物理接口
int g0/0/1
ipsec policy cl1
- ``
AR4:
sys
int g0/0/0
ip add 44.55.66.2 24
int g0/0/1
ip add 192.168.100.254 24
q
rip 10
version 2
network 44.0.0.0
network 192.168.100.0
q
#感兴趣流
acl 3000
rule permit ip source 192.168.100.0 0.0.0.255 destination 192.168.10.0 0.0.0.255
q
#配置IPSec安全提议
ipsec proposal ty1
esp authentication-algorithm sha1
esp encryption-algorithm aes-128
q
#配置IKE安全提议
ike proposal 8
encryption-algorithm aes-cbc-128
dh group14
q
#配置对等体
ike peer ddt1 v1
pre-shared-key cipher 123456
ike-proposal 8
remote-address 22.33.44.1
q
#配置IPSec策略
ipsec policy cl1 10 isakmp
security acl 3000
ike-peer ddt1
proposal ty1
q
#引用IPSec安全策略到物理接口
int g0/0/0
ipsec policy cl1