OSPF接口网络类型实验

本文详细描述了如何在ISP与多个私有网络间构建全连的MGRE结构和星型拓扑,通过配置IP地址、路由、MGRE隧道以及OSPF协议,确保所有私有网段间通信,并展示了路由器间的OSPF邻居状态检查。
摘要由CSDN通过智能技术生成

在这里插入图片描述

一、要求

1、R6为ISP只能配置ip地址,R1-5的环回为私有网段
2、R1/4/5为全连的MGRE结构,R1/2/3为星型的拓扑结构,R1为中心站点
3、所有私有网段可以互相通讯,私有网段使用OSPF协议完成

二、分析

1. MGRE接口方式为p2p,只能建立一个邻居,所以需要把所有的节点修改接口方式为broadcast
2.需要建立两个Tunnel

三、划分网段

环回接口网段:
192.168.1.0/24 -----r1的环回网段
	192.168.1.0/25 ----r1的环回接口地址0
	192.168.1.128/25 ----r1的环回接口地址1
192.168.2.0/24 -----r2的环回
	192.168.2.1/24 ----r2的环回接口地址
192.168.3.0/24 -----r3的环回
	192.168.3.1/24 ----r3的环回接口地址
192.168.4.0/24 -----r4的环回
	192.168.4.1/24 ----r4的环回接口地址
192.168.5.0/24 -----r5的环回
	192.168.5.1/24 ---- r5的环回接口地址
设备直连网段:
16.1.1.0/24 ----- r1到r6(上)
16.1.2.0/24 ----- r1到r6(下)
26.1.1.0/24 ----- r2到r6
36.1.1.0/24 ----- r3到r6
46.1.1.0/24 ----- r4到r6
56.1.1.0/24 ----- r5到r6
虚拟隧道网段:
1,R1/R4/R5为全连的MGRE结构网段:
	10.1.1.0/24
		10.1.1.1/24-----r1隧道1口
  		10.1.1.2/24-----r4隧道0口
  		10.1.1.3/24-----r5隧道0口
2,R1/R2/R3为星型的拓扑结构网段:
	10.1.2.0/24
  		10.1.2.1/24-----r1隧道0口
  		10.1.2.2/24-----r2隧道0口
  		10.1.2.3/24-----r3隧道0口

在这里插入图片描述

四、配置

1.IP地址配置
R1
<Huawei>sys
[Huawei]sysn r1
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 16.1.1.1 24
[r1-GigabitEthernet0/0/0]int g 0/0/1
[r1-GigabitEthernet0/0/1]ip add 16.1.2.1 24
[r1-GigabitEthernet0/0/1]int l 0
[r1-LoopBack0]ip add 192.168.1.1 25
[r1-LoopBack0]int l 1
[r1-LoopBack1]ip add 192.168.1.129 25

R2
<Huawei>sys
[Huawei]sysn r2
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 26.1.1.1 24
[r2-GigabitEthernet0/0/0]int l 0
[r2-LoopBack0]ip add 192.168.2.1 24

R3
<Huawei>sys
[Huawei]sysn r3
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 36.1.1.1 24
[r3-GigabitEthernet0/0/0]int l 0
[r3-LoopBack0]ip add 192.168.3.1 24

R4
<Huawei>sys
[Huawei]sysn r4
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 46.1.1.1 24
[r4-GigabitEthernet0/0/0]int l 0
[r4-LoopBack0]ip add 192.168.4.1 24

R5
<Huawei>sys
[Huawei]sysn r5
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip add 56.1.1.1 24
[r5-GigabitEthernet0/0/0]int l 0
[r5-LoopBack0]ip add 192.168.5.1 24

R6
<Huawei>sys
[Huawei]sysn ISP
[isp]int g 0/0/0
[isp-GigabitEthernet0/0/0]ip add 16.1.1.6 24
[isp-GigabitEthernet0/0/0]int g 0/0/1
[isp-GigabitEthernet0/0/1]ip add 16.1.2.6 24
[isp-GigabitEthernet0/0/1]int g 0/0/2
[isp-GigabitEthernet0/0/2]ip add 26.1.1.6 24
[isp-GigabitEthernet0/0/2]int g 1/0/0
[isp-GigabitEthernet1/0/0]ip add 36.1.1.6 24
[isp-GigabitEthernet1/0/0]int g 2/0/0
[isp-GigabitEthernet2/0/0]ip add 46.1.1.6 24
[isp-GigabitEthernet2/0/0]int g 3/0/0
[isp-GigabitEthernet3/0/0]ip add 56.1.1.6 24

2.配置路由
[r1]ip route-static 0.0.0.0 0 16.1.1.6
[r1]ip route-static 0.0.0.0 0 16.1.2.6
[r2]ip route-static 0.0.0.0 0 26.1.1.6
[r3]ip route-static 0.0.0.0 0 36.1.1.6
[r4]ip route-static 0.0.0.0 0 46.1.1.6
[r5]ip route-static 0.0.0.0 0 56.1.1.6

3.r1/r4/r5配置
MGRE配置

R1
[r1]int Tunnel 0/0/1
[r1-Tunnel0/0/1]shutdown   -----先关闭隧道接口,在配置完后才打开
[r1-Tunnel0/0/1]ip add 10.1.1.1 24	
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp 
[r1-Tunnel0/0/1]source GigabitEthernet 0/0/1
[r1-Tunnel0/0/1]nhrp entry 10.1.1.2 46.1.1.1 register 
[r1-Tunnel0/0/1]nhrp entry 10.1.1.3 56.1.1.1 register
[r1-Tunnel0/0/1]undo shutdown  //在配置时要先关闭R1的0/0/1隧道接口:如果不关闭接口,会导致后面部分注册配置无法生效

R4
[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]shutdown 
[r4-Tunnel0/0/0]ip add 10.1.1.2 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r4-Tunnel0/0/0]nhrp entry 10.1.1.1 16.1.2.1 register 
[r4-Tunnel0/0/0]nhrp entry 10.1.1.3 56.1.1.1 register 
[r4-Tunnel0/0/0]undo shutdown 

R5
[r5]int Tunnel 0/0/0
[r5-Tunnel0/0/0]shutdown 
[r5-Tunnel0/0/0]ip add 10.1.1.3 24	
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r5-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r5-Tunnel0/0/0]nhrp entry 10.1.1.1 16.1.2.1 register 
[r5-Tunnel0/0/0]nhrp entry 10.1.1.2 46.1.1.1 register 
[r5-Tunnel0/0/0]undo shutdown 

//修改ospf接口类型为Broadcast
[r1-Tunnel0/0/1]ospf network-type broadcast 
[r4-Tunnel0/0/0]ospf network-type broadcast 
[r5-Tunnel0/0/0]ospf network-type broadcast 

4.r1/r2/r3配置
星型拓扑结构

R1---中心
[r1]int t 0/0/0
[r1-Tunnel0/0/0]ip add 10.1.2.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r1-Tunnel0/0/0]source 16.1.1.1
[r1-Tunnel0/0/0]nhrp entry multicast dynamic 

R2
[r2]int Tunnel 0/0/0
[r2-Tunnel0/0/0]ip add 10.1.2.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r2-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r2-Tunnel0/0/0]nhrp entry 10.1.2.1 16.1.1.1 register 

R3
[r3]int Tunnel 0/0/0
[r3-Tunnel0/0/0]ip add 10.1.2.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp 	
[r3-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r3-Tunnel0/0/0]nhrp entry 10.1.2.1 16.1.1.1 register 


修改OSPF接口类型为Broadcast
[r1-Tunnel0/0/0]ospf network-type broadcast 
[r2-Tunnel0/0/0]ospf network-type broadcast 
[r3-Tunnel0/0/0]ospf network-type broadcast 

R2、R3放弃选举
[r2-Tunnel0/0/0]ospf dr-priority 0
[r3-Tunnel0/0/0]ospf dr-priority 0

5.ospf配置
[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 10.1.0.1 0.0.255.255

[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 10.1.2.2 0.0.0.0

[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0	
[r3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 10.1.2.1 0.0.0.0

[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.0
[r4-ospf-1-area-0.0.0.0]network 10.1.1.2 0.0.0.0

[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 10.1.1.3 0.0.0.0

6.查看ospf邻居表
r1:
	 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                      2.2.2.2          Full        
 0.0.0.0          Tunnel0/0/0                      3.3.3.3          Full        
 0.0.0.0          Tunnel0/0/1                      4.4.4.4          Full        
 0.0.0.0          Tunnel0/0/1                      5.5.5.5          Full        
 ----------------------------------------------------------------------------
r2:
	 OSPF Process 1 with Router ID 2.2.2.2
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          Tunnel0/0/0                      1.1.1.1          Full        
 ----------------------------------------------------------------------------
r3:
	 OSPF Process 1 with Router ID 3.3.3.3
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          Tunnel0/0/0                      1.1.1.1          Full        
 ----------------------------------------------------------------------------
r4:
	 OSPF Process 1 with Router ID 4.4.4.4
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          Tunnel0/0/0                      1.1.1.1          Full        
 0.0.0.0          Tunnel0/0/0                      5.5.5.5          Full        
 ----------------------------------------------------------------------------
r5:
	 OSPF Process 1 with Router ID 5.5.5.5
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          Tunnel0/0/0                      1.1.1.1          Full        
 0.0.0.0          Tunnel0/0/0                      4.4.4.4          Full        
 ----------------------------------------------------------------------------

五、验证

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述






  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值