动态多点VPN配置详解 所谓DMVPN (动态多点VPN ),其实就是分为两个步骤: 1. 首先是通过NHRP建立GRE隧道的全网状互联 2. 其次就是通过配置IPSec,来加密这些GRE隧道的数据 由于默认的GRE都是点到点的连接,所以要创建mGRE的连接,也就是全网状GRE互联,就必须用到NHRP协议。关于这方面可以查看这篇文章:NHRP配置全网状互联GRE隧道
然后,通常情况下IPSec的配置也是两端间一对一进行配置的,如果有很多的用户,则配置过程就变得相当的复杂,为了简化配置和管理,我们就必须采用动态加密映射(dynamiccryptomaps),这样可以减少很多端到端的IPSec的配置命令行。关于这方面可以查看这篇文章:
GREoverIPSec
试验拓扑 file:///C:/Users/guohong/AppData/Local/Temp/msohtmlclip1/01/clip_image001.gif
基本配置:
Hub Router
hostname Hub
!
crypto isakmp policy 1
hash md5
authentication pre-share
crypto isakmp key cisco address0.0.0.00.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 authenticationtest
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 sourceEthernet0
tunnel mode gremultipoint
tunnel key 500
tunnelprotection ipsec profile vpnprof
!
interface Ethernet0
ip address 172.17.0.1255.255.255.0
!
interface Ethernet1
ip address 192.168.0.1255.255.255.0
!
router eigrp 1
network 10.0.0.00.0.0.255
network 192.168.0.00.0.0.255
no auto-summary
!
Spoke1 Router
hostname Spoken1
!
crypto isakmp policy 1
hash md5
authentication pre-share
crypto isakmp key cisco address0.0.0.00.0.0.0 //这里也是通配符密钥,因为分支也需要和其他分支通信
!
crypto ipsec transform-set transesp-desesp-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 authenticationtest
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的隧道上指定tunneldestination为hub路由器的接口物理地址,也可以在这里将隧道模式改为tunnel mode gremultipoint
tunnel key 500tunnelprotection ipsec profilevpnprof
!
interface Ethernet0
ip address 172.16.1.1255.255.255.0
!
interface Ethernet1
ip address 192.168.1.1255.255.255.0
!
router eigrp 1
network 10.0.0.00.0.0.255
network 192.168.1.00.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.00.0.0.0
!
crypto ipsec transform-set transesp-desesp-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
ipnhrp 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 tunnelprotection ipsec profile vpnprof
!
interface Ethernet0
ip address 172.16.2.1255.255.255.0
!
interface Ethernet1
ip address 192.168.2.1255.255.255.0
!
router eigrp 1
network 10.0.0.00.0.0.255
network 192.168.2.00.0.0.255
no auto-summary
!
注意: · 由于隧道要进行加密,可能会遇到MTU的问题,所以可以将所有隧道的MTU改为1416(ip mtu1416),确保大包在加密之前分片,目的设备正常重组 · 关于DMVPN中使用的动态路由协议要注意下面几点:
1、必须在hub路由器下关闭水平分割,允许某端口接收到的路由通告,能重新传回这个端口
2、不能使hub路由器改变spoke路由器的IP下一条(IP next-hop)为自己 RIP: 1. no ip split-horizon //在接口下关闭水平分割 2. RIP会自动使用原始的IP下一条地址,从学习到路由的接口重新通告回相同的接口 EIGRP: 1. no ip split栢漀爀椀稀漀渀 eigrp<as> //在接口下关闭水平分割 2. no ip next栢漀瀀猢攀氀昀 eigrp<as> //EIGRP在默认情况下会将自己的IP改为通告的路由的IP下一条,关闭这条命令,则会使用原始的IP下一条地址进行通告,这条命令在CiscoIOS release 12.3(2)以后有效。 OSPF:
ip ospf networkbroadcast //通常情况下,我们会将hub路由器的接口改为point-to-multipoint模式(并且将hello时间改为和spoke接口的hello时间一直),但是这样情况下,OSPF会在spoke路由器的路由表中为各个学习到的条目增加一条到hub路由器的主机路由(hostroutes),这样数据包就不会直接前传到其他spoke,而是前传到hub,所以这里推荐将接口类型都改为broadcast,并将hub路由器改为DR
|