***實驗
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