R1爲總部,R2爲運營商,R3爲分支機構ide
此案例中R1使用動態映射,R3使用靜態映射,R3的f0/0使用dhcp得到動態IP地址,所以總部的管理員是不知道分支機構的IP地址的,此時就沒有辦法在靜態加密映射中指定對方的IP地址和Crypto ACL。這就要用到動態加密映射,在靜態加密映射中所需的參數將在動態加密映射中動態的填充,這是須要在分部的路由器上配置靜態的加密映射,讓分部發起協商。可是動態加密映射是沒法應用到接口上的。因此還要建立靜態的加密映射並引用動態加密映射,再把這個靜態加密映射應用的接口上。測試
一:基本設置加密
R1的基本配置orm
R1#conf t
R1(config)#int f0/0
R1(config-if)#ip add 200.0.0.1 255.255.255.0
R1(config-if)#no shut
R1(config)#int f0/1
R1(config-if)#ip add 192.168.1.254 255.255.255.0
R1(config-if)#no shutblog
R2的基本配置接口
R2#conf t
R2(config)#int f0/0
R2(config-if)#ip add 200.0.0.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int f0/1
R2(config-if)#ip add 100.0.0.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exitip
R2(config)#ip dhcp pool cisco
R2(dhcp-config)#network 193.1.1.0 255.255.255.0md5
R3的基本配置ci
R3#conf t
R3(config)#int f0/0
R3(config-if)#ip add dhcp
R3(config-if)#no shut
R3(config-if)#int f0/1
R3(config-if)#ip add 192.168.2.254 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3#show ip int br路由
二:路由的設置
R1的路由
R1(config)#ip route 0.0.0.0 0.0.0.0 200.0.0.2
R3的路由
R3(config)#ip route 0.0.0.0 0.0.0.0 100.0.0.2
三:×××的設置
R1的×××
R1(config)#crypto isakmp enable
R1(config)#crypto isakmp identity address
R1(config)#crypto isakmp policy 10
R1(config-isakmp)#encryption aes 128
R1(config-isakmp)#hash md5
R1(config-isakmp)#authentication pre-share
R1(config-isakmp)#group 2
R1(config-isakmp)#exit
R1(config)#crypto isakmp key 6 cisco123 address 0.0.0.0 0.0.0.0 no-xauth
R1(config)#access-list 101 permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255
R1(config)#crypto ipsec transform-set cisco-set esp-aes esp-md5-hmac
R1(cfg-crypto-trans)#exit
R1(config)#crypto dynamic-map cisco-dymap 10
R1(config-crypto-map)#set transform-set cisco-set
R1(config-crypto-map)#match address 101
R1(config-crypto-map)#exit
R1(config)#crypto map cisco-stmap 65000 ipsec-isakmp dynamic cisco-dymap discover
R1(config)#access-list 102 deny ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255
R1(config)#access-list 102 permit ip 192.168.1.0 0.0.0.255 any
R1(config)#ip nat inside source list 102 interface f0/0 overload
R1(config)#int f0/0
R1(config-if)#ip nat outside
R1(config-if)#crypto map cisco-stmap
R1(config-if)#int f0/1
R1(config-if)#ip nat inside
R1(config-if)#
R3的×××
R3#conf t
R3(config)#crypto isakmp enable
R3(config)#crypto isakmp identity address
R3(config)#crypto isakmp policy 10
R3(config-isakmp)#encryption aes 128
R3(config-isakmp)#hash md5
R3(config-isakmp)#authentication pre-share
R3(config-isakmp)#group 2
R3(config-isakmp)#exit
R3(config)#crypto isakmp key 6 cisco123 address 200.0.0.1 no-xauth
R3(config)#access-list 101 permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255
R3(config)#crypto ipsec transform-set cisco-set esp-aes esp-md5-hmac
R3(cfg-crypto-trans)#exit
R3(config)#crypto map cisco-map 10 ipsec-isakmp
R3(config-crypto-map)#set peer 200.0.0.1
R3(config-crypto-map)#set transform-set cisco-set
R3(config-crypto-map)#match address 101
R3(config-crypto-map)#exit
R3(config)#access-list 102 deny ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255
R3(config)#access-list 102 permit ip 192.168.2.0 0.0.0.255 any
R3(config)#ip nat inside source list 102 interface f0/0 overload
R3(config)#int f0/0
R3(config-if)#ip nat outside
R3(config-if)#crypto map cisco-map
R3(config-if)#int f0/1
R3(config-if)#ip nat inside
測試要用pc2測到pc1的連通性,不能先用pc1去ping pc2,等測通後才能用pc1 ping通pc2本案例並無配置R2的路由,也沒有配置R1和R3的NAT,所以pc1和pc3都不能和R2(運營商)通訊