配置LAN-to-LAN ×××
1)在R1上配置IKEISAKMP)策略:
r1(config)#crypto isakmp policy 1
r1(config-isakmp)#encryption 3des
r1(config-isakmp)#hash sha
r1(config-isakmp)#authentication pre-share
r1(config-isakmp)#group 2
r1(config-isakmp)#exit
说明:定义了ISAKMP policy 1,加密方式为3deshash算法为sha,认证方式为Pre-Shared Keys (PSK),密钥算法(Diffie-Hellman)为group 2
 
2)在R1上定义认证标识:
r1(config)#crypto isakmp key 0 cisco123 address 23.1.1.3
说明:因为之前定义的认证方式为Pre-Shared Keys (PSK),所以需要定义认证密码,这里定义与peer 23.1.1.3的认证密码为cisco123,并且双方密码必须一致,否则无法建立IKE SA,其中0表示密码在running-config中显示为明文。
 
3)在R1上配置IPsec transform:
r1(config)#crypto ipsec transform-set ccie esp-3des esp-sha-hmac
r1(cfg-crypto-trans)#exit
说明:配置了transform-setccie,其中数据封装使用esp3des加密,并且使用esp结合shahash计算,默认的IPsec modetunnel
 
4)在R1上定义感兴趣流量:
r1(config)#access-list 100 permit ip 10.1.1.0 0.0.0.255 192.168.1.0 0.0.0.255
说明:这里需要被IPsec保护传输的流量为上海公司至北京公司的流量,即10.1.1.0/24发往 192.168.1.0/24的流量,切记不可使用any来表示地址。
 
5)在R1上创建crypto map:
r1(config)#crypto map l2l 1 ipsec-isakmp
r1(config-crypto-map)#set peer 23.1.1.3
r1(config-crypto-map)#set transform-set ccie
r1(config-crypto-map)#match address 100
r1(config-crypto-map)#exit
说明:R1上配置crypto mapl2l,序号为1,即第1组策略,其中指定加密数据发往的对端为23.1.1.3,即和23.1.1.3建立IPsec隧道,调用的IPsec transformccie,并且指定ACL 100中的流量为被保护的流量。
 
6)在R1上将crypto map应用于接口:
r1(config)#int f0/0
r1(config-if)#crypto map l2l
r1(config-if)#exit