OSPF综合实验

一.实验内容

二.实验分析

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

三.IP划分拓扑图

 四.IP划分


172.16.0.0/16

先分成2个网段(OSPF + RIP),借1位

        172.16.0.0/17         ---OSPF

再按区域划分(5个区域),借3位

         172.16.0.0/20        ---Area 0

                三个环回 + MGRE = 4个网段,但一般网络只有200主机左右,所以直接规划到/24

                        172.16.0.0/24        ---MGRE

                        172.16.1.0/24        ---R5环回

                        172.16.2.0/24        ---R6环回

                        172.16.3.0/24        ---R7环回

                        ...

                        172.16.15.0/24    ---保留备用

                172.16.16.0/20      ---Area 1

                三个环回 + 一个骨干 = 4个网段,但还是直接规划到/24

                        172.16.16.0/24        ---Area 1骨干

                        需要3个IP,所以到/29

                                172.16.16.0/29        ---不能用

                                172.16.16.1/29        ---R1接口

                                172.16.16.2/29        ---R2接口

                                172.16.16.3/29        ---R3接口

                                172.16.16.4/29        ---保留备用

                                172.16.16.5/29        ---保留备用

                                172.16.16.6/29        ---保留备用

                                172.16.16.7/29        ---不能用

                        172.16.17.0/24        ---R1环回

                        172.16.18.0/24        ---R2环回

                        172.16.19.0/24        ---R3环回

                        ...

                        172.16.31.0/24    ---保留备用

                172.16.32.0/20      ---Area 2

                1个环回+2个骨干

                        172.16.32.0/24        ---R11环回

                        172.16.33.0/30        ---R6-R11

                        172.16.33.4/30        ---R11-R12

                172.16.48.0/20      ---Area 3

                1个环回+2个骨干

                        172.16.48.0/24        ---R8环回

                        172.16.49.0/30        ---R7-R8

                        172.16.49.4/30        ---R8-R9

                172.16.64.0/20      ---Area 4

                2个环回+1个骨干

                        172.16.64.0/24        ---R9环回

                        172.16.65.0/24        ---R10环回

                        172.16.66.0/30        ---R9-R10                  

                172.16.80.0/20      ---保留备用

                172.16.96.0/20      ---保留备用

                172.16.112.0/20    ---保留备用

        172.16.128.0/17     ---RIP

        2个环回

                172.16.128.0/18

                172.16.192.0/18

五.配置各设备IP

配置IP和环回


R1配置

<Huawei>sys
[Huawei]sys r1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 172.16.16.1 29
[r1-GigabitEthernet0/0/0]int l 0
[r1-LoopBack0]ip add 172.16.17.1 24

R2配置

<Huawei>sys
[Huawei]sys r2
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 172.16.16.2 29
[r2-GigabitEthernet0/0/0]int l 0
[r2-LoopBack0]ip add 172.16.18.1 24

R3配置

<Huawei>sys
[Huawei]sys r3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 172.16.16.3 29
[r3-GigabitEthernet0/0/0]int l 0
[r3-LoopBack0]ip add 172.16.19.1 24

[r3-LoopBack0]int s4/0/0
[r3-Serial4/0/0]ip add 34.0.0.3 24

R4配置

<Huawei>sys
[Huawei]sys r4

