2025-12-10

OSPF综合实验报告

一.实验拓扑图

image.png

二.实验要求

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

2.配置IP

3.使公网互通

4.公网ping通检测

5.为R3、R5、R6、R7配置MGRE环境

6.使内网互通

7.解决基于ospf的Mgre的两个问题

8.处理area4内的网段

9.处理R12上的两环回

10.配置nat

11.Ospf的路由聚合

12.加快收敛

13.保证更新安全

四.实验步骤

1.划分IP

具体划分过程:

先将172.16.0.0/16这个大网段划分成两个小网段,如:172.16.0.0/17、172.16.128.0/17.其中的172.16.0.0/17网段给整个ospf,另一个172.16.128.0/17网段给环回;此时,看172.16.0.0/17这个网段,由于ospf有5个区域,但area0的网段是给了的,因此,就将172.16.0.0/17在划分成4个小的网段,如:172.16.0.0/19、172.16.32.0/19、172.16.64.0/19、172.16.96.0/19。

Area1à172.16.0.0/19

R1、R2与R3属于同一网段

R1:172.16.0.1/19

R2:172.16.0.2/19

R3:172.16.0.3/19

Area2à172.16.32.0/19

R6:172.16.32.6/20

R11:172.16.32.11/20、172.16.48.11/20
R12:172.16.48.12/20

Area3à172.16.64.0/19

R7:172.16.64.7/20

R8:172.16.64.8/20、172.16.80.8/20

R9:172.16.80.9/20

Area4à172.16.96.0/19

R9与R10属于同一网段

R9:172.16.96.9/19

R10:172.16.96.10/19

172.16.128.0/17这个网段,由于一共有13个环回,所以需要13个网段。

1.172.16.128.0/21

2. 172.16.136.0/21

3. 172.16.144.0/21

4.172.16.152.0/21

5.172.16.160.0/21

6.172.16.168.0/21

7.172.16.176.0/21

8.172.16.184.0/21

9.172.16.192.0/21

10.172.16.200.0/21

11.172.16.208.0/21

12.172.16.216.0/21

13.172.16.224.0/21

172.16.240.0/21

2.配置 IP

R1:

R2:

image.png

R3:

image.png

R4:

image.png

R5:

image.png

R6:

image.png

R7:

image.png

R8:

image.png

R9:

image.png

R10:

image.png

R11:

image.png

R12:


image.png

3.公网互通

[R3]ip route-static 0.0.0.0 0 34.0.0.4

[R5]ip route-static 0.0.0.0 0 45.0.0.4

[R6]ip route-static 0.0.0.0 0 46.0.0.4

[R7]ip route-static 0.0.0.0 0 47.0.0.4

4.公网ping通检测

R3 ping R5:

image.png

R7 ping R4的环回:

image.png

5. 为R3、R5、R6、R7配置MGRE环境

R3:

[R3]int Tunnel 0/0/3

[R3-Tunnel0/0/3]tunnel-protocol gre p2mp

[R3-Tunnel0/0/3]ip address 172.16.240.3 21

[R3-Tunnel0/0/3]source 34.0.0.3

[R3-Tunnel0/0/3]nhrp network-id 100

R5:

[R5]int Tunnel 0/0/5

[R5-Tunnel0/0/5]tunnel-protocol gre p2mp

[R5-Tunnel0/0/5]ip address 172.16.240.5 21

[R5-Tunnel0/0/5]source Serial 4/0/0

[R5-Tunnel0/0/5]nhrp network-id 100

[R5-Tunnel0/0/5]nhrp entry 172.16.240.3 34.0.0.3 register

R6:

[R6]int Tunnel 0/0/6

[R6-Tunnel0/0/6]tunnel-protocol gre p2mp

[R6-Tunnel0/0/6]ip address 172.16.240.6 21

[R6-Tunnel0/0/6]source Serial 4/0/0

[R6-Tunnel0/0/6]nhrp network-id 100

[R6-Tunnel0/0/6]nhrp entry 172.16.240.3 34.0.0.3 register

R7:

