目录
题目:基于OSPF的MGRE实验
步骤一:拓扑搭建
步骤二:地址配置
步骤三:公网通
步骤四:MGRE VPN配置
中心站点:R1
分支站点:
步骤五:基于MGRE环境下的OSPF配置
步骤六:测试
基于ospf的MGRE出现问题:ospf的路由表学习不全
问题1:Tunnel接口类型为P2P类型,不选举DR/BDR,使得设备无法正常建立邻接关系, 解决方法:更改网络中tunnel接口类型为广播或者P2MP
[R2]interface Tunnel 0/0/0
[R2-Tunnel0/0/0]ospf network-type broadcast
问题2:DR和BDR选举混乱,无法正常建邻
更改网络类型后,广播网络中中心站点和分支站点处于同一个广播域,此时需要进行DR和BDR的选 举,但是在分支站点的世界里只和中心站点认识,分支站点和分支站点不认识,这就会发生多个分支 站点和一个中心站点互相竞选DR和BDR,这样会造成选举结果混乱,可在中心站点看到混乱的场景 解 决方法:将分支站点的dr选举优先级变0,这样就能保证中心站点是整个广播网络中唯一的DR
R1
interface GigabitEthernet0/0/0
ip address 15.0.0.1 255.255.255.0
interface LoopBack0
ip address 192.168.1.1 255.255.255.0
R2
interface GigabitEthernet0/0/0
ip address 25.0.0.2 255.255.255.0
interface LoopBack0
ip address 192.168.2.1 255.255.255.0
R3
interface GigabitEthernet0/0/0
ip address 35.0.0.3 255.255.255.0
interface LoopBack0
ip address 192.168.3.1 255.255.255.0
R4
interface GigabitEthernet0/0/0
ip address 45.0.0.4 255.255.255.0
interface LoopBack0
ip address 192.168.4.1 255.255.255.0
R5
interface GigabitEthernet0/0/0
ip address 15.0.0.5 255.255.255.0
interface GigabitEthernet0/0/1
ip address 25.0.0.5 255.255.255.0
interface GigabitEthernet0/0/2
ip address 45.0.0.5 255.255.255.0
interface GigabitEthernet4/0/0
ip address 35.0.0.5 255.255.255.0
分别配置缺省路由:
ip route-static 0.0.0.0 0.0.0.0 15.0.0.5
ip route-static 0.0.0.0 0.0.0.0 25.0.0.5
ip route-static 0.0.0.0 0.0.0.0 35.0.0.5
ip route-static 0.0.0.0 0.0.0.0 45.0.0.5
interface Tunnel0/0/0
ip address 192.168.5.1 255.255.255.0
tunnel-protocol gre p2mp # 设置封装类型
source 15.0.0.1 # 配置源IP
ospf network-type broadcast # 修改接口类型
nhrp entry multicast dynamic # 开启伪广播
nhrp network-id 100 # 创建NHRP域
R2
interface Tunnel0/0/0
ip address 192.168.5.2 255.255.255.0
tunnel-protocol gre p2mp
source GigabitEthernet0/0/0 # 由于公网中分支站点IP地址不固定,因此使用接口来表示目标IP
ospf network-type broadcast # 修改网络类型
ospf dr-priority 0 # 等于0时表示该接口不参与DR和BDR选举
nhrp network-id 100 # 加入NHRP域
nhrp entry 192.168.5.1 15.0.0.1 register # 去该站点注册
R3
interface Tunnel0/0/0
ip address 192.168.5.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.5.1 15.0.0.1 register
R4
interface Tunnel0/0/0
ip address 192.168.5.4 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.5.1 15.0.0.1 register
R1
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.5.0 0.0.0.255
R2
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.5.0 0.0.0.255
R3
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.5.0 0.0.0.255
R4
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.5.0 0.0.0.255
路由器反复互Ping