取消
显示结果 
搜索替代 
您的意思是: 
cancel
679
查看次数
0
有帮助
0
评论
碧云天
Spotlight
Spotlight
一.概述
    当分支机构为动态地址时(中心有固定公网IP),普通的动态crypto map无法实现跑动态路由,思科的这个文章提供了另外一种思路,https://www.cisco.com/c/en/us/td/docs/solutions/Enterprise/WAN_and_MAN/P2P_GRE_IPSec/P2P_GRE_IPSec/5_p2pGRE.html
它的思路就是,分支机构利用环回口作为tunnel接口的源地址,分支到总部GRE流量源地址为分支环回口地址,目标地址为总部可公网路由的VPN地址。因为GRE的流量是封装在IPsec流量里面,所以分支的环回口地址并不需要能在公网上可路由。再配合总部使用Dynamic MAP,这就能很好的实现分支为动态地址,同时又跑动态路由协议,因为有动态路由协议存在,不管是分支还是总部都能首先发起流量。

备注:如果配合DDNS,Branch配置peer的时候用动态域名,则可以实现双动态IP,并且跑动态路由协议。

二.测试拓扑

    测试的拓扑,与思科网站的拓扑不同,总部和分支的VPN设备都是在NAT后面,其中分支为动态PAT,总部为静态PAT。这种部署主要问题是分支的tunnel口目标地址不能是总部的公网地址,需要是NAT后面VPN接口的实际地址,否则,封装在IPSec中GRE的数据被Center-VPN解密之后,会认为不是发给自己的,从而又转发给自己的网关。



三.配置步骤
1.基本配置
①Branch-VPN
hostname Branch-VPN
interface Loopback0
    ip address 1.1.1.1 255.255.255.0
interface Loopback1
    ip address 11.11.11.11 255.255.255.255
interface Ethernet0/0
    ip address 192.168.1.1 255.255.255.0
    no shutdow
ip route 0.0.0.0 0.0.0.0 192.168.1.10
②Branch路由器
hostname Branch
interface Ethernet0/0
    ip address 192.168.1.10 255.255.255.0
    ip nat inside
    no shutdow
interface Ethernet0/1
    ip address 202.100.1.1 255.255.255.0
    ip nat outside
    no shutdown
ip route 0.0.0.0 0.0.0.0 202.100.1.10
③Internet路由器
hostname Internet
interface Ethernet0/0
    ip address 202.100.1.10 255.255.255.0
    no shutdow
interface Ethernet0/1
    ip address 61.128.1.10 255.255.255.0
    no shutdow
④Center路由器
hostname Center
interface Ethernet0/0
    ip address 61.128.1.1 255.255.255.0
    ip nat outside
    no shutdow
interface Ethernet0/1
    ip address 10.1.1.10 255.255.255.0
    ip nat inside
    no shutdow
ip route 0.0.0.0 0.0.0.0 61.128.1.10
⑤Center-VPN路由器
interface Loopback0
    ip address 2.2.2.2 255.255.255.0
interface Ethernet0/0
    ip address 10.1.1.1 255.255.255.0
    no shutdow
ip route 0.0.0.0 0.0.0.0 10.1.1.10
2.GRE隧道配置
①Branch-VPN
interface Tunnel0
    ip address 172.16.1.1 255.255.255.0
    tunnel source Loopback1
    tunnel destination 10.1.1.1
备注:目的地址必须为VPN设备的tunnel源地址,否正对方路由器把处于ESP内部封装的GRE流量解封之后,会认为不是发给自己的。
Center-VPN路由器
interface Tunnel0
    ip address 172.16.1.100 255.255.255.0
    tunnel source Ethernet0/0
    tunnel destination 11.11.11.11
③测试
这个时候从Branch-VPN 以自己tunnel口源地址,ping总部tunnel地址,虽然ping不通,但是可以看出源和目的地址,
3.NAT配置
①Branch路由器
ip access-list extended pat
    permit ip 192.168.1.0 0.0.0.255 any
ip nat inside source list pat interface Ethernet0/1 overload

②Center路由器
ip nat inside source static udp 10.1.1.1 500 interface Ethernet0/0 500
ip nat inside source static udp 10.1.1.1 4500 interface Ethernet0/0 4500
3.VPN及动态路由配置
①Branch-VPN路由器
--第一阶段策略
crypto isakmp policy 10
    encr 3des
    hash md5
    authentication pre-share
    group 2
crypto isakmp key cisco address 61.128.1.1
--第二节阶段转换集
crypto ipsec transform-set transet esp-3des esp-md5-hmac
备注:实际测试发现,存在NAT的情况下,都会是tunnel模式,即使配置成transport模式
---配置感兴趣流
ip access-list extended gre
    permit gre host 11.11.11.11 host 10.1.1.1
---配置静态crypto map
crypto map crymap 10 ipsec-isakmp
    set peer 61.128.1.1
    set transform-set transet
    match address gre
---配置DPD
crypto isakmp keepalive 10
---物理口应用静态crypto map
interface Ethernet0/0
     crypto map crymap
--配置动态路由
router ospf 1
    network 1.1.1.0 0.0.0.255 area 0
    network 172.16.1.0 0.0.0.255 area 0
②Center-VPN路由器
--第一阶段策略
crypto isakmp policy 10
    encr 3des
    hash md5
    authentication pre-share
    group 2
crypto isakmp key cisco address 0.0.0.0 0.0.0.0
--第二节阶段转换集
crypto ipsec transform-set transet esp-3des esp-md5-hmac
---配置动态及静态crypto map
crypto dynamic-map dymap 10
    set transform-set transet
crypto map crymap 10 ipsec-isakmp dynamic dymap
---配置DPD
crypto isakmp keepalive 10
---物理口应用静态crypto map
interface Ethernet0/0
     crypto map crymap
--配置动态路由
router ospf 1
    network 2.2.2.0 0.0.0.255 area 0
    network 172.16.1.0 0.0.0.255 area 0
四.验证
1.通过在Branch路由器公网口抓包可以看到,VPN能正常协商,并且有来回的ESP加密包

2.两边都能正常通过OSPF学习到路由





入门指南

使用上面的搜索栏输入关键字、短语或问题,搜索问题的答案。

我们希望您在这里的旅程尽可能顺利,因此这里有一些链接可以帮助您快速熟悉思科社区: