MGRE环境下的OSPF实验

本文详细描述了如何在R1、R2、R3上配置星型网络和R1、R4、R5间的MGRE结构,涉及规划网段、设置缺省路由,并利用OSPF实现私有网段间的通信。同时展示了R1上的关键配置步骤和OSPF路由表状态。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在这里插入图片描述规划网段,配置路由,写缺省路由
在这里插入图片描述R1:
G 0/0/1 16.0.0.1 24
G 0/0/0 116.0.0.1 24
L0 192.168.1.1 24
R2:
G 0/0/0 26.0.0.1 24
L0 192.168.2.1 24
R3:
G 0/0/0 36.0.0.1 24
L0 192.168.3.1 24
R4:
G 0/0/0 46.0.0.1 24
L0 192.168.4.1 24
R5:
G 0/0/0 56.0.0.1 24
L0 192.168.5.1 24
R6(ISP):
G 0/0/1 16.0.0.2 24
G 0/0/0 116.0.0.2 24
G 4/0/2 26.0.0.2 24
G 4/0/1 36.0.0.2 24
G 4/0/0 46.0.0.2 24
G 0/0/2 56.0.0.2 24

需求2:
R1/R4/R5为全连的MGRE结构
在R1上:

[r1]int t 0/0/1  #创建虚拟隧道
[r1-Tunnel0/0/1]ip address 192.168.6.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp #选择协议类型
[r1-Tunnel0/0/1]source 116.0.0.1  #写源ip(固定)
Jul 13 2022 10:01:55-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface Tunnel0/0/1 has entered the UP state. 
[r1-Tunnel0/0/1]nhrp network-id 200
[r1-Tunnel0/0/1]nhrp entry multicast dynamic 

[r1-Tunnel0/0/1]nhrp entry 192.168.6.2 46.0.0.1 register  #目的ip(实际和虚拟)

[r1-Tunnel0/0/1]nhrp entry 192.168.6.3 56.0.0.1 register 

在R4上:
(同理R1)

[r4]int t 0/0/0
[r4-Tunnel0/0/0]ip address 192.168.6.2 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source 46.0.0.1
Jul 13 2022 10:04:20-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r4-Tunnel0/0/0]nhrp network-id 200
[r4-Tunnel0/0/0]nhrp entry multicast dynamic
[r4-Tunnel0/0/0]nhrp entry 192.168.6.1 116.0.0.1 register 
Info: This peer protocol address conflicts with hub register peer protocol addre
ss. 
[r4-Tunnel0/0/0]nhrp entry 192.168.6.3 56.0.0.1 register 

在R5上:

[r5]int t 0/0/0
[r5-Tunnel0/0/0]ip address 192.168.6.3 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r5-Tunnel0/0/0]source 56.0.0.1
Jul 13 2022 10:05:22-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 

[r5-Tunnel0/0/0]nhrp network-id 200
[r5-Tunnel0/0/0]nhrp entry multicast dynamic 
[r5-Tunnel0/0/0]nhrp entry 192.168.6.1 116.0.0.1 register 
Info: This peer protocol address conflicts with hub register peer protocol addre
ss. 

[r5-Tunnel0/0/0]nhrp entry 192.168.6.2 46.0.0.1 register 

查看配置(因为都是“中心站点”,所以在R1/R4/R5上查看均可):

[r5-Tunnel0/0/0]display nhrp peer al
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
192.168.6.1     32    116.0.0.1       192.168.6.1     dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:02:48
Expire time     : 01:57:12
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
192.168.6.2     32    46.0.0.1        192.168.6.2     dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:00:47
Expire time     : 01:59:13

Number of nhrp peers: 2

R1/R2/R3为星型拓扑,R1为中心站点
在R1上

[r1]int t 0/0/0 #创建虚拟隧道
[r1-Tunnel0/0/0]ip address 192.168.7.1 24 #配置ip
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 16.0.0.1  #源ip
Jul 13 2022 09:53:09-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp entry multicast dynamic 

在R2上:

[r2]int t 0/0/0 
[r2-Tunnel0/0/0]ip address 192.168.7.2 24  #创建虚拟隧道并配置ip
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp  #选择网络类型
[r2-Tunnel0/0/0]source g 0/0/0
Jul 13 2022 09:56:01-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r2-Tunnel0/0/0]nhrp network-id 100
[r2-Tunnel0/0/0]nhrp entry 192.168.7.1 16.0.0.1 register  #目的ip(实际和虚拟)

在R3上:
(同理R2)

[r3]int t 0/0/0
[r3-Tunnel0/0/0]ip address 192.168.7.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source g 0/0/0
Jul 13 2022 09:57:38-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry 192.168.7.1 16.0.0.1 register 

在R1上查看:

[r1-Tunnel0/0/0]display nhrp peer all
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
192.168.7.2     32    26.0.0.1        192.168.7.2     dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:00:23
Expire time     : 01:59:37
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
192.168.7.3     32    36.0.0.1        192.168.7.3     dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:00:18
Expire time     : 01:59:42

Number of nhrp peers: 2
[r1-Tunnel0/0/0]

需求3:
所有私有网络可以互相通讯,私有网段使用OSPF完成
在R1上:

