OSPF综合实验

实验使用软件:ensp

实验拓扑图:

实验要求·:

1.如图连接,合理规划IP地址,所有路由器各自创建一个loopback接口

2.R1再创建三个接口IP地址为201.1.1.1/24、201.1.2.1/24、201.1.3.1/24

R5再创建三个接口IP地址为202.1.1.1/24、202.1.2.1/24、202.1.3.1/24

R7再创建三个接口IP地址为203.1.1.1/24、203.1.2.1/24、203.1.3.1/24

3.如图运行路由协议

3.1 R1 -R2 -R3之间使用MGRE网络,为hub-spoke 网络结构,R1为hub端 ,
部署OSPF网络,MGRE修改为BMA网络类型

3.2 R2-R3之间启用PPP pap 单项认证 , R3-R4之间启用PPP的chap双向认证

4.area 1 区域不得出现4.5类LSA

5.其他区域优先通过R3访问R1 三个环回接口

6.尽量减少路由条目数量

7.area 1 区域增加安全性

8.全网可达

实验步骤:

1、根据实验要求规划好拓扑图

2、按要求对设备配置IP地址

R1接口配置:

R5接口配置:

R7接口配置:

R1 -R2  -R3

使用MGRE网络,为hub-spoke 网络结构,R1为hub端 ,部署OSPF网络,MGRE修改为BMA网络类型,先配置三条缺省 让路由器先通

[r1]ip route-static 0.0.0.0 0 18.1.1.2
[r2]ip route-static 0.0.0.0 0 28.1.1.2 
[r3]ip route-static 0.0.0.0 0 38.1.1.2

进行hub-spoke配置


[r1-Tunnel0/0/0]tunnel-protocol gre ?
  p2mp  Point to multi-point GRE mode
  <cr>  Please press ENTER to execute command 
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r1-Tunnel0/0/0]source 18.1.1.1
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp entry multicast dynamic 
[r1-Tunnel0/0/0]ip address 100.1.1.1 24
[r2-Tunnel0/0/0]tunnel-protocol gre 	
[r2-Tunnel0/0/0]tunnel-protocol gre ?
  p2mp  Point to multi-point GRE mode
  <cr>  Please press ENTER to execute command 
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r2-Tunnel0/0/0]source 28.1.1.1
[r2-Tunnel0/0/0]nhrp network-id 100
[r2-Tunnel0/0/0]nhrp entry 100.1.1.1 18.1.1.1
[r2-Tunnel0/0/0]nhrp entry 100.1.1.1 18.1.1.1
Info: This peer exists already.
[r2-Tunnel0/0/0]ip add 100.1.1.2 24
Aug 11 2024 20:34:23-08:00 r2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r2-Tunnel0/0/0]nhrp entry 100.1.1.1 18.1.1.1 register
[r3]int Tunnel 0/0/0
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]shutdown
[r3-Tunnel0/0/0]source 38.1.1.1
[r3-Tunnel0/0/0]nhrp entry 100.1.1.1 18.1.1.1 register 
[r3-Tunnel0/0/0]ip add 100.1.1.3 24

R2-R3

启用PPP pap 单项认证  , R3-R4之间启用PPP的chap双向认证

1.单向认证

[r2]aaa
[r2-aaa]l	
[r2-aaa]local-user ljl password cipher huawei
Info: Add a new user.	
[r2-aaa]local-user ljl service-type ppp
[r2-aaa]int s 4/0/1
[r2-Serial4/0/1]ppp authentication-mode pap
[r4-Serial4/0/1]ppp pap local-user ljl password cipher huawei

2.双向认证

[r3-aaa]local-user r4 password cipher huawei
Info: Add a new user.
[r3-aaa]local-user r4 service-type ppp
[r3]interface s 4/0/0
[r3-Serial4/0/0]ppp authentication-mode ?
  chap  Enable CHAP authentication
  pap   Enable PAP authentication
[r3-Serial4/0/0]ppp authentication-mode chap
[r3-Serial4/0/0]ppp authentication-mode chap 
r4-Serial4/0/0]ppp chap user r4 ?
[r4-Serial4/0/0]ppp chap password cipher huawei

运行协议


[r1-ospf-100]area 0	
[r1-ospf-100-area-0.0.0.0]network 100.1.1.1 0.0.0.0
[r1-ospf-100-area-0.0.0.0]network 1.1.1.1 0.0.0.0	
[r1-ospf-100-area-0.0.0.0]network 201.1.0.0 0.0.255.255
[r1-ospf-100-area-0.0.0.0]int l 0
[r1-LoopBack0]ospf network-type broadcast 
[r1-LoopBack0]int l 1
[r1-LoopBack1]ospf network-type broadcast 
[r1-LoopBack1]int l 2
[r1-LoopBack2]ospf network-type broadcast
[r1-LoopBack2]int l 3
[r1-LoopBack3]ospf network-type broadcast
[r2]ospf 100 router-id 92.2.2.2
[r2-ospf-100]area 0
[r2-ospf-100-area-0.0.0.0]network 100.1.1.2 0.0.0.0
[r2-ospf-100-area-0.0.0.0]network 100.1.1.2 0.0.0.0 
[r2-ospf-100-area-0.0.0.0]network 100.1.1.2 0.0.0.0	
[r2-ospf-100]area 1
[r2-ospf-100-area-0.0.0.1]network 2.2.2.2 0.0.0.0
[r2-ospf-100-area-0.0.0.1]network 24.1.1.1 0.0.0.0
[r2-ospf-100-area-0.0.0.1]int l 0
[r2-LoopBack0]ospfv3	
[r2-LoopBack0]ospf network-type broadcast 
[r4]ospf 100 router-id 94.4.4.4	
[r4-ospf-100]area 1	
[r4-ospf-100-area-0.0.0.1]network 24.1.1.2 0.0.0.0
[r4-ospf-100-area-0.0.0.1]network 24.1.1.2 0.0.0.
[r4-ospf-100]area 2
[r4-ospf-100-area-0.0.0.2]network 46.1.1.1 0.0.0.0
[r4-ospf-100-area-0.0.0.2]int l 0	
[r4-LoopBack0]ospf network-type broadcast 
[r4-LoopBack0]q
[r4]ospf 100	
[r4-ospf-100]area 0	
[r4-ospf-100-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r4-ospf-100-area-0.0.0.0]q
[r4-ospf-100]q
[r4]rip 200
[r4-rip-200]verify-source
[r4-rip-200]version 2
[r4-rip-200]network 45.0.0.0

[r5-rip-200]verify-source
[r5-rip-200]version 2
[r5-rip-200]network 45.0.0.0
[r5-rip-200]q
[r5]rip 200
[r5-rip-200]network 202.1.1.0
[r5-rip-200]network 202.1.2.0
[r5-rip-200]network 202.1.3.0
[r5-rip-200]network 5.0.0.0
[r7]rip 100
[r7-rip-100]verify-source
[r7-rip-100]version 2
[r7-rip-100]network 67.0.0.0
[r7-rip-100]network 7.0.0.0
[r7-rip-100]network 203.1.1.0
[r7-rip-100]network 203.1.2.0
[r7-rip-100]network 203.1.3.0
[r7-rip-100]dis ip rou pro rip
[r7-rip-100]q
[r7]dis ip ro pro rip
[r7]dis ip rou pro rip
[r7]dis ip rou pro rip
[r1-Tunnel0/0/0]ospf network-type broadcast  
[r2-Tunnel0/0/0]ospf network-type broadcast 
[r2-Tunnel0/0/0]ospf dr-priority 0
[r3-Tunnel0/0/0]ospf network-type broadcast 
[r3-Tunnel0/0/0]ospf dr-priority 0

area  1  区域不得出现4.5类LSA

[r4-ospf-100-area-0.0.0.1]nssa  
[r2-ospf-100-area-0.0.0.1]nssa
[r3-ospf-100-area-0.0.0.1]nssa

做通道使不规则的ospf区域协议通讯 

[r2]int t 0/0/1
[r2-Tunnel0/0/1]ip address 42.1.1.1 24
[r2-Tunnel0/0/1]tunnel-protocol gre
[r2-Tunnel0/0/1]source 2.2.2.2
[r2-Tunnel0/0/1]description 4.4.4.4
[r4-Tunnel0/0/1]ip add 42.1.1.2 24
[r4-Tunnel0/0/1]tunnel-protocol gre
[r4-Tunnel0/0/1]source 4.4.4.4
[r4-Tunnel0/0/1]description 2.2.2.2
[r4-Tunnel0/0/1]int t0/0/2
[r4-Tunnel0/0/2]ip address 43.1.1.2 24
[r4-Tunnel0/0/2]tunnel-protocol gre
[r4-Tunnel0/0/2]source 4.4.4.4
[r4-Tunne10/0/2]destination 3.3.3.3
[r3-Tunnel0/0/2]tunnel-protocol gre
[r3-Tunnel0/0/2]ip address 43.1.1.1 24
[r3-Tunnel0/0/2]source 3.3.3.3
[r3-Tunnel0/0/2]destination 4.4.4.4

将通道宣告到area2区域

[r2-ospf-100-area-0.0.0.2]network 42.1.1.1 0.0.0.0 
[r4-ospf-100-area-0.0.0.2]network 42.1.1.2 0.0.0.8
[r4-ospf-100-area-0.0.0.2]network 43.1.1.2 0.0.0.0 
[r3-ospf-100-area-0.0.0.2]network 43.1.1.1 0.0.0.0

汇总:

[r2-ospf-100-area-0.0.0.0]abr-summary 201.1.0.0 255.255.252.0
[r2-ospf-100-area-0.0.0.0]abr-summary 201.1.0.0 255.255.252.0 cost 100
[r3-ospf-100-area-0.0.0.0]abr-summary 201.1.0.0 255.255.252.0
[r3-ospf-100-area-0.0.0.0]abr-summary 201.1.0.0 255.255.252.0 cost 50

 做area 1 区域增加安全性

[r2-ospf-100-area-0.0.0.1]authentication-mode
Please press ENTER to execute command<Cr>
[r2-ospf-100-area-0.0.0.1]authentication-modesimple huawei simple huawei 
[r3-ospf-100-area-0.0.0.1]authentication-mode simple huawei 
[r4-ospf-100-area-0.0.0.1]authentication-mode simple huawei

将rip协议重发布到ospf中或者补一条缺省

[r4-ospf-100]import-route rip 200
[r4-rip-200]default-route originate 
[r6-rip-100]import-route ospf 100

 全网可达

[r7]ping 201.1.1.1
PING 201.1.1.1:56 data bytes, press cTRL_c to break
Reply from 201.1.1.1: bytes=56 Sequence=1 tt1=252 time=170 ms
Reply from 201.1.1.1: bytes=56Sequence=2 ttl=252 time=40 ms
Reply from201.1.1.1: bytes=56Sequence=3 ttl=252 time=60 msmS
Reply from201.1.1.1:bytes=56Sequence=4 ttl=252 time=60
Reply from 201.1.1.1: bytes=56Sequence=5ttl=252 time=50 ms

OSPF(开放最短路径优先)是一种用于路由的动态路由协议,它是根据路由器之间的链路状态来计算最短路径的。 在一个OSPF综合实验案例中,可以模拟一个复杂的网络拓扑,包括多个路由器和连接它们的链路。假设有5个路由器A、B、C、D和E,它们之间通过不同的链路相连。 首先,需要配置每个路由器上的OSPF进程,并为它们分配一个路由器ID。然后,在每个链路上配置正确的IP地址和子网掩码。接下来,通过在OSPF进程中启用不同的区域,将路由器分成不同的区域。 然后,需要配置每个路由器之间的OSPF邻居关系。这可以通过指定邻居的路由器ID和链路上的IP地址来完成。路由器之间的邻居关系建立后,它们将开始交换链路状态信息(LSA)。 每个路由器将根据接收到的LSA计算自己的链路状态数据库(LSDB)。然后,通过运行Dijkstra算法,每个路由器将计算出到达其他路由器的最短路径。最后,每个路由器将根据最短路径选择相应的接口进行路由。 在这个实验案例中,还可以模拟链路故障的情况,观察OSPF的快速收敛性。当某个链路出现故障时,路由器将发送通告信息给邻居,通知它们链路状态已经改变。邻居将更新自己的LSDB,并重新计算最短路径。 通过这个综合实验案例,可以深入了解OSPF协议的工作原理和功能。同时,还可以通过观察实验结果,了解OSPF网络中的优势和效率。这些知识和经验将帮助网络工程师更好地设计、优化和故障排除复杂的网络拓扑。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值