×××实验
IPSec ×××配置步骤
1、定义感兴趣的流量触发IPSec连接,
2、 IKE阶段1:确定IKE策略:协商IKE SA建立安全通道、交换密钥(DH exchange)、验证对端ID(IP地址或FQDN)
3、 IKE阶段2:确定IPSec策略:协商IPSec SA:IPSec变换集(transform sets)
4、创建crypto 映射及应用在接口上
5、监视和测试:传输IPSec数据
实验一 Cisco IOS Site-to-Site Pre-share Key ×××
一实验设备
1、CISCO 路由器两台,IOS版本12.3带K9
二实验拓扑图
三 实验配置
1、 R1路由器上连通性配置
R1(config)#interface e0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface e1
R1(config-if)#ip address 10.1.1.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.2
2、 R2路由器上连通性配置
R2(config)#interface e0
R2(config-if)#ip address 192.168.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config)#interface e1
R2(config-if)#ip address 10.2.2.2 255.255.255.0
R2(config-if)#no shutdown
R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1
3、 R1路由器IpSec配置
R1(config)#crypto isakmp enable (optional)默认启用
R1路由器IpSec isakmp 配置(阶段一的策略)
R1(config)#crypto isakmp policy 10 创建ISAKMP策略,优先级为10
R1(config-isakmp)#hash md5 指定ISAKMP策略使用MD5进行HASH运算
R1(config-isakmp)#authentication pre-share 指定ISAKMP策略使用预共享密钥的方式对分公司路由器进行身份验证。
R1(config-isakmp)#encryption 3des 指定ISAKMP策略使用3DES进行加密
R1(config-isakmp)#group 2 指定Diffie-Hellman组2(指定ISAKMP策略使用10位密钥算,分别有1/2/5三种)
R1路由器Pre-Share认证配置
R1(config)#crypto isakmp key bluefoxlab address 192.168.1.2 指定ISAKMP与分部路由器进行身份认证时使用预共享密钥。
R1路由器IpSec变换集配置(阶段二的策略)
R1(config)#crypto ipsec transform-set bluefoxlab esp-3des esp-md5-hmac 配置IPSec交换集
R1 (cfg-crypto-trans)#mode tunnel 封装为隧道模式
R1路由器加密图的配置
R1(config)#crypto map bluefoxlab 10 ipsec-isakmp 创建加密图
R1(config-crypto-map)#set peer 192.168.1.2 指定加密图用于分支路由器建立×××连接
R1(config-crypto-map)#set transform-set bluefoxlab 指定加密图使用的IPSec交换集。
R1(config-crypto-map)#match address 101 指定使用此加密图进行加密的通信,用访问控制列表来定义
R1路由器定义感兴趣流量
R1(config)#access-list 101 permit ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255
R1路由器加密图绑定到接口
R1(config)#interface e0
R1(config-if)#crypto map bluefoxlab
4、 R2路由器IpSec配置
R2(config)#crypto isakmp enable (optional)默认启用
R2路由器IpSec isakmp 配置(阶段一的策略)
R2(config)#crypto isakmp policy 10
R2(config-isakmp)#hash md5
R2(config-isakmp)#authentication pre-share
R2(config-isakmp)#encryption 3des
R2(config-isakmp)#group 2 指定Diffie-Hellman组2(指定ISAKMP策略使用10位密钥算法,分别有1/2/5三种)
R2路由器Pre-Share认证配置
R2(config)#crypto isakmp key bluefoxlab address 192.168.1.1
R2路由器IpSec变换集配置(阶段二的策略)
R2(config)#crypto ipsec transform-set bluefoxlab esp-3des esp-md5-hmac
R2(cfg-crypto-trans)#mode tunnel 封装为隧道模式
R2路由器加密图的配置
R2(config)#crypto map bluefoxlab 10 ipsec-isakmp
R2(config-crypto-map)#set peer 192.168.1.1
R2(config-crypto-map)#set transform-set bluefoxlab
R2(config-crypto-map)#match address 101
R2路由器定义感兴趣流量
R2(config)#access-list 101 permit ip 10.2.2.0 0.0.0.255 10.1.1.0 0.0.0.255
R2路由器加密图绑定到接口
R2(config)#interface e0
R2(config-if)#crypto map bluefoxlab
四 实验总结
如R2:
1、ping 10.1.1.1 source 10.2.2.2
2、show crypto ipsec sa
interface: Ethernet0/0
Crypto map tag: bluefoxlab, local addr 192.168.1.2
protected vrf: (none)
local ident (addr/mask/prot/port): (10.2.2.0/255.255.255.0/0/0)
remote ident (addr/mask/prot/port): (10.1.1.0/255.255.255.0/0/0)
current_peer 192.168.1.1 port 500
PERMIT, flags={origin_is_acl,}
#pkts encaps: 5, #pkts encrypt: 5, #pkts digest: 5
#pkts decaps: 5, #pkts decrypt: 5, #pkts verify: 5
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 0, #pkts compr. failed: 0
#pkts not decompressed: 0, #pkts decompress failed: 0
#send errors 0, #recv errors 0
local crypto endpt.: 192.168.1.2, remote crypto endpt.: 192.168.1.1
path mtu 1500, ip mtu 1500, ip mtu idb Ethernet0/0
current outbound spi: 0x4696AE6C(1184280172)
inbound esp sas:
spi: 0x5F6C0815(1600915477)
transform: esp-3des esp-md5-hmac ,
in use settings ={Tunnel, }
conn id: 2001, flow_id: SW:1, crypto map: bluefoxlab
sa timing: remaining key lifetime (k/sec): (4422244/3547)
IV size: 8 bytes
replay detection support: Y
Status: ACTIVE
inbound ah sas:
inbound pcp sas:
outbound esp sas:
spi: 0x4696AE6C(1184280172)
transform: esp-3des esp-md5-hmac ,
in use settings ={Tunnel, }
conn id: 2002, flow_id: SW:2, crypto map: bluefoxlab
sa timing: remaining key lifetime (k/sec): (4422244/3531)
IV size: 8 bytes
replay detection support: Y
Status: ACTIVE
outbound ah sas:
outbound pcp sas:
3、show crypto engine connections active
ID Interface IP-Address State Algorithm Encrypt Decrypt
1 Ethernet0/0 192.168.1.2 set HMAC_MD5+3DES_56_C 0 0
2001 Ethernet0/0 192.168.1.2 set 3DES+MD5 0 5
2002 Ethernet0/0 192.168.1.2 set 3DES+MD5 5 0
4、debug crypto isakmp
5、debug crypto ipsec