[R7]int Tunnel 0/0/7

[R7-Tunnel0/0/7]tunnel-protocol gre p2mp

[R7-Tunnel0/0/7]ip address 172.16.240.7 21

[R7-Tunnel0/0/7]source GigabitEthernet 0/0/0

[R7-Tunnel0/0/7]nhrp network-id 100

[R7-Tunnel0/0/7]nhrp entry 172.16.240.3 34.0.0.3 register

6.使内网互通

用ospf进行配置

Area1:

R1:ospf 1 router-id 1.1.1.

area 0.0.0.1

network 172.16.0.0 0.0.31.255

network 172.16.128.1 0.0.0.0

R2:ospf 1 router-id 2.2.2.2

area 0.0.0.1

network 172.16.0.0 0.0.31.255

network 172.16.136.2 0.0.0.0

R3:ospf 1 router-id 3.3.3.3

area 0.0.0.0

network 172.16.240.0 0.0.7.255

network 172.16.144.3 0.0.0.0

area 0.0.0.1

network 172.16.0.0 0.0.31.255

Area2:

R6:ospf 1 router-id 6.6.6.6

area 0.0.0.0

network 172.16.240.0 0.0.7.255

network 172.16.168.6 0.0.0.0

area 0.0.0.2

network 172.16.32.0 0.0.15.255

R5

area 0.0.0.0

network 172.16.240.0 0.0.7.255

R11:

ospf 1 area 0.0.0.2

network 172.16.32.0 0.0.15.255

network 172.16.48.0 0.0.15.255

network 172.16.208.11 0.0.0.0

R12:

ospf 1 router-id 12.12.12.12

area 0.0.0.2

network 172.16.48.0 0.0.15.255

[R12]rip 1

[R12-rip-1]undo summary

[R12-rip-1]version 2

[R12-rip-1]network 172.16.0.0

Area3:

R7:ospf 1 router-id 7.7.7.7

area 0.0.0.0

network 172.16.240.0 0.0.7.255

network 172.16.176.7 0.0.0.0

area 0.0.0.3

network 172.16.64.0 0.0.15.255

R8:ospf 1 router-id 8.8.8.8

area 0.0.0.3

network 172.16.64.0 0.0.15.255

network 172.16.80.0 0.0.15.255

network 172.16.184.8 0.0.0.0

Area4:

R9:ospf 1 router-id 9.9.9.9

area 0.0.0.3

network 172.16.80.0 0.0.15.255

network 172.16.176.9 0.0.0.0

ospf 2 router-id 9.9.9.10

area 0.0.0.4

network 172.16.96.0 0.0.31.255

R10:ospf 2 router-id 10.10.10.10

area 0.0.0.4

network 172.16.96.0 0.0.31.255

network 172.16.200.10 0.0.0.0

7.解决基于ospf的Mgre的问题

[R3-Tunnel0/0/3]nhrp entry multicast dynamic

R3:

原本的类型:

image.png

通过命令:

[R3]int Tunnel 0/0/3

[R3-Tunnel0/0/3]ospf network-type p2mp

改后的网络类型:

image.png

观察邻居表和路由表

邻居表:

image.png
image.png

路由表:

image.png
image.png

8.area4网段

路由引入

[R9-ospf-1]import-route ospf 2

[R9-ospf-2]import-route ospf 1

9.R12环回

路由引入

[R12-ospf-1]import-route rip

[R12-rip-1]import-route ospf

10.配置nat

R3:

[R3]acl 2000

