一、实验要求
二、分析
由要求可知,r1/r2/r3为 星型拓扑,所以需要注意两个问题
1.网络类型如果为P2P的话,那么只能中心站点只能和一个路由器建立邻居关系,所以需要更改为
Broadcast类型。
2.让除了中心站点意外的路由器放弃选举。
三、配置
1.首先修改每个路由器的名称,以r1为例
[Huawei]sy r1
[r1]
2.给路由器配置IP地址以及缺省,以r1为例
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip address 22.0.0.1 24
[r1]interface g0/0/1
[r1-GigabitEthernet0/0/1]ip address 12.0.0.1 24
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.1.1 24
[r1]ip route-static 0.0.0.0 0 12.0.0.2
[r1]ip route-static 0.0.0.0 0 22.0.0.2
3.运行OSPF协议,以r1为例
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 192.168.9.1 0.0.0.0
4.配置r1/r2/r3的GRE环境
[r1-Tunnel0/0/1]ip address 192.168.10.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source 22.0.0.1
[r1-Tunnel0/0/1]nhrp network-id 110
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
4.配置r1/4/5的全连MGRE
[r1]int t 0/0/0
[r1-Tunnel0/0/0]ip address 192.168.9.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 12.0.0.1
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1]display nhrp peer all
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
192.168.9.2 32 52.0.0.1 192.168.9.2 dynamic route tunnel
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:26:46
Expire time : 01:33:14
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
192.168.9.3 32 62.0.0.1 192.168.9.3 dynamic route tunnel
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:26:31
Expire time : 01:33:29
Number of nhrp peers: 2
四、测试
r1的路由表
[r1]display ospf peer brief
OSPF Process 1 with Router ID 1.1.1.1
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Tunnel0/0/0 4.4.4.4 Full
0.0.0.0 Tunnel0/0/0 5.5.5.5 Full
全网可达
<r1>ping 192.168.4.1
PING 192.168.4.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.4.1: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 192.168.4.1: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 192.168.4.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 192.168.4.1: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.4.1: bytes=56 Sequence=5 ttl=255 time=20 ms