MGRE+OSPF综合小实验

时间:2023-03-21
本文章向大家介绍MGRE+OSPF综合小实验,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

 要求:1.左边三台设备配置OSPF 10,区域0;

       2、右边为OSPF 1 中间是Area0,下挂Area1和Area2.

       3.两个进程之间有ISP设备,需要访问公网

     4. OSPF 1区域零中,中心设备不启动动态路由协议,配置MGRE

     5.全网可达

配置思路:1.首先配置底层IP地址,打通底层链路

        2.在左边三台设备上启动ospf协议,使三台设备互通

        3.在R3上下放缺省,同时启动nat,使左侧三台设备可以访问isp

        4.对于右侧ospf area0区域,先启动MGRE,再配置ospf

        5.在R5上下发缺省,同时启动nat,使右侧设备可以访问isp

        6.在AR3和AR5之间启动GRE

     7.在AR3上写静态路由指向右侧未知网段

底层IP地址配置如图

 1.AR1,AR2,AR3起ospf

R1
[r1-ospf-1-area-0.0.0.0]network 123.0.0.1 0.0.0.0   //精准宣告 更加安全推荐使用
R2
[r2-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255  
R3省略

此时,R2ping不通r4所以需要在AR3上下放缺省

[r3-ospf-1]default-route-advertise

此时,R2还是无法ping通R4,因为R4没有回来的路由,需要在R3上做NAT

[r3-acl-basic-2000]rule permit source any
[r3-GigabitEthernet0/0/1]nat outbound 2000

此时R2可以正常访问isp服务器

2.在右侧做MGRE与OSPF

R6  HUB
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r6-Tunnel0/0/0]source 67.0.0.6
[r6-Tunnel0/0/0]nhrp entry multicast dynamic 

R8
[r8-Tunnel0/0/0]ip add 10.0.0.8 24
[r8-Tunnel0/0/0]tunnel-protocol gre p2mp
[r8-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r8-Tunnel0/0/0]nhrp entry  10.0.0.6 67.0.0.6 register 

R10
[r10-Tunnel0/0/0]ip add 10.0.0.10 24
[r10-Tunnel0/0/0]tunnel-protocol gre p2mp
[r10-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r10-Tunnel0/0/0]nhrp entry 10.0.0.6 67.0.0.6 register

R12
[r12-Tunnel0/0/0]ip add 10.0.0.12 24    
[r12-Tunnel0/0/0]tunnel-protocol gre p2mp     
[r12-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r12-Tunnel0/0/0]nhrp entry 10.0.0.6 67.0.0.6 register 

此处启用ospf协议的过程省略

因为R7不能配置动态路由协议,所以在R6,R8,R10,R12上需要配置静态路由

[r6]ip route-static 78.0.0.0 24 67.0.0.7
[r6]ip route-static 107.0.0.0 24 67.0.0.7
[r6]ip route-static 117.0.0.0 24 67.0.0.7

[r8]ip route-static 67.0.0.0 24 78.0.0.7
[r8]ip route-static 107.0.0.0 24 78.0.0.7
[r8]ip route-static 117.0.0.0 24 78.0.0.7

[r10]ip route-static 67.0.0.0 24 107.0.0.7
[r10]ip route-static 78.0.0.0 24 107.0.0.7
[r10]ip route-static 117.0.0.0 24 107.0.0.7

此时查询nhrp表有延迟,原因为nhrp注册报文时间为1800s

最后改接口类型,注意此处可以修改的选项有broadcast和p2mp类型,这两种接口类型的区别是:

broadcast需要选举br和bdr,hello时间为10s;p2mp不需要进行选举,但hello时间为40s,

我们可以选择p2mp类型,同时减少hello时间,避免broadcast类型进行br和bdr的选举,避免不同路由对dr和bdr认知不同,造成报文缺失。

在R6,R8,R10,R12上都需要修改

[r6-Tunnel0/0/0]ospf network-type p2mp
[r6-Tunnel0/0/0]ospf timer hello 10

3.在R5上重复之前R3的配置,先下放缺省,再做NAT

[r5-ospf-1]default-route-advertise always (如果这里不写always就需要写下面那条缺省)
[r5]ip route-static 0.0.0.0 0 45.0.0.4

[r5-acl-basic-2000]rule permit source any
此处的any实际上应该为右侧的环回地址(用户网段)
[r5-GigabitEthernet0/0/0]nat outbound 2000

4.在R3和R5之间启动GRE,最后在R3做静态路由指向右侧未知网段

[r3-Tunnel0/0/0]ip add 10.1.1.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre
[r3-Tunnel0/0/0]source 34.0.0.3
[r3-Tunnel0/0/0]destination 45.0.0.5

原文地址:https://www.cnblogs.com/wxy1787880204/p/17238500.html