环境:
1:R1为固定公网IP地址
2:R3为拨号上网:获得的动态的公网IP
需求:R1和R3之间如何建立
IPSec VPN:
涉及知识点:
1
ynamic Map (条件必须有一方是静态的IP地址)
2
eer的指定:
步骤:
1:R3上的IPSec配置:
==>R3上Phase 1配置:
R3(config)#crypto isakmp policy 10
R3(config-isakmp)#authentication pre-shared
R3(config-isakmp)#encry des
R3(config-isakmp)#hash md5
R3(config-isakmp)#group 2
R3(config-isakmp)#lifetime 3600
R3(config-isakmp)#exit
R3(config)#crypto isakmp key
cisco add 1.1.1.1
==>R3上Phase 2配置:
R3(config)#crypto ipsec transform-set TS esp-des esp-md5-hmac
R3(cfg-crypto-trans)#mode tunnel
R3(cfg-crypto-trans)#exit
R3(config)#crypto map MYMAP 10 ipsec-isakmp
R3(config-crypto-map)#set peer 1.1.1.1
R3(config-crypto-map)#set transform-set TS
R3(config-crypto-map)#match address 110
R3(config-crypto-map)#exit
R3(config)#access-list 110 permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255
R3(config)#int f1/0
R3(config-if)#crypto map MYMAP
R3(config-if)#end
2:R1上的IPSec配置:
==>R1上Phase 1配置:
R1(config)#crypto isakmp policy 10
R1(config-isakmp)#authen pre-share
R1(config-isakmp)#encry des
R1(config-isakmp)#hash md5
R1(config-isakmp)#group 2
R1(config-isakmp)#exit
R1(config)#crypto isakmp key cisco add 0.0.0.0 :这里注意:由于对端Peer是拨号上网,只能IP地址无法得知,所以只能使用0.0.0.0
==>R1上Phase 2配置:
R1(config)#crypto ipsec transform-set TS esp-des esp-md5-hmac
R1(cfg-crypto-trans)#mode tunnel
R1(cfg-crypto-trans)#exit
R1(config)#crypto dynamic-map DYNAMIC 10 :
R1(config-crypto-map)#set transform-set TS :
R1(config-crypto-map)#set peer 0.0.0.0 :由于对端是拨号上网,公网IP根本无法主动得知,所以无法指定Peer的IP地址,而且IPSec VPN (在一些平台上该命令无法敲,提示unset,没关系)
R1(config-crypto-map)#exit :的协商只能由拨号方发起,否则无法协商.(因为固定方根本不知道该往何处协商)
R1(config)#crypto map MYMAP 10 ipsec-isakmp dynamic NYNAMIC :新建一个Static-map调用动态MAP
R1(config-crypto-map)#exit
注意:
1
ynamic-MAP :固定IP这方,已经不需要定义感兴趣流量 , 因为本端根本不会主动发起连接:不知道Peer的IP地址:当时建议你还是在MAP指定
, 这样可以把进入接口并且匹配MAP的明文流量DROP.
2:这里注意由于有一方的Peer是动态IP,所以这里你必须使用Dynamic-map,用于区分不同的环境 , 又由于接口下只能调用Static-map , 所以接
下来我们还需创建一个Static-map , 调 用动态MAP , 然后再在接口下调用Static-map
R1(config)#int f0/0
R1(config-if)#cry
R1(config-if)#crypto map MYMAP
R1(config-if)#END