配置LAN-to-LAN ***
(1)在R1上配置IKE(ISAKMP)策略:
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,加密方式爲3des,hash算法爲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-set爲ccie,其中數據封裝使用esp加3des加密,並且使用esp結合sha做hash計算,默認的IPsec mode爲tunnel。
(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 map爲l2l,序號爲1,即第1組策略,其中指定加密數據發往的對端爲23.1.1 .3,即和23.1.1.3建立IPsec隧道,調用的IPsec transform爲ccie,並且指定ACL 100中的流量爲被保護的流量。
(6)在R1上將crypto map應用於接口:
r1(config)#int f0/0
r1(config-if)#crypto map l2l
r1(config-if)#exit