[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 47.0.0.4 24
[r4-GigabitEthernet0/0/0]int s4/0/0
[r4-Serial4/0/0]ip add 34.0.0.4 24
[r4-Serial4/0/0]int s4/0/1
[r4-Serial4/0/1]ip add 45.0.0.4 24
[r4-Serial4/0/1]int s3/0/0
[r4-Serial3/0/0]ip add 46.0.0.4 24
[r4-Serial3/0/0]int l 0
[r4-LoopBack0]ip add 4.4.4.4 32

R5配置

<Huawei>sys
[Huawei]sys r5

[r5]int s4/0/0
[r5-Serial4/0/0]ip add 45.0.0.5 24
[r5-Serial4/0/0]int l 0
[r5-LoopBack0]ip add 172.16.1.1 24

R6配置

<Huawei>sys
[Huawei]sys r6
[r6]int s4/0/0
[r6-Serial4/0/0]ip add 46.0.0.6 24
[r6-Serial4/0/0]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 172.16.33.1 30
[r6-GigabitEthernet0/0/0]int l 0
[r6-LoopBack0]ip add 172.16.2.1 24

R7配置

<Huawei>sys
[Huawei]sys r7

[r7]int g0/0/0
[r7-GigabitEthernet0/0/0]ip add 47.0.0.7 24
[r7-GigabitEthernet0/0/0]int l 0
[r7-LoopBack0]ip add 172.16.3.1 24
[r7-LoopBack0]int g0/0/1
[r7-GigabitEthernet0/0/1]ip add 172.16.49.1 30

R8配置

<Huawei>sys
[Huawei]sys r8

[r8]int g0/0/0
[r8-GigabitEthernet0/0/0]ip add 172.16.49.2 30
[r8-GigabitEthernet0/0/0]int g0/0/1
[r8-GigabitEthernet0/0/1]ip add 172.16.49.5 30
[r8-GigabitEthernet0/0/1]int l 0
[r8-LoopBack0]ip add 172.16.48.1 24

R9配置

<Huawei>sys
[Huawei]sys r9

[r9]int g0/0/0
[r9-GigabitEthernet0/0/0]ip add 172.16.49.6 30
[r9-GigabitEthernet0/0/0]int l 0
[r9-LoopBack0]ip add 172.16.64.1 24
[r9-LoopBack0]int g0/0/1
[r9-GigabitEthernet0/0/1]ip add 172.16.66.1 30

R10配置

<Huawei>sys
[Huawei]sys r10

[r10]int g0/0/0
[r10-GigabitEthernet0/0/0]ip add 172.16.66.2 30
[r10-GigabitEthernet0/0/0]int l 0
[r10-LoopBack0]ip add 172.16.65.1 24

R11配置

<Huawei>sys
[Huawei]sys r11

[r11]int g0/0/0
[r11-GigabitEthernet0/0/0]ip add 172.16.33.2 30
[r11-GigabitEthernet0/0/0]int g0/0/1
[r11-GigabitEthernet0/0/1]ip add 172.16.33.5 30
[r11-GigabitEthernet0/0/1]int l 0
[r11-LoopBack0]ip add 172.16.32.1 24

R12配置

<Huawei>sys
[Huawei]sys r12

[r12]int g0/0/0
[r12-GigabitEthernet0/0/0]ip add 172.16.33.6 30
[r12-GigabitEthernet0/0/0]int l 0
[r12-LoopBack0]ip add 172.16.128.1 18
[r12-LoopBack0]int l 1
[r12-LoopBack1]ip add 172.16.192.1 18

测试所有直连网段是否通

用 Ping

六.搭建非shortcut方式的MGRE环境,R3为中心站点

R3配置

[r3]int t0/0/0
[r3-Tunnel0/0/0]ip add 172.16.0.1 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r3-Tunnel0/0/0]source 34.0.0.3
[r3-Tunnel0/0/0]nhrp entry multicast dynamic 

[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


检查NHRP表

七.配置各区域OSPF 

起Area 0的OSPF


R3配置

[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

改p2mp类型

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

[r3-Tunnel0/0/0]ospf network-type p2mp

减少Hello时间与死亡时间

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

将环回类型(主机)改为broadcast (不然OSPF学到的是掩码32的路由)

[r6]int l 0

[r6-LoopBack0]ospf network-type 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

改p2mp类型

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

减少Hello时间与死亡时间

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

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

改p2mp类型

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

减少Hello时间与死亡时间

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

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

改p2mp类型

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

减少Hello时间与死亡时间

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

Area1


R1

[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]network 0.0.0.0 255.255.255.255
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ospf timer hello 1


R2


[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]network 0.0.0.0 255.255.255.255
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ospf timer hello 1


R3


[r3]ospf 1 
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 172.16.16.0 0.15.255.255
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ospf timer hello 1
Area2(R12需要配置RIP)


R6


[r6]ospf 1
[r6-ospf-1]area 2
[r6-ospf-1-area-0.0.0.2]network 172.16.33.1 0.0.0.0
[r6]int g 0/0/0
[r6-GigabitEthernet0/0/0]ospf timer hello 1 


R11


[r11]ospf 1 router-id 11.11.11.11
[r11-ospf-1]area 2
[r11-ospf-1-area-0.0.0.2]network 0.0.0.0 255.255.255.255
[r11]int g 0/0/0
[r11-GigabitEthernet0/0/0]ospf timer hello 1
[r11-GigabitEthernet0/0/0]int g 0/0/1
[r11-GigabitEthernet0/0/1]ospf timer hello 1


R12


[r12]ospf 1 router-id 12.12.12.12
[r12-ospf-1]area 2
[r12-ospf-1-area-0.0.0.2]network 172.16.33.6 0.0.0.0
[r12]int g 0/0/0
[r12-GigabitEthernet0/0/0]ospf timer hello 1
 
 

配置RIP


[r12-ospf-1-area-0.0.0.2]q
[r12-ospf-1]q
[r12]rip 1
[r12-rip-1]ver 2
[r12-rip-1]undo summary 
[r12-rip-1]network 172.16.0.0 8


Area3


R7


[r7]ospf 1
[r7-ospf-1]area 3
[r7-ospf-1-area-0.0.0.3]network 172.16.49.1 0.0.0.0
[r7]int g 0/0/1
[r7-GigabitEthernet0/0/1]ospf timer hello 1


R8


[r8]ospf 1 router-id 8.8.8.8 
[r8-ospf-1]area 3
[r8-ospf-1-area-0.0.0.3]network 0.0.0.0 255.255.255.255
[r8]int g 0/0/0
[r8-GigabitEthernet0/0/0]ospf timer hello 1
[r8]int g 0/0/1
[r8-GigabitEthernet0/0/1]ospf timer hello 1


R9


[r9]ospf 1 router-id 9.9.9.9
[r9-ospf-1]area 3
[r9-ospf-1-area-0.0.0.3]network 172.16.49.6 0.0.0.0
[r9]int g 0/0/0
[r9-GigabitEthernet0/0/0]ospf timer hello 1


Area4(R9上要做不同OSPF进程的配置)
R9(OSPF进程2)
[r9]ospf 2 router-id 9.9.9.9  
[r9-ospf-2]area 4
[r9-ospf-2-area-0.0.0.4]network 172.16.64.0 0.15.255.255
[r9-GigabitEthernet0/0/0]int g 0/0/1
[r9-GigabitEthernet0/0/1]ospf timer hello 1


R10


[r10]ospf 1 router-id 10.10.10.10
[r10-ospf-1]area 4
[r10-ospf-1-area-0.0.0.4]network 0.0.0.0 255.255.255.255
[r10]int g 0/0/0
[r10-GigabitEthernet0/0/0]ospf timer hello 1


八.R12与R9上做重发布


R12配置

[r12]ospf 1
[r12-ospf-1]import-route rip 1
[r12-ospf-1]q
[r12]rip 1
[r12-rip-1]import-route ospf 1

R9配置

[r9]ospf 1
[r9-ospf-1]import-route ospf 2
[r9-ospf-1]q
[r9]ospf 2
[r9-ospf-2]import-route ospf 1

九.优路由汇总

R3配置

[r3]ospf 1
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]abr-summary 172.16.16.0 255.255.240.0

R6配置

[r6]ospf 1
[r6-ospf-1]area 2
[r6-ospf-1-area-0.0.0.2]abr-summary 172.16.32.0 255.255.240.0

R7配置

[r7]ospf 1
[r7-ospf-1]area 3
[r7-ospf-1-area-0.0.0.3]abr-summary 172.16.48.0 255.255.240.0

R9配置(域外路由汇总)

[r9]ospf 1
[r9-ospf-1]asbr-summary 172.16.64.0 255.255.240.0

R12配置(域外路由汇总)

[r12]ospf 1
[r12-ospf-1]asbr-summary 172.16.128.0 255.255.128.0

2.特殊区域


Area1(Totally Stub)


R1


[r1]ospf 1
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]stub


