try to finish stp report

This commit is contained in:
2025-09-23 16:06:36 +08:00
parent 09d1be207a
commit 1277db7f31
33 changed files with 11 additions and 31 deletions

Binary file not shown.

View File

@ -1,15 +1,15 @@
#import "labtemplate.typ": *
#show: nudtlabpaper.with(title: "生成树协议STP配置",
author: "王李烜",
id: "202202001046",
author: "程景愉",
id: "202302723005",
training_type: "无军籍",
grade: "2022",
grade: "2023",
major: "网络工程",
department: "计算机学院",
advisor: "张军",
jobtitle: "工程师",
lab: "306-707",
date: "2024.11.07",
date: "2025.09.19",
header_str: "《网络工程》实验报告",
)
#set page(header: [
@ -21,7 +21,7 @@
#show heading: it => box(width: 100%)[
#v(0.50em)
#set text(font: hei)
#set text(font: "Noto Sans CJK SC")
#it.body
]
@ -33,7 +33,7 @@
#show heading: it => box(width: 100%)[
#v(0.50em)
#set text(font: hei)
#set text(font: "Noto Sans CJK SC")
#counter(heading).display()
// #h(0.5em)
#it.body
@ -70,7 +70,6 @@
- 备用端口Alternate Port/Backup Port备用端口是指那些既不是根端口也不是指定端口的端口。这些端口在STP中被阻塞不参与数据的转发但它们仍然会接收BPDU以便于在网络拓扑发生变化时可以快速转变为根端口或指定端口从而提供链路的备份。
]
=== STP算法的步骤
#para[
生成树算法有三个步骤,下面以@原始有环拓扑 为例说明STP的工作原理。
#figure(image("原始有环拓扑.jpg",format: "png",fit:"stretch",width: 25%),caption: "原始有环拓扑")<原始有环拓扑>
+ 选举根交换机
@ -104,13 +103,13 @@
caption: "链路带宽的成本"
)
例如一系列千兆网口组成的路径每经过一个设备的成本就是4。成本最小的口就是根端口。
#figure(image("线路成本.jpg",format: "png",fit:"stretch",width: 45%),caption: "链路成本示例")<链路成本>
#figure(image("线路成本.jpg", format: "png", fit:"stretch",width: 45%),caption: "链路成本示例")<链路成本>
@链路成本A是根交换机从B、C的G0/1口到A的成本值均为4所以它们都被选为根端口。但是D的G0/1与G0/2口成本值都是4+4=8成本值相同则还需要进行网桥ID的比较。
- 对端的网桥IDBID最小。如上文所述@链路成本 这种情况中D到A的无论哪条路成本都是8则需要继续比较双方中哪个接口的对端BID更小。
#figure(image("对端BID最小.jpg",format: "png",fit:"stretch",width: 80%),caption: "对端BID最小")<对端BID最小>
#figure(image("对端BID最小.jpg", format: "png", fit:"stretch",width: 80%),caption: "对端BID最小")<对端BID最小>
B是00-06C是00-05即对端C的BID更小所以D的G0/2被选举为了根端口。
- 对端的端口IDPID最小。在最后如果路径成本和网桥ID都相同则还要比较端口ID的大小。
#figure(image("对端PID最小.jpg",format: "png",fit:"stretch",width: 65%),caption: "对端PID最小")<对端PID最小>
#figure(image("对端PID最小.jpg",format: "png", fit:"stretch",width: 65%),caption: "对端PID最小")<对端PID最小>
此处的PID优先级都是默认值为128。而Fa0/1比Fa0/2小所以Fa0/1被选举成为了根端口RP。
+ 选举指定端口并阻塞备用端口AP
@ -122,7 +121,6 @@
- BPDU转发端口到根交换机的路径成本最小的是指定端口DP。例如D、E之间的两条链路D到A的成本更低所以在这两条链路上DP均在D交换机处。
选举完指定端口剩余端口就成了备用端口APAlternate Port将他们阻塞Block即可在所有交换机之间形成一条无环的链路。
#figure(image("成品图.jpg",format: "jpg",fit:"stretch",width: 40%),caption: "最终形成的链路拓扑(绿色粗线为连通的链路)")<成品图>
]
== BPDU保护
#para[
如果有人伪造RST BPDU恶意攻击交换设备当边缘端口接收到该报文时会自动设置为非边缘端口并重新进行生成树计算引起网络震荡。配置BPDU保护功能后如果边缘端口收到BPDU报文边缘端口将会被立即关闭防止网络中的恶意攻击。
@ -139,7 +137,6 @@
网工系的宿舍楼中有一套局域网各个寝室里有一些PC寝室之间有几台交换机PC和交换机之间通过网线连接。网工系学生热爱学习经常开展研讨会研究学术问题。在要求熄灯就寝之后网工系学生不能出寝室门于是他们在寝室的PC上开视频研讨会继续讨论学术问题。为了提高网络的可靠性他们在交换机之间安装了一些了冗余备份链路。但这会形成环路报文可能在环形网络中不断循环设备由于重复接收相同的报文处理能力会下降。所以他们还需要在交换机上配置生成树协议将环形网络结构修剪成无环路的树形网络结构。
]
== 实验设备
#para[
#align(center)[#table(
columns: (auto, auto,auto),
rows:(2em,2em,3em),
@ -152,20 +149,16 @@
"PC", "联想启天M410
Windows 10", "2",
)]
另有网线若干控制线1条。
]
= 实验步骤及结果
== 实验拓扑
#para[
按实验背景,绘制拓扑图如下:
#figure(image("实验拓扑.png",format: "png",fit:"stretch",width: 60%),caption: "实验拓扑图")<实验拓扑>
要求在配置好各个端口的路径开销值之后运行STP能将@实验拓扑 中的Blocked Port端口阻塞。
]
== 按照拓扑图接线
#para[
按照拓扑图接线。
#figure(image("接线图.png",format: "jpg",fit:"stretch",width: 80%),caption: "接线图")
]
#figure(image("接线图.jpg", fit:"stretch",width: 80%),caption: "接线图")
== 配置PC
#para[
设置319寝室的IP地址为`192.168.3.19`319寝室的IP地址为`192.168.3.12`
@ -173,36 +166,26 @@
== 配置STP
#para[下列许多步骤在LSW1、LSW2、LSW3和LSW4上都有相同的操作这里只列出*LSW2*上的操作步骤。]
=== 配置STP工作模式
#para[
配置环网中的设备生成树协议工作在STP模式
#figure(image("step0.png",format: "png",fit:"stretch",width: 100%),caption: "配置STP工作模式")
]
=== 配置根桥和备份根桥设备
#para[
配置根桥设备为LSW1备份根桥设备为LSW4
#figure(image("step1.png",format: "png",fit:"stretch",width: 35%),caption: "配置根桥LSW1")
#figure(image("step2.png",format: "png",fit:"stretch",width: 60%),caption: "配置备份根桥LSW4")
]
=== 配置端口路径开销
#para[
配置端口的路径开销值:
#figure(image("step3.png",format: "png",fit:"stretch",width: 60%),caption: "配置端口路径开销")
特别地LSW3的g0/0/1口的路径开销值为20000:
#figure(image("step4.png",format: "png",fit:"stretch",width: 70%),caption: "配置LSW3的g0/0/1口路径开销")
]
=== 使能STP破除环路
#para[
- 将与PC机相连的端口设置为边缘端口。配置LSW2
#figure(image("step5.png",format: "png",fit:"stretch",width: 70%),caption: "配置LSW2边缘端口")
配置LSW3的g0/0/1口为边缘端口并启用BPDU保护功能
#figure(image("step6.png",format: "png",fit:"stretch",width: 70%),caption: "配置LSW3边缘端口并启用BPDU保护")
- 设备全局使能STP:
#figure(image("step7.png",format: "png",fit:"stretch",width: 30%),caption: "全局使能STP")
]
== 实验结果验证
=== 查看各交换机端口状态
#para[
配置完成后,查看各个交换机的端口状态,确认生成树协议已经生效。
在LSW1上执行display stp brief命令查看端口状态和端口的保护类型结果如下
#figure(image("lsw1dis.jpg",format: "jpg",fit:"stretch",width: 75%),caption: "查看LSW1的STP状态")
@ -215,13 +198,10 @@
在LSW3上执行display stp brief命令查看端口状态结果如下
#figure(image("lsw3dis.jpg",format: "jpg",fit:"stretch",width: 80%),caption: "查看LSW3")
端口g0/0/3在生成树选举中成为根端口处于*FORWARDING*状态端口g0/0/1在生成树选举中成为Alternate端口处于*DISCARDING*状态。此外由于我们配置了BPDU保护g0/0/1状态的Protection字段显示为*BDPU*
]
=== 查看网络连通性
#para[
在319寝室的PC1上执行ping命令查看与312寝室PC2的网络连通性结果如下
#figure(image("319ping312.jpg",format: "jpg",fit:"stretch",width: 70%),caption: "查看网络连通性")
两台PC之间可以正常通信网络连通性正常。至此319与312寝室的学生可以在熄灯后继续通过视频研讨会进行学术讨论。
]
= 实验总结
#para[
本次实验通过配置生成树协议STP实现了对网络中的环路进行消除保证了网络的稳定性和可靠性。通过实验我掌握了生成树协议的基本概念和工作原理学会了如何在网络设备上配置STP理解了STP的防止环路、优化网络拓扑的功能。实验中我通过实际操作深入理解了STP在现代网络中的应用提升了实践技能为未来的网络工程职业生涯和专业认证考试打下了坚实基础。

BIN
2_stp/接线图.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB