« 在边界路由器上的ACL过滤Happy new year! »

DMVPN 配置

所谓DMVPN  (动态多点VPN ),其实就是分为两个步骤:

  1. 首先是通过NHRP建立GRE隧道的全网状互联
  2. 其次就是通过配置IPSec,来加密这些GRE隧道的数据

由于默认的GRE都是点到点的连接,所以要创建mGRE的连接,也就是全网状GRE互联,就必须用到NHRP协议。关于这方面可以查看这篇文章:NHRP 配置全网状互联GRE隧道

然后,通常情况下IPSec的配置也是两端间一对一进行配置的,如果有很多的用户,则配置过程就变得相当的复杂,为了简化配置和管理,我们就必须采用动态加密映射(dynamic crypto maps),这样可以减少很多端到端的IPSec的配置命令行。关于这方面可以查看这篇文章:GRE over IPSec
 

试验拓扑

基本配置:

Hub Router

hostname Hub
!
crypto isakmp policy 1
 hash md5
 authentication pre-share
crypto isakmp key
cisco address 0.0.0.0 0.0.0.0   //注意是通配符密码,因为中心站是不知道分支的情况的,所以这样配置能与所有的分支交换密钥
!
crypto ipsec transform-set trans esp-des esp-md5-hmac
 mode transport
!
crypto ipsec profile vpnprof
 set transform-set trans
!
interface Tunnel0
 ip address 10.0.0.1 255.255.255.0
 ip nhrp authentication test   
 ip nhrp map multicast dynamic    
 ip nhrp network-id 100000    
 ip nhrp holdtime 600    
 ip nhrp cache non-authoritative   
 no ip split-horizon eigrp 1    //由于这个是Hub端,这里要注意路由协议水平分割的问题
 no ip next-hop-self eigrp 1 //当使用EIGRP时,直接建立动态SPOKE-TO-SPOKE隧道
 tunnel source Ethernet0
 tunnel mode gre multipoint    
 tunnel key 500 
 tunnel protection ipsec profile vpnprof
!
interface Ethernet0 
  ip address 172.17.0.1 255.255.255.0 

interface Ethernet1 
  ip address 192.168.0.1 255.255.255.0 

router eigrp 1 
  network 10.0.0.0 0.0.0.255 
  network 192.168.0.0 0.0.0.255 
  no auto-summary 
!
 

Spoke1 Router

hostname Spoken1
!
crypto isakmp policy 1
 hash md5
 authentication pre-share
crypto isakmp key cisco address 0.0.0.0 0.0.0.0  //这里也是通配符密钥,因为分支也需要和其他分支通信

!
crypto ipsec transform-set trans esp-des esp-md5-hmac
 mode transport

!
crypto ipsec profile vpnprof
 set transform-set trans

!
interface Tunnel0
 ip address 10.0.0.2 255.255.255.0
 ip nhrp authentication test
 ip nhrp map 10.0.0.1 172.17.0.1  
 ip nhrp map multicast 172.17.0.1    
 ip nhrp network-id 100000
 ip nhrp holdtime 300

 ip nhrp nhs 10.0.0.1    
 ip nhrp cache non-authoritative
 tunnel source Ethernet0
 tunnel destination 172.17.0.1    //这里我在spoke的隧道上指定tunnel destination为hub路由器的接口物理地址,也可以在这里将隧道模式改为tunnel mode gre multipoint
 tunnel key 500

 
tunnel protection ipsec profile vpnprof
!
interface Ethernet0 
  ip address 172.16.1.1 255.255.255.0

interface Ethernet1 
  ip address 192.168.1.1 255.255.255.0 

router eigrp 1 
  network 10.0.0.0 0.0.0.255 
  network 192.168.1.0 0.0.0.255 
  no auto-summary 

Spoke2 Router

hostname Spoken2
!
crypto isakmp policy 1
 hash md5
 authentication pre-share
crypto isakmp key cisco address 0.0.0.0 0.0.0.0

!
crypto ipsec transform-set trans esp-des esp-md5-hmac
 mode transport

!
crypto ipsec profile vpnprof
 set transform-set trans

!
interface Tunnel0
 ip address 10.0.0.3 255.255.255.0
 ip nhrp authentication test
 ip nhrp map multicast 172.17.0.1
 ip nhrp map 10.0.0.1 172.17.0.1
 ip nhrp network-id 100000
 ip nhrp holdtime 300
 ip nhrp nhs 10.0.0.1

 ip nhrp cache non-authoritative
 tunnel source Ethernet0
 tunnel destination 172.17.0.1
 tunnel key 500

 tunnel protection ipsec profile vpnprof

!
interface Ethernet0 
  ip address 172.16.2.1 255.255.255.0

interface Ethernet1 
  ip address 192.168.2.1 255.255.255.0 

router eigrp 1 
  network 10.0.0.0 0.0.0.255 
  network 192.168.2.0 0.0.0.255 
  no auto-summary 

注意:

  • 由于隧道要进行加密,可能会遇到MTU的问题,所以可以将所有隧道的MTU改为1416(ip mtu 1416),确保大包在加密之前分片,目的设备正常重组
  • 关于DMVPN中使用的动态路由协议要注意下面几点:
    1、必须在hub路由器下关闭水平分割,允许某端口接收到的路由通告,能重新传回这个端口
    2、不能使hub路由器改变spoke路由器的IP下一条(IP next-hop)为自己

RIP:

  1. no ip split-horizon     //在接口下关闭水平分割
  2. RIP会自动使用原始的IP下一条地址,从学习到路由的接口重新通告回相同的接口

EIGRP:

  1. no ip split−horizon eigrp <as>  //在接口下关闭水平分割
  2. no ip next−hop−self eigrp <as>  //EIGRP在默认情况下会将自己的IP改为通告的路由的IP下一条,关闭这条命令,则会使用原始的IP下一条地址进行通告,这条命令在Cisco IOS release 12.3(2)以后有效。

OSPF:

ip ospf network broadcast  //通常情况下,我们会将hub路由器的接口改为point-to-multipoint模式(并且将hello时间改为和spoke接口的hello时间一直),但是这样情况下,OSPF会在spoke路由器的路由表中为各个学习到的条目增加一条到hub路由器的主机路由(host routes),这样数据包就不会直接前传到其他spoke,而是前传到hub,所以这里推荐将接口类型都改为broadcast,并将hub路由器改为DR

  • [引用] 2.飞侠
  • 非常不错哦!!!受益匪浅!!!
  • [回复留言] | [删除] 2009-2-24 2:43:32

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Powered By Z-Blog 1.8 Spirit Build 80722

Copyright 2007-2010 John Winning's Blog. All Rights Reserved.