R2


[r2]ospf 1
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]stub


R3


[r3]ospf 1
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]stub no-summary 


Area2(Totally NSSA)


R6


[r6]ospf 1
[r6-ospf-1]area 2
[r6-ospf-1-area-0.0.0.2]nssa no-summary


R11


[r11]ospf 1
[r11-ospf-1]area 2
[r11-ospf-1-area-0.0.0.2]nssa 


R12


[r12]ospf 1 
[r12-ospf-1]area 2
[r12-ospf-1-area-0.0.0.2]nssa 


Area3(Totally NSSA)


R7


[r7]ospf 1
[r7-ospf-1]area 3
[r7-ospf-1-area-0.0.0.3]nssa no-summary


R8


[r8]ospf 1
[r8-ospf-1]area 3
[r8-ospf-1-area-0.0.0.3]nssa 


R9


[r9]ospf 1
[r9-ospf-1]area 3
[r9-ospf-1-area-0.0.0.3]nssa 
[r9]ospf 2
[r9-ospf-2]default-route-advertise


3.保障更新安全,设备间做认证


R9


[r9]int g 0/0/1
[r9-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 123456


R10

[r10]int g 0/0/0
[r10-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456


R1


[r1]ospf 1
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456


R2


[r2]ospf 1
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456


R3


[r3]ospf 1
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456


十.做NAT


R3

[r3]acl 2000
[r3-acl-basic-2000]rule permit source 172.16.16.0 0.0.15.255
[r3-acl-basic-2000]q
[r3]int s 4/0/0
[r3-Serial4/0/0]nat outbound 2000


R6


[r6]acl 2000
[r6-acl-basic-2000]rule permit source 172.16.32.0 0.0.15.255
[r6-acl-basic-2000]rule permit source 172.16.128.0 0.0.254.255
[r6-acl-basic-2000]q
[r6]int s 4/0/0
[r6-Serial4/0/0]nat outbound 2000


R7


[r7]acl 2000
[r7-acl-basic-2000]rule permit source 172.16.48.0 0.0.15.255
[r7-acl-basic-2000]rule permit source 172.16.64.0 0.0.15.255
[r7-acl-basic-2000]q
[r7]int g 0/0/0
[r7-GigabitEthernet0/0/0]nat outbound 2000


十一.测试

1.测试所有设备均可访问R4的环回

2.测试全网通 

  • 15
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
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、付费专栏及课程。

余额充值