CISCO switch STP experiment (spanning tree protocol)

table of Contents

1. Preface: Spanning Tree Protocol (STP)

Two, CISCO switch STP command summary

Three, use STP to build a simple topology

4. Actual combat: STP comprehensive experiment

Five, conclusion


 1. Preface: Spanning Tree Protocol (STP)

In computer networks, in order to reduce the problem of normal communication caused by network failures, we usually add redundant equipment as a backup to form a redundant topology. However, redundant links are also added, which will cause a switching loop and cause communication messages to be sent cyclically. Switching loops will bring three problems: broadcast storms , multiple copies of the same frame , and unstable switch CAM tables.

Therefore, STP (Spanning Tree Protocol) is to solve the problem of redundant topology. The basic idea of ​​STP is to block some switch interfaces and build a forwarding tree without loops so that a redundant network can automatically adjust the data forwarding path of the network when it fails. STP uses BPDU (Bridge Protocol Data Unit) to communicate with other switches to determine which switch should block which interface.

In order to form a loop-free topology in the network, the switches in the network need to perform the following three steps. Several key fields in the BPDU: elect the root bridge , select the root port, and select the designated port . In these steps, the switch as the root bridge depends on the following factors (in order):
(1) the lowest root bridge ID;
(2) the lowest root path cost;
(3) the lowest sender bridge ID;
(4) the lowest The sender port ID. 


Now that I understand the basic STP knowledge, I will start to experience the actual application scenarios of STP through experiments.

Software platform: Cisco Packet Tracer

Comprehensive practice questions: STP.pka has been uploaded to CSDN, and practice exercises can be downloaded.

Two, CISCO switch STP command summary

command effect
show spanning-tree  View STP tree information
spanning-tree vlan 1 priority 4096   Configure the bridge priority of VLAN1
spanning-tree portfast   Configure the interface as portfast, and immediately enter the forwarding state when a device is connected
spanning-tree uplinkfast   Configure uplinkfast features
spanning-tree backbonefast  Configure backbonefast features
spanning-tree mode rapid-pvst   Set the operation mode of STP to RSTP+PVST
spanning-tree link-type point-to-point Change the link type of the interface to point-to-point
spanning-tree mode mst   Change the spanning tree mode to MST
spanning-tree mst configuration   Enter MST configuration mode
name TEST-MST   Name the MST
revision 1   Configure the revision number of MST
instance 1 vlan 1-2   Map the spanning tree of VLAN 1 and VLAN 2 to instance 1
spanning-tree guard root   Configure the root guard feature on the interface
spanning-tree bpduguard enable   Configure bpduguard feature on the interface

The first command is executed in privileged mode (enable) , and the others are executed in configure terminal .

This experiment only involves the first and second commands, which are used as the basis.

show spanning-tree

 As follows, you can see the specific information of the switch spanning tree, which is divided into two parts: root ID and  bridge ID.

Priority: Priority (parameter range: <0-61440> )

Address: Mac address of the switch

Hello Time: Time interval for sending messages

 

Three, use STP to build a simple topology

The following is the simplest redundant topology. As you can see, the position pointed to by the arrow is blocked. This is the function of the Spanning Tree Protocol. It blocks a link and avoids the formation of a switching loop.

Now we look at the STP situation of Switch0:

STP of Switch1:

The f0/2 interface of Switch0 is blocked, and Switch0 is not the root bridge. No configuration by default, the result is shown in the figure.

So, now you need to set S0 as the root bridge and configure it manually. The operation is to set the Priority to 4096. As mentioned earlier, BPDU determines one of the factors of the root bridge.

命令:
spanning-tree vlan 1 priority 4096

 

After setting the priority of S0, the root bridge becomes S0, and at this time, S0 sends data packets to the network.

4. Actual combat: STP comprehensive experiment

Comprehensive practice questions: STP.pka has been uploaded to CSDN, and practice exercises can be downloaded.

This problem comes up with IP address allocation, maybe this is a difficult point, and the spanning tree protocol we saw earlier only needs one line of configuration, which is relatively simple.

The title only gives the IP address space: 10.1.1.0/24, this is the key breakthrough!

 The VLAN name, VLAN number, and required host IP address correspond as follows:

VLAN number name Number of IP addresses required
vlan 5 Management&Native 10
vlan 15 Production 100
vlan 25 Staff 50
vlan 35 Guest 20

Given the address space 10.1.1.0/24, according to the number of IP addresses, from the most to the least allocation.

Number of IP addresses Host digits Number of available IP addresses Assign network segment (subnet mask)
100 7th place 126 10.1.1.128/25
50 6th place 62 10.1.1.192/26
20 5th place 30 10.1.1.224/27
10 4th 14 10.1.1.240/28

问题来了,虽然得到了VLAN的网段,满足IP地址数量要求,但是题目完全没给出具体IP配置说明!

经过一段时间的探索,终于找到完全正确的地址分配,为每个设备配置IP、默认网关、子网掩码。具体配置就是,默认网关为取各自网段的可用IP第一个,PC、交换机Vlan的IP地址取可用IP地址的第二个。

理解如果还是不清楚,直接用下面我配置好的各设备地址表。

现在解决了题目关键部分,后续就简单了,直接按任务配置就可以。

其中,遇到一个任务:配置Vlan的默认网关,之前没配置过,所以学习了一条配置命令。

交换机配置默认网关命令:
ip default-gateway 10.1.1.255

 完成任务过程,可以边查看进度情况,这是Cisco实验练习题目的一个优点,可以实时检查完成进度。完成率应该为 100%。若不是,则单击 Check Results(检查结果),了解哪些必需的组件尚未完成。

五、结语

STP(生成树协议,Spanning Tree Protocol)就是解决冗余拓扑出现的问题。STP 基本思路是阻断一些交换机接口,构建一棵没有环路的转发树,让具有冗余结构的网络在故障时自动调整网络的数据转发路径。本篇记录学习计算机网络重点知识:生成树协议(STP),详细步骤将从认识到实践,使用Cisco Packet Tracer 完成STP综合练习。同时,也更实际地学习IP地址分配,加深对IP地址的理解和应用。


我的CSDN博客:https://blog.csdn.net/Charzous/article/details/108926031

Guess you like

Origin blog.csdn.net/Charzous/article/details/108926031