站点到站点-主模式
一、实验设备
1.cisco路由器三台
2.vpc两台
二、实验拓扑
三、实验配置
1、Router1配置
R1(config)#interface fa0/0
R1(config-if)#ip address 192.168.1.2 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface fa1/0
R1(config-if)#ip address 10.1.20.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1
2、Router3配置
R3(config)#interface fa0/0
R3(config-if)#ip address 192.168.2.2 255.255.255.0
R3(config-if)#no shutdown
R3(config)#interface fa1/0
R3(config-if)#ip address 10.1.36.1 255.255.255.0
R3(config-if)#no shutdown
R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.1
3、Router2配置
R2(config)#interface fa0/0
R2(config-if)#ip address 192.168.1.1 255.255.255.0
R2(config-if)#no shutdown
R2(config)#interface fa1/0
R2(config-if)#ip address 192.168.2.1 255.255.255.0
R2(config-if)#no shutdown
4、Router1配置IPSec
(1)R1路由器IpSec配置
R1(config)#crypto isakmp enable (optional)默认启用
(2)R1路由器IpSec isakmp 配置(阶段一的策略)
R1(config)#crypto isakmp policy 10
R1(config-isakmp)#hash md5
R1(config-isakmp)#authentication pre-share
R1(config-isakmp)#encryption 3des
R1(config-isakmp)#group 2
(3)R1路由器Pre-Share认证配置
R1(config)#crypto isakmp key cisco address 192.168.2.2
(4)R1路由器IpSec变换集配置(阶段二的策略)
R1(config)#crypto ipsec transform-set c1 esp-3des esp-md5-hmac
R1 (cfg-crypto-trans)#mode tunnel
(5)R1路由器加密图的配置
R1(config)#crypto map c2 10 ipsec-isakmp
R1(config-crypto-map)#set peer 192.168.2.2
R1(config-crypto-map)#set transform-set c1
R1(config-crypto-map)#match address 101
(6)R1路由器定义感兴趣流量
R1(config)#access-list 101 permit ip 10.1.20.0 0.0.0.255 10.1.36.0 0.0.0.255
(7)R1路由器加密图绑定到接口
R1(config)#interface e0/0
R1(config-if)#crypto map c2
5、Router3配置IPSec
(1)R3路由器IpSec配置
R3(config)#crypto isakmp enable (optional)默认启用
(2)R3路由器IpSec isakmp 配置(阶段一的策略)
R3(config)#crypto isakmp policy 10
R3(config-isakmp)#hash md5
R3(config-isakmp)#authentication pre-share
R3(config-isakmp)#encryption 3des
R3(config-isakmp)#group 2
(3)R3路由器Pre-Share认证配置
R3(config)#crypto isakmp key cisco address 192.168.1.2
(4)R3路由器IpSec变换集配置(阶段二的策略)
R3(config)#crypto ipsec transform-set c1 esp-3des esp-md5-hmac
R3(cfg-crypto-trans)#mode tunnel
(5)R3路由器加密图的配置
R3(config)#crypto map c2 10 ipsec-isakmp
R3(config-crypto-map)#set peer 192.168.1.2
R3(config-crypto-map)#set transform-set c1
R3(config-crypto-map)#match address 101
(6)R3路由器定义感兴趣流量
R3(config)#access-list 101 permit ip 10.1.36.0 0.0.0.255 10.1.20.0 0.0.0.255
(7)R3路由器加密图绑定到接口
R3(config)#interface e0/0
R3(config-if)#crypto map c2
四、实验验证
1、ping 10.1.36.88
2、show crypto ipsec sa // 查看 IPSec 安全关联(Security Association)的状态信息。
隧道对端 IP(Peer Address)
加密/验证算法(ESP/AH transform sets)
SPI(安全参数索引):唯一标识 SA 的 32 位值
入站/出站数据包计数(#pkts encaps/decaps)
生存时间(current/lifetime kB)
隧道模式(Tunnel vs Transport)
关联的 ACL(匹配加密流量的访问控制列表)
3、show crypto engine connections active //显示当前活跃的加密引擎连接(硬件/软件加速)。
4、debug crypto isakmp
5、debug crypto ipsec
6. clear cryto sa 删除SA
7.抓包
可以看到总共有9条ISAKMP消息交互,其中第一阶段的主模式有6条,第二阶段的快速模式有3条。
由于wireshark软件自身的问题,导致将原本的Initiator Cookie、Responder Cookie写成了Initiator SPI、Responder SPI。