OSPF综合实验

该博客围绕网络实验展开,介绍了实验拓扑,按6个区域进行划分。阐述实验需求,如配置IP、构建MGRE环境、保障全网可达等。实验结果包含设备IP配置、公网私网连通配置、路由汇总、特殊区域设置、防环配置、NAT配置等内容,还进行了OSPF认证检测。

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

一、实验拓扑

二、实验划分

按6个区域划分大类area 0:172.16.0.0/19;area 1:172.16.32.0/19;area 2:172.16.64.0/19;area 3:172.16.96.0/19;area 4:172.16.128.0/19;area 5:172.16.160.0/19;RIP:172.16.192.0/19。每个区域的详细划分见图示。

三、实验需求

1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP;

2、R3-R5、R6、R7为MGRE环境,R3为中心站点;

3、整个OSPF环境IP基于172.16.0.0/16划分;除了R12有两个环回,其他路由器均有一个环回IP

4、所有设备均可访问R4的环回;

5、减少LSA的更新量,加快收敛,保障更新安全;

6、全网可达;

四、实验结果

1.配IP

R1:


[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]undo ip ad 172.16.33.1 24
[R1]int LoopBack 0
[R1-LoopBack0]ip ad 172.16.34.1 24 

R2:


[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip ad 172.16.33.2 24
[R2]int LoopBack 0
[R2-LoopBack0]ip ad 172.16.35.2 24

R3:

[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip address 172.16.33.3 24
[R3]int LoopBack 0
[R3-LoopBack0]ip ad 172.16.36.3 24
[R3]int Serial 4/0/0
[R3-Serial4/0/0]ip ad 34.0.0.3 24

R4:

[R4]int s4/0/0
[R4-Serial4/0/0]ip ad 34.0.0.4 24
[R4-Serial4/0/0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip ad 47.0.0.4 24
[R4-GigabitEthernet0/0/0]int s3/0/0
[R4-Serial3/0/0]ip ad 46.0.0.4 24
[R4-Serial3/0/0]int s4/0/1
[R4-Serial4/0/1]ip a 45.0.0.4 24
[R4]int LoopBack 0
[R4-LoopBack0]ip ad 172.16.2.4 24

R5:

[R5]int s4/0/0
[R5-Serial4/0/0]ip ad 45.0.0.5 24
[R5]int loo 0
[R5-LoopBack0]ip ad 172.16.3.5 24

R6:

[R6]int s4/0/0
[R6-Serial4/0/0]ip ad 46.0.0.6 24
[R6-Serial4/0/0]int g0/0/0
[R6-GigabitEthernet0/0/0]ip ad 172.16.65.1 30
[R6]int loo 0
[R6-LoopBack0]ip ad 172.16.4.6 24

R7:

[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ip ad 47.0.0.7 24
[R7-GigabitEthernet0/0/0]int g0/0/1
[R7]int LoopBack 0
[R7-LoopBack0]ip ad 172.16.5.7 24
[R7]int g0/0/1
[R7-GigabitEthernet0/0/1]ip ad 172.16.97.1 30

R8:

[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ip ad 172.16.97.5 30
[R8-GigabitEthernet0/0/0]int g0/0/1
[R8-GigabitEthernet0/0/1]ip ad 172.16.97.6 30
[R8]int loo 0
[R8-LoopBack0]ip ad 172.16.98.8 24

R9:

[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ip ad 172.16.97.7 30
[R9-GigabitEthernet0/0/0]int g0/0/1
[R9-GigabitEthernet0/0/1]ip ad 172.16.120.1 30
[R9]int loo 0
[R9-LoopBack0]ip ad 172.16.130.9 24

R10:

[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ip ad 172.16.129.2 30
[R10]int loo 0
[R10-LoopBack0]ip ad 172.16.131.10 24

R11:

[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ip ad 172.16.65.1 30
[R11-GigabitEthernet0/0/0]int g0/0/1
[R11-GigabitEthernet0/0/1]ip ad 172.16.65.5 30
[R11]int LoopBack 0
[R11-LoopBack0]ip ad 172.16.66.11 24

R12:

[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ip ad 172.16.65.6 30
[R12]int loo 0
[R12-LoopBack0]ip ad 172.16.160.12 24
[R12-LoopBack0]int loo 1
[R12-LoopBack1]ip ad 172.16.161.12 24

2.公网通、私网通

公网通:

配缺省

R3:

[R3]ip route-static 0.0.0.0 0 34.0.0.4

R5:

[R5]ip route-static 0.0.0.0 0 45.0.0.4

R6:

[R6]ip route-static 0.0.0.0 0 46.0.0.4

R7:

[R7]ip route-static 0.0.0.0 0 47.0.0.4

私网通

配置ospf-area1:

R1:

[R1]ospf 1 rou	
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]ne 172.16.33.1 0.0.0.255
[R1-ospf-1-area-0.0.0.1]ne 172.16.34.1 0.0.0.255

R2:

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]ne 172.16.33.2 0.0.0.255
[R2-ospf-1-area-0.0.0.1]ne 172.16.35.2 0.0.0.255

R3:

[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]ne 172.16.33.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]ne 172.16.36.3 0.0.0.255

宣告area 0的用户网段:

R5:

[R5]ospf 1 r	
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]ne 172.16.3.0 0.0.0.255

R6:

[R6]ospf 1 r	
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]ne 172.16.4.0 0.0.0.255

R7:

[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]ne 172.16.5.0 0.0.0.255

配置ospf-area2:

R6:

[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]ne 172.16.65.1 0.0.0.0

R11:

[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]ne 172.16.65.2 0.0.0.0
[R11-ospf-1-area-0.0.0.2]ne 172.16.65.5 0.0.0.0
[R11-ospf-1-area-0.0.0.2]ne 172.16.66.0 0.0.0.255

R12:

[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]ne 172.16.65.6 0.0.0.0
[R12]rip 1
[R12-rip-1]v 2
[R12-rip-1]undo summary 
[R12-rip-1]ne 172.16.0.0

area2与rip 1的路由协议不同,做路由引入

R12:

[R12]ospf 1
[R12-ospf-1]im	
[R12-ospf-1]import-route rip

配置ospf-area3:

R7:

[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]ne 172.16.97.1 0.0.0.0

R8:

[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]ne 172.16.97.2 0.0.0.0
[R8-ospf-1-area-0.0.0.3]ne 172.16.97.5 0.0.0.0
[R8-ospf-1-area-0.0.0.3]ne 172.16.98.0 0.0.0.255

R9:

[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]ne 172.16.97.6 0.0.0.0

配置ospf-area4(不规则区域):

多进程

R9:

[R9]ospf 2 router-id 9.9.9.9
[R9-ospf-2]a 4
[R9-ospf-2-area-0.0.0.4]ne 172.16.129.1 0.0.0.0
[R9-ospf-2-area-0.0.0.4]ne 172.16.130.0 0.0.0.255

R10:

[R10]ospf 2 router-id 10.10.10.10
[R10-ospf-2]a 4
[R10-ospf-2-area-0.0.0.4]ne 172.16.129.2 0.0.0.0
[R10-ospf-2-area-0.0.0.4]ne 172.16.131.0 0.0.0.255

查看建立邻居情况:

实现了各个私网内部通

MGRE实现各个私网之间通,

R3:

[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip ad 172.16.6.3 24	
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R3-Tunnel0/0/0]source s4/0/0
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry multicast dynamic 
//宣告隧道口
[R3]ospf 1
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
//更改协议类型
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ospf network-type broadcast 

R5:

[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ip ad 172.16.6.5 24
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R5-Tunnel0/0/0]source s4/0/0
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register 
[R5]ospf 1
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ospf network-type broadcast 
//解决DR/BR选举混乱,取消选举
[R5-Tunnel0/0/0]ospf dr-priority 0

R6:

[R6]int Tunnel 0/0/0
[R6-Tunnel0/0/0]ip ad 172.16.6.6 24
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R6-Tunnel0/0/0]source s4/0/0
[R6-Tunnel0/0/0]nhrp network-id 100
[R6-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register 
[R6]ospf 1
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
[R6]int Tunnel 0/0/0
[R6-Tunnel0/0/0]ospf network-type broadcast 
[R6-Tunnel0/0/0]ospf dr-priority 0

R7:

[R7]int Tunnel 0/0/0
[R7-Tunnel0/0/0]ip ad 172.16.6.7 24	
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R7-Tunnel0/0/0]source g0/0/0
[R7-Tunnel0/0/0]nhrp network-id 100
[R7-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register
[R7]ospf 1 
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255 
[R7]int Tunnel 0/0/0
[R7-Tunnel0/0/0]ospf network-type broadcast 
[R7-Tunnel0/0/0]ospf dr-priority 0

 

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

为了使area 4能够到达其他区域,同时为了减少LSA更新量,可以在R10上手工配置一条指向R9的缺省,也可以在R9上下发一条5类缺省:

default-route-advertise

OSPF路由汇总

R3:

[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0

R6:

[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0

R7:

[R7]ospf 1	
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0

R9:

[R9]ospf 1
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0

R12:

[R12]ospf 1
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0

为area1、area2、area3做特殊区域

area1的完全末梢区域

R1:

[R1]ospf 1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]stub

R2:

[R2]ospf 1
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]stub

R3:

[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]stub no-summary 

area2的完全的非完全末梢区域

R6:

[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]nssa no-summary

R11:

[R11]ospf 1
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]nssa

R12:

[R12]ospf 1
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]nssa

area3的完全的非完全末梢区域

R7:

[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]nssa no-summary

R8:

[R8]ospf 1
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]nssa

R9:

[R9]ospf 1 
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]nssa

