MGRE与OSPF联动组建Hub-Spoke结构

拓扑结构规划如下:
HuaWei ❀ MGRE与OSPF联动组建Hub-Spoke结构_优先级

IP地址配置:
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
(配置类似,此处省略)

配置静态路由到达R2:
[r1]ip route-static 0.0.0.0 0 12.1.1.2
(R3/R4配置类似,下一跳指向R2)

Hub端配置:
[r1]int Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 100.1.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 12.1.1.1
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp entry multicast dynamic

Spoke端配置:
[r3]int Tunnel 0/0/0
[r3-Tunnel0/0/0]ip address 100.1.1.2 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source 23.1.1.2
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry 100.1.1.1 12.1.1.1 re
[r3-Tunnel0/0/0]nhrp entry 100.1.1.1 12.1.1.1 register

[r1]ospf 100 rou
[r1]ospf 100 router-id 91.1.1.1
[r1-ospf-100]area 0
[r1-ospf-100-area-0.0.0.0]network 100.1.1.0 0.0.0.255
[r1-ospf-100-area-0.0.0.0]network 1.1.1.1 0.0.0.0

修改Tunnel接口OSPF网络类型:
[r1-Tunnel0/0/0]ospf network-type ?
broadcast Specify OSPF broadcast network
nbma Specify OSPF NBMA network
p2mp Specify OSPF point-to-multipoint network
p2p Specify OSPF point-to-point network
(BMA网络选择Broadcast;P2MP选择p2mp)

若为BMA网络,此时会选举DR/BDR,若DR不在Hub端将无法正常建立邻居关系,因此需要修改接口DR优先级,取值越大越优先,为0表示不参加选举;P2MP不进行DR/BDR选举。

修改接口DR优先级:
[r1-Tunnel0/0/0]ospf dr-priority ?
INTEGER<0-255> Router priority value

查看NHRP协议会话:
HuaWei ❀ MGRE与OSPF联动组建Hub-Spoke结构_静态路由_02

结果验证:
HuaWei ❀ MGRE与OSPF联动组建Hub-Spoke结构_静态路由_03