Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the principle of layer 2 STP?

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)05/31 Report--

What is the principle of the second-tier STP? I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

STP

The ultimate goal of STP:

From anywhere in the network, it goes to the shortest loop-free data forwarding path to the switch.

1 same network:

The first problem: single point of failure

Solution: provide network redundancy / backup

1 backup of Devic

2 backup of the link

The new problems brought about:

Layer 2 data forwarding loop

New solution:

STP/RSTP-spanning-tree protpocol [spanning Tree Protocol]

Highlights another problem: utilization

Solution: MSTP [generate instance Tree Protocol]

Common standard agreement:

STP-802.1d, slow

RSTP-802.1w, it's a little fast

MSTP-802.1s

In order to realize the link backup, we can also achieve the load balance of data forwarding and improve the utilization of the equipment.

Protocol for solving layer 2 data Loop

How the STP protocol works / process:

1 elect the role of the switch:

Root switch (bridge):

There is only one and only one in the entire switch network [priority is given to values with small BID]

Non-root switch:

Except for the root switch.

2 Election port role:

Root port:

On any non-root switch, there is and only one

The port closest to the root switch (cost)

Designated port:

There is only one in any network segment.

The port closest to the root switch (cost)

Non-designated port:

All the remaining ports are unspecified.

3 determine the port status:

Down

Listening: listening

[listening BPDU, in order to collect all the BPDU as much as possible and compare]

Learning: learning

[learn MAC address table at this stage]

Forwarding: forwardin

[root port and determine the final status of the port]

Blocking: blocking

[final port corresponding to non-designated port]

All the functions of the STP protocol are implemented through BPDU messages.

BPDU-bridge protocol data unit [bridge protocol data unit]

The basic composition of BPDU message:

Root-id: indicates the ID of the root switch

Cost: indicates the distance from the switch that sent the BPDU to the root switch

Bridge-id: indicates the name of the switch that sent the BPDU

Port-id: indicates the egress port of the switch that sent the BPDU

It consists of two parts:

Port-priority+port-number

[Port priority + port number]

Priority of the port: 1 byte, default 128

Port number; 1 byte, which is the number of the port on the switch

For example, the port-id of the gi0/0/23 of the switch is: 128.23

We can vote for "device roles" and "port roles"

Definition based on "switch role" and "port role"

The four fields in the BPDU message are compared from top to bottom.

The first thing to compare is root-id

If it is different, choose the smallest one as Root-switch

If the same, compare the cost; if not, select the smallest cost

If the same, compare the bridge-id, if not, select the smallest

If the same, compare the port-id, if not, select the smallest

The convergence time of STP: 30ml / 50s.

Hello-2 seconds

[the time period for the root switch to send BPDU, once every two seconds]

Forward-delay=15 second forwarding delay

[indicates the time spent in listening and learning respectively]

Max-age=20 second maximum life time 20 seconds

[minus one second for each switch passed, up to 20 seconds]

Configuration command and explanation: [huawei] stp priority

[priority of STP. Default is 32768. The value must be a multiple of 4096 when set]

[huawei-gi0/0/23] stp cost

[modify the cost of STP on a port]

On Huawei switch, the default cost of 1000m port is 20000.

[huawei] display stp

[you can view the mode of the STP running by the switch, as well as the BID information of yourself and the root switch]

[huawei] display stp brief

[you can view the role and status of each STP-enabled port on the switch]

[huawei] display stp interface gi0/0/23

[you can view the cost of the interface, as well as the sending and receiving of BPDU]

MSTP configuration:

[A] stp region-configuration

[configuration of STP domain]

[A-mst-region] region-name 1

[name the domain]

[A-mst-region] instance 1 vlan 10 20

[create instance 1 and add vlan 10 20]

[A-mst-region] active region-configuration

[activate domain configuration]

[A] stp instance 2 priority 4096

[set priority to instance 2]

[A] display stp instance 1

[check whether the stp of instance 1 takes effect on priority]

After reading the above, have you mastered the principle of layer 2 STP? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report