[r1]ospf 1 router-id 1.1.1.1  #配置ospf
[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.6.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]q
[r1-ospf-1]q
[r1]int t 0/0/0
[r1-Tunnel0/0/0]ospf network-type p2mp #R1/R2/R3星型网络拓扑隧道网络类型:p2mp(中心站点)
[r1-Tunnel0/0/1]ospf network-type broadcast # R1/R4/R5 MGRE 网络类型:广播

在R2上:
(R3同理)

[r2]ospf 1 router-id 2.2.2.2
Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r2-Tunnel0/0/0]ospf network-type p2mp
[r2-Tunnel0/0/0]
[r2]display ip routing-table protocol ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 7        Routes : 7        

OSPF routing table status : <Active>
         Destinations : 7        Routes : 7

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.1/32  OSPF    10   1562        D   192.168.7.1     Tunnel0/0/0
    192.168.3.1/32  OSPF    10   3124        D   192.168.7.1     Tunnel0/0/0
    192.168.4.1/32  OSPF    10   3124        D   192.168.7.1     Tunnel0/0/0
    192.168.5.1/32  OSPF    10   3124        D   192.168.7.1     Tunnel0/0/0
    192.168.6.0/24  OSPF    10   3124        D   192.168.7.1     Tunnel0/0/0
    192.168.7.1/32  OSPF    10   1562        D   192.168.7.1     Tunnel0/0/0
    192.168.7.3/32  OSPF    10   3124        D   192.168.7.1     Tunnel0/0/0

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0

在R4上:
(R5同理)

[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]
[r4-Tunnel0/0/0]ospf network-type broadcast 
[r4]display ip routing-table protocol ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 7        Routes : 7        

OSPF routing table status : <Active>
         Destinations : 7        Routes : 7

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.1/32  OSPF    10   1562        D   192.168.6.1     Tunnel0/0/0
    192.168.2.1/32  OSPF    10   3124        D   192.168.6.1     Tunnel0/0/0
    192.168.3.1/32  OSPF    10   3124        D   192.168.6.1     Tunnel0/0/0
    192.168.5.1/32  OSPF    10   1562        D   192.168.6.3     Tunnel0/0/0
    192.168.7.1/32  OSPF    10   1562        D   192.168.6.1     Tunnel0/0/0
    192.168.7.2/32  OSPF    10   3124        D   192.168.6.1     Tunnel0/0/0
    192.168.7.3/32  OSPF    10   3124        D   192.168.6.1     Tunnel0/0/0

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0
### OSPF Point-to-Multipoint Configuration with MGRE Tunneling Explanation and Setup Guide #### Understanding the Basics of OSPF Point-to-Multipoint Networks In a point-to-multipoint network type within OSPF, routers do not elect Designated Routers (DRs) or Backup Designated Routers (BDRs). Neighbors are established directly between endpoints. The default Hello interval is set to 30 seconds while the Dead interval stands at 120 seconds[^1]. This configuration simplifies neighbor establishment but requires careful planning when integrating advanced features like Multi-Point GRE tunnels. #### Introduction to Multi-Point GRE Tunnels Multi-Point GRE (mGRE) allows multiple remote sites to connect through a single virtual interface on an endpoint device without requiring individual physical interfaces for each connection. mGRE can significantly reduce complexity in hub-and-spoke topologies by enabling dynamic tunnel creation based on IPsec policies or other criteria. #### Combining OSPF Point-to-Multipoint Network Type with mGRE When combining these two technologies: - **Hub Router**: Configured as both ends of all spokes' mGRE sessions. - **Spoke Routers**: Each configured individually pointing back towards the central hub router's public address over which they will establish their respective mGRE session(s). The combination leverages OSPF’s ability to form adjacencies easily across non-broadcast multi-access networks such as those created via mGRE tunnels. It also benefits from OSPF's inherent support for point-to-multipoint configurations where DR/BDR elections aren't necessary due to direct adjacency formation among participating nodes. #### Example Configuration Steps for Hub Router Using Huawei CLI Syntax Below demonstrates how one might configure this scenario using commands similar to what would be found in a typical enterprise-grade environment provided by vendors like Huawei. ```shell # Enter system view mode system-view # Create loopback interface used for establishing mGRE connections interface LoopBack0 ip address 192.168.1.1 255.255.255.255 # Configure real Ethernet port that connects outside world interface GigabitEthernet0/0/1 ip address dhcp # Define mGRE template tunnel-template gre multipoint name mgre-tpl source-interface LoopBack0 destination any # Apply mGRE settings onto actual tunnel interface interface Tunnel0 undo ip address tunnel-protocol gre multipoint apply tunnel-template mgre-tpl ospf enable area 0 ``` For spoke routers, replace `source-interface` command under `tunnel-template` section accordingly depending upon local addressing scheme; ensure consistency throughout entire deployment regarding naming conventions applied here too. #### Verification Commands After Setup Completion Once completed successfully, verify operation status utilizing following instructions available inside most modern networking gear including models produced by companies mentioned earlier: ```shell display ospf peer brief # Check current state of OSPF peers display ip routing-table # Review learned routes after convergence has occurred ping -a <Source_IP> <Destination_IP> # Test reachability between different segments involved ``` --related questions-- 1. How does changing OSPF hello/dead timers affect stability in large-scale deployments? 2. What considerations should administrators take into account before implementing mGRE solutions? 3. Can you explain more about configuring OSPF route-id specifically for devices running OSPF protocol? 4. In what scenarios could deploying OSPF stub areas improve performance compared against standard ones?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值