當前位置: 華文世界 > 數位

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