[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.31.255

[R3-acl-basic-2000]rule permit source 172.16.128.0 0.0.7.255

[R3-acl-basic-2000]rule permit source 172.16.136.0 0.0.7.255

[R3]int Serial 4/0/0

[R3-Serial4/0/0]nat outbound 2000

R5:

[R5]acl 2000

[R5-acl-basic-2000]rule permit source 172.16.160.0 0.0.7.255

[R5-acl-basic-2000]quit

[R5]int Serial 4/0/0

[R5-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.48.0 0.0.15.255

[R6-acl-basic-2000]rule permit source 172.16.168.0 0.0.7.255

[R6-acl-basic-2000]rule permit source 172.16.208.0 0.0.7.255

[R6-acl-basic-2000]rule permit source 172.16.216.0 0.0.7.255

[R6-acl-basic-2000]rule permit source 172.16.224.0 0.0.7.255

[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.64.0 0.0.15.255

[R7-acl-basic-2000]rule permit source 172.16.80.0 0.0.15.255

[R7-acl-basic-2000]rule permit source 172.16.96.0 0.0.31.255

[R7-acl-basic-2000]rule permit source 172.16.184.0 0.0.7.255

[R7-acl-basic-2000]rule permit source 172.16.192.0 0.0.7.255

[R7-acl-basic-2000]rule permit source 172.16.200.0 0.0.7.255

[R7]int GigabitEthernet 0/0/0

[R7-GigabitEthernet0/0/0]nat outbound 2000

配置缺省

[R3-ospf-1]undo default-route-advertise

[R6-ospf-1]default-route-advertise

[R7-ospf-1]default-route-advertise

检测是否可以与公网的环回通信:

image.png
image.png

8.area4网段

路由引入

[R9-ospf-1]import-route ospf 2

[R9-ospf-2]import-route ospf 1

9.R12环回

路由引入

[R12-ospf-1]import-route rip

[R12-rip-1]import-route ospf

10.配置nat

R3:

[R3]acl 2000

[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.31.255

[R3-acl-basic-2000]rule permit source 172.16.128.0 0.0.7.255

[R3-acl-basic-2000]rule permit source 172.16.136.0 0.0.7.255

[R3]int Serial 4/0/0

[R3-Serial4/0/0]nat outbound 2000

R5:

[R5]acl 2000

[R5-acl-basic-2000]rule permit source 172.16.160.0 0.0.7.255

[R5-acl-basic-2000]quit

[R5]int Serial 4/0/0

[R5-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.48.0 0.0.15.255

[R6-acl-basic-2000]rule permit source 172.16.168.0 0.0.7.255

[R6-acl-basic-2000]rule permit source 172.16.208.0 0.0.7.255

[R6-acl-basic-2000]rule permit source 172.16.216.0 0.0.7.255

[R6-acl-basic-2000]rule permit source 172.16.224.0 0.0.7.255

[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.64.0 0.0.15.255

[R7-acl-basic-2000]rule permit source 172.16.80.0 0.0.15.255

[R7-acl-basic-2000]rule permit source 172.16.96.0 0.0.31.255

[R7-acl-basic-2000]rule permit source 172.16.184.0 0.0.7.255

[R7-acl-basic-2000]rule permit source 172.16.192.0 0.0.7.255

[R7-acl-basic-2000]rule permit source 172.16.200.0 0.0.7.255

[R7]int GigabitEthernet 0/0/0

[R7-GigabitEthernet0/0/0]nat outbound 2000

配置缺省

[R3-ospf-1]undo default-route-advertise

[R6-ospf-1]default-route-advertise

[R7-ospf-1]default-route-advertise

检测是否可以与公网的环回通信:

[R3-GigabitEthernet0/0/0]ospf timer hello 5

13.保证更新安全

以区域1为例à进行接口认证

[R1]int GigabitEthernet 0/0/0

[R1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher

dy12345

[R2]int GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher dy12345

[R3]int GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher dy12345

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 第四章综合实验报告 一.实验拓扑图 二.实验要求 1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使...
    千古风流阅读 19评论 0 0
  • 要求: 1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP; 2、R3-R5、R6、R7为...
    牢弟还得练阅读 30评论 0 0
  • 一、实验拓扑 二、实验要求 1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP; 2、R3...
    最爱吃兽奶_7ab7阅读 656评论 0 1
  • 一、实验拓扑 二、实验要求1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP;2、R3-R...
    4eab863bf194阅读 694评论 0 0
  • 一、实验拓扑图 二、实验要求 1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP; 2、R...
    木兮_1090阅读 25评论 0 0

友情链接更多精彩内容