OSPF综合实验

实验要求:

1. R4为ISP,其上只能配置IP地址;R4与其他所有直连设备间均使用公有IP
2.R3-R5/6/7为MGRE环境,R3为中心站点;
3.整个OSPF环境IP基于172.16.0.0/16划分;
4.所有设备均可访问R4的环回;
5.减少LSA的更新量,加快收敛,保障更新安全;
6.全网可达

实验拓扑图:

一、ip与环回配置:

r1:

[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip add    
[r1-GigabitEthernet0/0/0]ip address 172.16.16.1 29
Jul 14 2024 21:22:11-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r1-GigabitEthernet0/0/0]inter    
[r1-GigabitEthernet0/0/0]inter l 0
[r1-LoopBack0]ip add    
[r1-LoopBack0]ip address 172.16.17.1 24

r2:

[r2]interface g    
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip ad    
[r2-GigabitEthernet0/0/0]ip address 172.16.16.1 29
[r2-GigabitEthernet0/0/0]inter    
[r2-GigabitEthernet0/0/0]interface l 0
[r2-LoopBack0]ip address 172.16.168.1 24

r3:

[r3]interface GigabitEthernet  0/0/0
[r3-GigabitEthernet0/0/0]ip address 172.16.16.3 29
[r3-GigabitEthernet0/0/0]interface l 0
[r3-LoopBack0]ip address 172.16.19.1 24
[r3-LoopBack0]int s4/0/0
[r3-Serial4/0/0]ip add    
[r3-Serial4/0/0]ip address 34.0.0.3 24

r4:

[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip add    
[r4-GigabitEthernet0/0/0]ip address 47.0.0.4 24
Jul 14 2024 21:31:58-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r4-GigabitEthernet0/0/0]interface s    
[r4-GigabitEthernet0/0/0]interface s4/0/0
[r4-Serial4/0/0]ip ad    
[r4-Serial4/0/0]ip address 34.0.0.4 24
[r4-Serial4/0/0]
Jul 14 2024 21:32:32-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PPP
 IPCP on the interface Serial4/0/0 has entered the UP state. 
[r4-Serial4/0/0]int    
[r4-Serial4/0/0]interface s4/0/1
[r4-Serial4/0/1]ip add    
[r4-Serial4/0/1]ip address 45.0.0.4 24
[r4-Serial4/0/1]interface s3/0/0
[r4-Serial3/0/0]ip add    
[r4-Serial3/0/0]ip address 46.0.0.4 24
[r4-Serial3/0/0]int l 0
[r4-LoopBack0]ip add    
[r4-LoopBack0]ip address 4.4.4.4 32

r5:

[r5]sys    
[r5]sysname r5
[r5]interface se          
[r5]interface Serial 4/0/0
[r5-Serial4/0/0]ip add    
[r5-Serial4/0/0]ip address 45.0.0.5 24
[r5-Serial4/0/0]
Jul 14 2024 21:35:31-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
 IPCP on the interface Serial4/0/0 has entered the UP state. 
[r5-Serial4/0/0]
Jul 14 2024 21:35:31-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r5-Serial4/0/0]int l 0
[r5-LoopBack0]ip add    
[r5-LoopBack0]ip address 172.16.1.1 24

r6:

[r6]interface se    
[r6]interface Serial 4/0/0
[r6-Serial4/0/0]ip add    
[r6-Serial4/0/0]ip address 46.0.0.6 24
[r6-Serial4/0/0]
Jul 14 2024 21:36:45-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
 IPCP on the interface Serial4/0/0 has entered the UP state. 
[r6-Serial4/0/0]
Jul 14 2024 21:36:45-08:00 r6 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r6-Serial4/0/0]int     
[r6-Serial4/0/0]interface g0/0/0
[r6-GigabitEthernet0/0/0]ip add    
[r6-GigabitEthernet0/0/0]ip address 172.16.33.1 30
Jul 14 2024 21:37:06-08:00 r6 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r6-GigabitEthernet0/0/0]int l 0
[r6-LoopBack0]ip add    
[r6-LoopBack0]ip address 172.16.2.1 24

r7:

[r7]interface GigabitEthernet 0/0/0
[r7-GigabitEthernet0/0/0]ip add    
[r7-GigabitEthernet0/0/0]ip address 47.0.0.7 24
Jul 14 2024 21:38:16-08:00 r7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r7-GigabitEthernet0/0/0]
Jul 14 2024 21:38:16-08:00 r7 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r7-GigabitEthernet0/0/0]int l 0
[r7-LoopBack0]ip add     
[r7-LoopBack0]ip address 172.16.3.1 24
[r7-LoopBack0]int    
[r7-LoopBack0]interface g    
[r7-LoopBack0]interface g0/0/1
[r7-GigabitEthernet0/0/1]ip add    
[r7-GigabitEthernet0/0/1]ip address 172.16.49.1 30

r8:

[r8]interface GigabitEthernet 0/0/0
[r8-GigabitEthernet0/0/0]ip add    
[r8-GigabitEthernet0/0/0]ip address 172.16.49.2 30
Jul 14 2024 21:40:22-08:00 r8 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r8-GigabitEthernet0/0/0]int g    
[r8-GigabitEthernet0/0/0]int g0/0/1
[r8-GigabitEthernet0/0/1]ip add    
[r8-GigabitEthernet0/0/1]ip address 172.16.49.5 30
[r8-GigabitEthernet0/0/1]
Jul 14 2024 21:40:49-08:00 r8 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r8-GigabitEthernet0/0/1]int l 0
[r8-LoopBack0]ip add    
[r8-LoopBack0]ip address 172.16.48.1 24

r9:

[r9]interface GigabitEthernet 0/0/0
[r9-GigabitEthernet0/0/0]ip add    
[r9-GigabitEthernet0/0/0]ip address 172.16.49.6 30
Jul 14 2024 21:42:00-08:00 r9 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r9-GigabitEthernet0/0/0]int l 0
[r9-LoopBack0]ip add    
[r9-LoopBack0]ip address 172.16.64.1 24
[r9-LoopBack0]int g0/0/1
[r9-GigabitEthernet0/0/1]ip add    
[r9-GigabitEthernet0/0/1]ip address 172.16.66.1 30

r10:

[r10]interface GigabitEthernet 0/0/0
[r10-GigabitEthernet0/0/0]ip add 172.16.66.2 30
Jul 14 2024 23:51:00-08:00 r10 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r10-GigabitEthernet0/0/0]int l 0
[r10-LoopBack0]ip add    
[r10-LoopBack0]ip address 172.16.65.1 24

r11:

[r11]interface GigabitEthernet 0/0/0
[r11-GigabitEthernet0/0/0]ip add    
[r11-GigabitEthernet0/0/0]ip address 172.16.33.2 30
Jul 14 2024 21:47:02-08:00 r11 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r11-GigabitEthernet0/0/0]interface g0/0/1
[r11-GigabitEthernet0/0/1]ip add    
[r11-GigabitEthernet0/0/1]ip address 172.16.33.5 30
Jul 14 2024 21:47:23-08:00 r11 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
 on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r11-GigabitEthernet0/0/1]int l 0
[r11-LoopBack0]ip add    
[r11-LoopBack0]ip address 172.16.32.1 24

r12:

[r12]interface GigabitEthernet 0/0/0
[r12-GigabitEthernet0/0/0]ip add    
[r12-GigabitEthernet0/0/0]ip address 172.16.33.6 30
Jul 14 2024 21:48:23-08:00 r12 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r12-GigabitEthernet0/0/0]int l 0
[r12-LoopBack0]ip add    
[r12-LoopBack0]ip address 172.16.128.1 18
[r12-LoopBack0]int l 1
[r12-LoopBack1]ip add    
[r12-LoopBack1]ip address 172.16.192.1 18

二、搭建MGRE环境

r3:
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip add    
[r3-Tunnel0/0/0]ip address 172.16.0.1 24
[r3-Tunnel0/0/0]tu    
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source 34.0.0.3
[r3-Tunnel0/0/0]nhrp entry multicast dy
[r3-Tunnel0/0/0]q
[r3]ip route-static 0.0.0.0 0 34.0.0.4

r5:

[r5]int t0/0/0
[r5-Tunnel0/0/0]ip add 172.16.0.2 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r5-Tunnel0/0/0]source Serial 4/0/0
[r5-Tunnel0/0/0]nhrp entry 172.16.0.1 34.0.0.3 register 

[r5]ip route-static 0.0.0.0 0 45.0.0.4

r6:

[r6]int t0/0/0
[r6-Tunnel0/0/0]ip add 172.16.0.3 24
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r6-Tunnel0/0/0]source Serial 4/0/0
[r6-Tunnel0/0/0]nhrp entry 172.16.0.1 34.0.0.3 register 

[r6]ip route-static 0.0.0.0 0 46.0.0.4

r7:

[r7]int t0/0/0
[r7-Tunnel0/0/0]ip add 172.16.0.4 24
[r7-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r7-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r7-Tunnel0/0/0]nhrp entry 172.16.0.1 34.0.0.3 register 

[r7]ip route-static 0.0.0.0 0 47.0.0.4

OSPF(area0):

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

[r3-ospf-1-area-0.0.0.0]int t 0/0/0

[r3-Tunnel0/0/0]ospf network-type p2mp    修改为p2mp类型

[r3-Tunnel0/0/0]ospf timer hello 1   减少Hello时间与死亡时间

[r6-LoopBack0]ospf network-type broadcast   将环回类型(主机)改为broadcast
             

r5:

[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255

[r5-ospf-1-area-0.0.0.0]interface t 0/0/0
[r5-Tunnel0/0/0]ospf network-type p2mp  修改为p2mp类型

[r5-Tunnel0/0/0]ospf timer hello 1    减少Hello时间与死亡时间

  r6:

[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 172.16.0.3 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 172.16.2.1 0.0.0.0

[r6-ospf-1-area-0.0.0.0]int t 0/0/0
[r6-Tunnel0/0/0]ospf network-type p2mp   修改为p2mp类型

[r6-Tunnel0/0/0]ospf timer hello 1  减少Hello时间与死亡时间

r7:

[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]network 172.16.0.0 0.15.255.255

[r7-ospf-1-area-0.0.0.0]int t0/0/0
[r7-Tunnel0/0/0]ospf network-type p2mp

[r7-Tunnel0/0/0]ospf timer hello 1
 

三、测试:

四、ospf(area 1) 

r1:

r2:

r3:

r4:

五、OSPF、rip(area2)

r6:

r11:

r12:

六、OSPF(area3)

r7:

r8:

r9:

七、OSPF(area4)

r9:

r10:

八、OSPF路由汇总

r3:

r6:

r7:

r9:

r12:

九、area 1->Totally Stub Area

r1:

r2:

r3:

r4:

十、area 2->Totally NSSA

r6:

r11:

r12:

十一、area 3->Totally NSSA

r7:

r8:

r9:

十二、防环优化

r3:

r6:

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、付费专栏及课程。

余额充值