Cisco *** lan to lan ipsec <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

网络拓朴:

<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />

 
实验任务:

l            建立***隧道,加密1.1.1.0/24 2.2.2.0/24的流量

环境描述:

l             3 Cisco3640 + NE-4E 模块,该配置拥有4Ethernet2PC

l             ISP 模拟ISP环境,不添加任何额外路由

l              SH-R1 loopback1:1.1.1.1/24 BJ-R1 loopback 1:2.2.2.2/24 用来测试

 

地址分配:

设备名称

接口

IP 地址

描述

BJ-R1

E0/0

192.168.1.1/24

TO ISP

Loopback1

1.1.1.1/24

测试

SH-R1

E0/1

192.168.2.1/24

TO ISP

Loopback1

2.2.2.2/24

测试

ISP

E0/0

192.168.1.2/24

TO BJ-R1

E0/1

192.168.2.2/24

TO SH-R1

 

 

 

详细配置:

   1 IP地址设置

SH-R1 (config)  #int e0/0

SH-R1 (config-if)  #ip add 192.168.1.1 255.255.255.0

SH-R1 (config)  #no shutdown

SH-R1 (config)  #int lo1

SH-R1 (config-if)  #ip add 1.1.1.1 255.255.255.0

………………………………………………………………………….

BJ-R1 (config)  #int e0/1

BJ-R1 (config-if)  #ip add 192.168.2.1 255.255.255.0

BJ-R1 (config)  #no shutdown

BJ-R1 (config)  #int lo1

BJ-R1 (config-if)  #ip add 2.2.2.2 255.255.255.0

……………………………………………………………………………

ISP (config)  #int e0/0

ISP (config-if)  #ip add 192.168.1.2 255.255.255.0

ISP (config)  #no shutdown

ISP (config)  #int e0/1

ISP (config-if)  #ip add 192.168.2.2 255.255.255.0

ISP (config)  #no shutdown

 

 

2 、定义相关ACL

SH-R1 (config)#ip access-list extended *** ……………………匹配***加密

SH-R1 (config-ext-nacl)#permit ip 1.1.1.0 0.0.0.255 2.2.2.2 0.0.0.255

BJ-R1 (config)#ip access-list extended *** ……………………匹配***加密

BJ-R1 (config-ext-nacl)#permit ip 2.2.2..0 0.0.0.255 1.1.1 0.0.0.255

 

3 、配置IKE协商(第一阶段)

SH-R1(config)#crypto isakmp policy 1    定义第一阶段策略

SH-R1(config-isakmp)#hash md5         哈希使用md5

SH-R1(config-isakmp)#encryption 3des   加密方式使用3DES(对称)

SH-R1(config-isakmp)#authentication pre-share 验证用预共享密钥

SH-R1(config-isakmp)#group 2    使用第二组策略(1024bit

SH-R1(config)#crypto isakmp key 0 cisco address 192.168.2.1

 

BJ-R1(config)#crypto isakmp policy 1    定义第一阶段策略

BJ-R1(config-isakmp)#hash md5         哈希算法使用md5

BJ-R1(config-isakmp)#encryption 3des  加密方式使用3DES(对称)

BJ-R1(config-isakmp)#authentication pre-share 验证用预共享密钥

BJ-R1(config-isakmp)#group 2  使用第二组策略(1024bit

BJ-R1(config)#crypto isakmp key 0 cisco address 192.168.1.1

 

4 、配置IPsec参数(第二阶段)

SH-R1(config)#crypto ipsec transform-set SH-BJ esp-des esp-md5-hmac

BJ-R1 (config)#crypto ipsec transform-set BJ-SH esp-des esp-md5-hmac

 

5 、配置加密图(关联第一、二阶段)

SH-R1(config)#crypto map SH 1 ipsec-isakmp  建立map关联12阶段

SH-R1(config-crypto-map)#set transform-set SH-BJ  指定转换集

SH-R1(config-crypto-map)#match address ***      匹配需加密的流量

SH-R1(config-crypto-map)#set peer 192.168.2.1    指明对方加()密点

BJ-R1(config)#crypto map BJ 1 ipsec-isakmp  建立map关联12阶段

BJ-R1(config-crypto-map)#set transform-set BJ-SH  指定转换集

BJ-R1(config-crypto-map)#match address ***      匹配需加密的流量

BJ-R1(config-crypto-map)#set peer 192.168.1.1    指明对方加()密点

 

5 、端口应用

BJ-R1(config)#int e0/0

BJ-R1(config-if)#crypto map BJ   端口调用加密图

SH-R1(config)#int e0/0

SH-R1(config-if)#crypto map SH  端口调用加密图

 

实验测试:

1、 SH-R1 extend ping 2.2.2.2 sourse 1.1.1.1

 

2、验证ISAKMP SA

3、3 、验证两边IPSEC SA

由以上可以看出SH-R1outbound spi BJ-R1 inbound spi相同,说明第二阶段成功建立