之前的MGRE环境是由RIP协议来完成的路由表获取,为什么不使用OSPF协议来获取路由信息呢,原因很简单就是因为OSPF来做MGRE网络会存在一些问题,这次的配置实验主要是来解决OSPF协议下MGRE环境的搭建问题以及其配置方法。下面来看一下实验要求:
一、实验要求分析
根据以上图片,得出的信息为:
1.他没有IP的地址限制可以任意分配,R6为isp设备只允许配置IP地址,然后R1-R5都拥有自己的环回接口。
2.首先R1,R4,R5之间使用全连的的mgre机构,而R1,R2,R3之间则是使用的星型拓扑结构完成的这里是重点,我会在实验分析中说明
3.最后就是要去使用OSPF来完成路由获取,实现私网之间的相互通讯
二、IP地址的划分
IP地址没有要求相对比较自由,以下仅供参考,具体配置可根据自己喜好来完成
三、实验分析
这里我会详细的说明要求二,下面我们分两步来配置
第一步:我们首先来配置星型拓扑的MGRE环境,这里可以使用两种方式来配置,具体方法如下
方法一:将OSPF接口网络类型配置为Broadcast(这里必须要求所有的星型拓扑的MGRE环境下的路由器的接口全部配置为Broadcast才行),但是只是这样配置是无法保证100%成功的因为会受到DR/BDR选举所导致的认知不一致的问题,所以还必须指定一台设备为DR(中心设备)设备,具体解决方法就是将除了DR设备以外的其他设备的DR/BDR的选举优先级改为0即可
方法二:这个方法要优于方法一,因为此方法他是不进行DR/BDR选举的,因此不会出现认知不统一的问题,具体操作就是将将OSPF接口网络类型配置为p2mp类型就可以实现邻居的建立,这个网络接口类型可以说就是用来解决星型网络拓扑结构下的MGRE环境搭建问题而发明出来的
因为方法二比较简单这里我会使用方法一来进行配置。
第二步:配置全连的MGRE结构
这个配置其实是除了第一步中方法一和方法二以外的第三种方法,尤其和方法一有些相似但是又不完全相同,这同配置下的DR/BDR选举是可以出现BDR设备的,具体原因就是在全连的网络模式下所有的设备都是中心设备都需要向其他设备注册自己的信息,且所有的设备都开启伪广播,进而这些设备就组成了一个类似于MA的网络,他们就可以一起进行选举,进而确定DR和BDR设备,来完成通讯
四、路由器配置
一号路由器:
interface GigabitEthernet0/0/0
ip address 16.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 16.2.2.1 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack1
ip address 192.168.1.1 255.255.255.0
#
interface Tunnel0/0/0
ip address 192.168.6.1 255.255.255.0
tunnel-protocol gre p2mp
source 16.2.2.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 100
#
interface Tunnel0/0/1
ip address 192.168.7.1 255.255.255.0
tunnel-protocol gre p2mp
source 16.1.1.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 100
nhrp entry 192.168.7.2 46.0.0.1 register
nhrp entry 192.168.7.3 56.0.0.1 register
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.6.0 0.0.0.255
network 192.168.7.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 16.1.1.2
ip route-static 0.0.0.0 0.0.0.0 16.2.2.2
二号路由器:
interface GigabitEthernet0/0/0
ip address 26.0.0.1 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack1
ip address 192.168.2.1 255.255.255.0
#
interface Tunnel0/0/0
ip address 192.168.6.2 255.255.255.0
tunnel-protocol gre p2mp
source GigabitEthernet0/0/0
ospf network-type broadcast
ospf dr-priority 0
nhrp network-id 100
nhrp entry 192.168.6.1 16.2.2.1 register
#
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 192.168.2.0 0.0.0.255
network 192.168.6.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 26.0.0.2
三号路由器:
interface GigabitEthernet0/0/0
ip address 36.0.0.1 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack1
ip address 192.168.3.1 255.255.255.0
#
interface Tunnel0/0/0
ip address 192.168.6.3 255.255.255.0
tunnel-protocol gre p2mp
source GigabitEthernet0/0/0
ospf network-type broadcast
ospf dr-priority 0
nhrp network-id 100
nhrp entry 192.168.6.1 16.2.2.1 register
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 192.168.3.0 0.0.0.255
network 192.168.6.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 36.0.0.2
四号路由器:
interface GigabitEthernet0/0/0
ip address 46.0.0.1 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack1
ip address 192.168.4.1 255.255.255.0
#
interface Tunnel0/0/1
ip address 192.168.7.2 255.255.255.0
tunnel-protocol gre p2mp
source 46.0.0.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 100
nhrp entry 192.168.7.3 56.0.0.1 register
#
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 192.168.4.0 0.0.0.255
network 192.168.7.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 46.0.0.2
五号路由器:
interface GigabitEthernet0/0/0
ip address 56.0.0.1 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack1
ip address 192.168.5.1 255.255.255.0
#
interface Tunnel0/0/1
ip address 192.168.7.3 255.255.255.0
tunnel-protocol gre p2mp
source 56.0.0.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 100
nhrp entry 192.168.6.2 46.0.0.1 register
nhrp entry 192.168.6.1 16.1.1.1 register
#
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 192.168.5.0 0.0.0.255
network 192.168.7.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 56.0.0.2
六号路由器:
interface GigabitEthernet0/0/0
ip address 26.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 36.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 46.0.0.2 255.255.255.0
#
interface GigabitEthernet1/0/0
ip address 56.0.0.2 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 16.1.1.2 255.255.255.0
#
interface GigabitEthernet3/0/0
ip address 16.2.2.2 255.255.255.0
#
interface GigabitEthernet4/0/0
#
interface NULL0
四、实验结果展示
1.连接情况
2.路由获取情况