配置NULL 0接口防环

R3:

[R3]ip route-static 172.16.32.0 19 NULL 0

R6:

[R6]ip route-static 172.16.64.0 19 NULL 0

R7:

[R7]ip route-static 172.16.96.0 19 NULL 0

R9:

[R9]ip route-static 172.16.128.0 19 NULL 0

R12:

[R12]ip route-static 172.16.160.0 19 NULL 0

配置NAT

R3:

[R3]acl 2000
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3-acl-basic-2000]q
[R3]int Serial 4/0/0
[R3-Serial4/0/0]nat outbound 2000

R6:

[R6]acl 2000
[R6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R6-acl-basic-2000]q
[R6]int Serial 4/0/0
[R6-Serial4/0/0]nat outbound 2000

R7:

[R7]acl 2000
[R7-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R7-acl-basic-2000]q
[R7]int GigabitEthernet 0/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000

 加快收敛,为MGRE环境减少计时器时间

R3:

[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ospf timer hello 10

R5:

[R5]int t 0/0/0    
[R5-Tunnel0/0/0]ospf timer hello 10

R6:

[R6]int t 0/0/0
[R6-Tunnel0/0/0]ospf timer hello 10

R7:

[R7]int t 0/0/0
[R7-Tunnel0/0/0]ospf timer hello 10


将所有直连的MA的接口网络类型改为p2p

R6:

[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ospf network-type p2p

R7:

[R7]int g0/0/1    
[R7-GigabitEthernet0/0/1]ospf network-type p2p

R8:

[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ospf network-type p2p
[R8]int g0/0/1
[R8-GigabitEthernet0/0/1]ospf network-type p2p

R9:

[R9]int g0/0/0    
[R9-GigabitEthernet0/0/0]ospf network-type p2p
[R9]int g0/0/1
[R9-GigabitEthernet0/0/1]ospf network-type p2p

R10:

[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ospf network-type p2p

R11:

[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ospf network-type p2p
[R11]int g0/0/1
[R11-GigabitEthernet0/0/1]ospf network-type p2p

R12:

[R12]int g0/0/0    
[R12-GigabitEthernet0/0/0]ospf network-type p2p


OSPF认证

[R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456 
[R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
[R3-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R5-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R6-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456
[R7-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R7-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456
[R8-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456
[R9-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456
[R9-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 123456
[R10-ospf-1-area-0.0.0.4]authentication-mode md5 1 cipher 123456
[R11-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456
[R12-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456

 检测:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JioJio~z

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值