当前位置: 华文世界 > 数码

CISCO 路由器DMVPN的快速配置

2024-01-24数码

动态多点虚拟专网DMVPN是思科私有协议,基于多点GRE(MGRE)实现高速和高扩展性的IPSec VPN技术;企业通过公网安全地将各地的分支机构与中心站点之间联系起来,构成星型拓扑结构网络并通过IPSec隧道来保证内部通信流量的安全;如果两个分支之间需要通信,不要通过中心站点,DMVPN技术为企业解决了这方面的难题。

DMVPN主要包括单个方面的技术

• 1.MGRE(Multipoint GRE),多点GRE。便于在VPN隧道中能够传送组播报文(如动态路由协议报文)

• 2.NHRP协议(Next Hop Resolution Protocol ),下一跳地址解析协议。动态收集、维护和发布分支节点的公网地址信息,解决了分支节点动态公网IP地址问题。

• 3.路由协议 :RIP、EIGRP、OSPF、BGP

• 4.可选的IPSec封装,实现数据的安全传输。

配置思路:

1.基础配置完成后,配置MGRE

2.配置NHRP映射关系

3.配置动态路由协议传递私网路由

4.配置IPSEC保护私网数据

拓扑说明

总部HUB和两分部SPOKE通过ISP公网互联,各站点均下挂私网网段(Lo 0模拟)

要求,分部私网之间直接通过IPSEC加密通讯不经过HUB。

详细配置

ISP配置

hostname ISP

interface GigabitEthernet0/1

ip address 11.0.0.2 255.255.255.0

interface GigabitEthernet0/2

ip address 22.0.0.2 255.255.255.0

interface GigabitEthernet0/3

ip address 33.0.0.2 255.255.255.0

总部HUB配置

hostname HUB

interface Loopback0

ip address 1.1.1.1 255.255.255.255

interface Tunnel0

ip address 123.0.0.1 255.255.255.0

interface GigabitEthernet0/0

ip address 11.0.0.1 255.255.255.0

ip route 0.0.0.0 0.0.0.0 11.0.0.2

//基础配置接口IP地址,默认路由

interface Tunnel0

ip nhrp authentication cisco

ip nhrp network-id 123

ip nhrp map multicast dynamic

tunnel source 11.0.0.1

tunnel mode gre multipoint

//配置Tunnel0模式多点GRE,源接口地址,NHRP协议 ID123 认证密码cisco, 组播动态映射

router rip

version 2

network 1.0.0.0

network 123.0.0.0

no auto-summary

interface Tunnel0

no ip split-horizon

//配置RIP协议交互Tunnel及lo0路由,在出接口关闭水平分割(否则由于防环原则分部之间收不到对方路由)

crypto isakmp policy 10

encr 3des

hash md5

authentication pre-share

group 2

crypto isakmp key cisco address 0.0.0.0

crypto ipsec transform-set AA esp-3des esp-md5-hmac

crypto ipsec profile AA

set transform-set AA

//配置IPSEC,由于DMVPN的加密隧道是动态建立,此处配置模板,不需要感兴趣流和指定规定的对端地址,预共享密钥指定的对端地址为任意(0.0.0.0)

interface Tunnel0

tunnel protection ipsec profile AA

//在tunnel0 应用IPSEC模板

分部SPOKE1 配置

hostname SPOKE1

interface Loopback0

ip address 2.2.2.2 255.255.255.255

interface Tunnel0

ip address 123.0.0.2 255.255.255.0

interface GigabitEthernet0/0

ip address 22.0.0.1 255.255.255.0

ip route 0.0.0.0 0.0.0.0 22.0.0.2

//基础配置接口IP地址,默认路由

interface Tunnel0

ip nhrp authentication cisco

ip nhrp map 123.0.0.1 11.0.0.1

ip nhrp map multicast 11.0.0.1

ip nhrp network-id 123

ip nhrp nhs 123.0.0.1

tunnel source 22.0.0.1

tunnel mode gre multipoint

//配置Tunnel0模式多点GRE,源接口地址,NHRP协议 ID123 认证密码cisco, NHS地址为HUB地址,单播组播分别映射为HUB公网地址

router rip

version 2

network 2.0.0.0

network 123.0.0.0

no auto-summary

//配置RIP协议交互Tunnel及lo0路由

crypto isakmp policy 10

encr 3des

hash md5

authentication pre-share

group 2

crypto isakmp key cisco address 0.0.0.0

crypto ipsec transform-set AA esp-3des esp-md5-hmac

crypto ipsec profile AA

set transform-set AA

interface Tunnel0

tunnel protection ipsec profile AA

//配置IPSEC,由于DMVPN的加密隧道是动态建立,此处配置模板,不需要感兴趣流和指定规定的对端地址,预共享密钥指定的对端地址为任意(0.0.0.0)在tunnel0 应用IPSEC模板

分部SPOKE2配置

hostname SPOKE2

crypto isakmp policy 10

encr 3des

hash md5

authentication pre-share

group 2

crypto isakmp key cisco address 0.0.0.0

crypto ipsec transform-set AA esp-3des esp-md5-hmac

crypto ipsec profile AA

set transform-set AA

interface Loopback0

ip address 3.3.3.3 255.255.255.255

interface Tunnel0

ip address 123.0.0.3 255.255.255.0

ip nhrp authentication cisco

ip nhrp map 123.0.0.1 11.0.0.1

ip nhrp map multicast 11.0.0.1

ip nhrp network-id 123

ip nhrp nhs 123.0.0.1

tunnel source 33.0.0.1

tunnel mode gre multipoint

tunnel protection ipsec profile AA

interface GigabitEthernet0/0

ip address 33.0.0.1 255.255.255.0

router rip

version 2

network 3.0.0.0

network 123.0.0.0

no auto-summary

ip route 0.0.0.0 0.0.0.0 33.0.0.2

配置完成就检查IP路由表,NHRP映射关系,IPSEC加密状态正常。

分部之间互通IPSEC隧道正常建立,互通正常

注意如果各个节点之间运行 eigrp协议

需要的HUB的tunnnel口配置关闭水平分割(距离矢量协议都需要配置)

需要的HUB的tunnnel口配置关闭Eigrp传递路由改变下一跳(这里配置为不改变下一跳即携带原有下一跳,否则Spoke端互通会经过下一跳HUB,形成次优路径)

interface Tunnel0

no ip split-horizon eigrp 100

no ip next-hop-self eigrp 100

如果各个节点之间运行 OSPF协议

需要的 所有的tunnnel口 配置接口模式为广播(默认tunnel接口在OSPF中都是P2P类型,无法建立多点Tunnel之间的邻居关系,都要改,接口类型一致。如果SPOKE不改类型会导致有邻居无路由MA-P2P建立邻居的状况)

interface Tunnel0

ip ospf network broadcast

需要将HUB端配置为DR,SPOKE端配置为DR other,确保路由信息由HUB发布。

在SPOKE端配置OPSF 优先级0 角色为DR other

interface Tunnel0

ip ospf priority 0