本案例是对神州数码设备上IPsec over GRE材料的整理
用于个人的学习和记录,如有质疑,以你为准,欢迎指错
功能介绍:
使用IPSEC静态隧道组网时,需要在每个IPSEC隧道两端手动进行隧道配置,无需动态协商。但随着加密点和隧道的增多,对IPSEC隧道的配置和维护难度也增加,因此静态隧道技术一般应用在加密点比较少的场景
工作原理:
IPSec VPN分为两个协商阶段,ISAKMP阶段及IPSec阶段,ISAKMP阶段主要是协商两端的保护策略,验证对等体的合法性,产生加密密钥,保护第二阶段IPSec SA的协商。第二阶段IPSec 阶段,主要是确定IPSec SA的保护策略,使用AH还是ESP、传输模式还是隧道模式、被保护的数据是什么等等。第二阶段协商的目标就是产生真正用于保护IP数据的IPSec SA。 IPSec通信实体双方对于一、二阶段的这些安全策略必须达成一致,否则IPSec协商将无法通过
网络实验拓扑图:
实验要求:某公司需在两分公司进行建立IPSEC over GRE隧道来保障两端数据传输的可靠安全性,因两端建立并且ip固定所以使用使用静态IPSEC vpn
一.设备基础配置:
二.配置GRE隧道:
Rt-1: interface Tunnel1 ip address 172.16.10.9 255.255.255.252 tunnel source GigaEthernet0/4 tunnel destination 202.10.1.5 tunnel mode gre ip 配置为GRE模式(tunnel口默认为GRE)
Rt-2: interface Tunnel1 ip address 172.16.10.10 255.255.255.252 tunnel source GigaEthernet0/4 tunnel destination 202.10.1.1 tunnel mode gre ip
三.IPSEC配置:
1.ipsec配置步骤
(1)配置ipsec感兴趣流
(2)配置isakmp策略
(3)配置预共享密钥
(4)配置ipsec加密转换集
(5)配置ipsec加密图
(6)将加密图应用到接口
2.Rt-1进行配置ipsec:
①配置ipsec感兴趣流:
RT-1_config#ip access-list standard ACL 配置感兴趣流 RT-1_config_std_nacl#permit any RT-1_config#
②配置isakmp策略 :
RT-1_config#crypto isakmp policy 1 配置ISAKMP策略,优先级为1 RT-1_config_isakmp#authentication pre-share 设置认证方法为预共享秘钥 RT-1_config_isakmp#hash md5 设置算法为md5 RT-1_config_isakmp#exit
③配置预共享秘钥:
RT-1_config#crypto isakmp key 123 172.16.10.10 配置预共享秘钥 指定peer 172.16.10.10的预共享密钥为“ruijie”,对端也必须配置一致的密钥。 如使用数字证书/信封认证则无需配置。
④配置ipsec加密转换集:
RT-1_config#crypto ipsec transform-set IPSEC 配置IPSEC变换集合 RT-1_config_crypto_trans#exit 使用默认配置所以直接退出即可
ipsec变换集合默认内容:
⑤配置IPSEC加密图:
RT-1_config#crypto map IPSECACL 1 ipsec-isakmp 新建名称为“IPSECACL”的加密图 RT-1_config_crypto_map#set peer 172.16.10.10 指定peer地址 RT-1_config_crypto_map#set transform-set IPSEC 指定加密转换集“IPSEC” RT-1_config_crypto_map#match address ACL 配置感兴趣流 RT-1_config_crypto_map#exit
⑥将加密图应用在隧道口中:
RT-1_config#int tunnel 1 RT-1_config_t1#crypto map IPSECACL 应用加密图 RT-1_config_t1#exit
RT-2的配置几乎除peer对端地址外其余相同此处省略...
3.在Rt-1以原地址ping对端地址,来激活IPSEC
4.在R1上查看isakmp、ipsec sa是否已经协商成功
RT-1_config#show crypto isakmp sa
dst src state state-id conn
172.16.10.10 172.16.10.9 <I>Q_SA_SETUP 2 10 IPSECACL 1
172.16.10.10 172.16.10.9 <I>M_SA_SETUP 1 10 IPSECACL 1RT-1_config#show crypto ipsec sa
Interface: Tunnel1
Crypto map name:IPSECACL , local addr. 172.16.10.9 //接口下运行的加密图名称及进行isakmp/ipsec协商时所使用的ip地址local ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0) //感兴趣流原地址
remote ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0) //感兴趣流目的地址
local crypto endpt.: 172.16.10.9, remote crypto endpt.: //172.16.10.10 本地加密及远程加密的结束点
inbound esp sas:
spi:0x939892ee(2476249838) //ipsec sa 入方向的spi
transform: esp-des //ipsec加密转换集为esp-des
in use settings ={ Tunnel } //采用隧道模式
sa timing: remaining key lifetime (k/sec): (4607999/3273) //离安全联盟的生命周期到期还有4607999千字节/1324秒outbound esp sas: //ipsec sa出方向的spi,只有看到了inbound spi和outbound spi才说明ipsec sa已经协商成功。
spi:0xfde6f413(4259771411)
transform: esp-des
in use settings ={ Tunnel }
sa timing: remaining key lifetime (k/sec): (4607999/3273)四.故障排错:
①
Rt-1#show run | begin crypto
crypto isakmp key 123 address 172.16.10.10 255.255.255.255 ---该地址就是与对端建立的ipsec的地址②
Rt-1#show run | begin crypto
crypto map IPSECACL 1 ipsec-isakmp //新建名称为“IPSECACL”的加密图set peer 10.0.0.2 ---该地址就是与对端建立的ipsec的公网地址
set transform-set IPSEC //指定加密转换集“IPSEC”
match address ACL //指定感兴趣流为ACL ACL
③
Rt-1#ping 172.16.10.10 //测试隧道的连通性
④
Rt-1#show running-config | include ip access-list //查看使用的ACL是否是扩展ACL因为标准ACL只检查数据包的源地址;
扩展ACL既检查数据包的源地址,也检查数据包的目的地址。