One, STP overview
STP (Spanning tree Protocol, Spanning Tree Protocol) is a ring-proof application that is applied to the switch. function is used for anti-ring.
Basic principle:
By passing a special protocol message between the switches, the Bridge Protocol Data Unit (BPDU) is adopted to determine the topology of the network. There are two types of bpdus, one of which is configuration BPDUs (configuration BPDUs) and one TC BPDU (topology change BPDUs).
The former is used to calculate the non-ring spanning tree, which is used to reduce the refresh time of Mac table entries when the two-layer network topology changes (by default 300s--->15s)
Classification:
stp<portfast,uplinkfast,backbonefast>--->802.1D
PVST
RSTP---->802.1W
MSTP---->802.1s
Second, STP election mechanism
1.STP Bridge role
Role: Root bridge (Root), Standby bridge (secondary), non-root bridge
Election basis: Based on the bid (bridge ID) to the identifier for the election
--->bid= priority (default is 32768) + local MAC address
The smaller the higher the priority
2.STP Port role
Role: Root port (RP), specified port (DP), non-specified port (NDP)
Election basis:
① first election cost is the shortest
② re-election bid minimum
③ again election neighbor PID min
The smaller the higher the priority----all the parameters in the STP are the smaller the higher the priority
Summarize:
Root port: The object is a non-root device, each non-root device has and only one, except the root, the closest port to the root, which is used to receive bpdus groupings.
Specify port: The object is a link, and there is only one on each link. Closest to the root, used to send BPDUs groupings
Blocking ports: Each ring topology has and only one, which blocks the data to prevent loops.
To be elected according to the PID:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/70/94/wKiom1W5vlnir1ceAADmv-rxWVg101.jpg "title=" Image.png "alt=" Wkiom1w5vlnir1ceaadmv-rxwvg101.jpg "/>
3.STP election process
Steps:
The ① first elects the root bridge, and all the interfaces of the root bridge are DP.
② General DP opposite is RP (because DP sends BPDUs packet, RP receives BPDUs packet)
③ General Election process:
Select the root bridge---> select dp/rp---> select NDP (Blocking port)
Three, STP data grouping----BPDUs
Definition of 1.BPDU
BPDUs (bridge Protocol data Unit, bridge Protocol units) are used to implement spanning tree election and maintenance. Usually contains the parameters of the election, such as Bid,pid,cost.
----initial situation can be sent, when the root election, only the root can be sent, the other switches are just forwarding.
Classification of 2.BPDU
configuring BPDUs----cycle 2s
TC bpdus----①TCN BPDU②TC bpdu③tca BPDUs
TCN BPDUs: Topology change informs the package that it can only be emitted from the RP, not necessarily all of the switches have the packet
TC BPDU: Topology change package, when the root bridge receives TCN BPDUs, the TC BPDU packet is emitted from the DP-specified port, all devices receive the packet, and the device receiving the TC BPDU packet sets the aging time of the MAC address from 300s to 15s.
TCA BPDU: A topology change acknowledgement packet that sends a TCA BPDU message to the sender as a reply when the exchange of TCN BPDUs is received.
3. The process of topology change---focus
Normally, the switch receives a configuration BPDU packet only from its RP root port every 2s, but does not actively send configuration BPDUs to Root bridge.
When a topology change occurs,
① when the switch detects that the topology has changed, it sends the TCN BPDU packet to Root bridge, remember that TCN is sent to Root bridge from root Port .
② When the switch receives BPDUs from its specified port DP to the TCN class, it must be forwarded for it, also from its RP, and it must respond by sending a TCA BPDU from its DP to the sender as a reply. Note: This is the normal configuration BPDU package. Its TCA bit is set to 1, indicating that it is to give TCN a reply, but it is not a type of package with TCN.
③ when TCN arrives at Root bridge, the root bridge responds with a normal BPDU packet, and the TC field in the package is set 1,TC that is topology change, which indicates that topology changes are found. This package will be forwarded by all switches, The same TC bit will be set to 1 until it spreads across the network, and all switches are informed of the topology change.
④ The switch that receives the TC BPDU packet will have the MAC address aging from 300s--->15s
Four, STP port state machine
1. Port State Machine
Function: Describes the process of port from initialization State to final forwarding data
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/70/91/wKioL1W5wIyzFIi8AAD1zSL-L5w106.jpg "title=" Image.png "alt=" Wkiol1w5wiyzfii8aad1zsl-l5w106.jpg "/>
BLK: Blocking state processing BPDUs, corresponding interface can only receive BPDUs
LIS: Monitoring status, handling BPDUs and port elections
LRN: Learning status, address learning.
FWD: Forwarding status, data forwarding.
Five, STP link convergence
1. Definition of link State convergence
The process of recovering from a link failure to a stable network topology
2. Classification
Direct link convergence and indirect link convergence
Direct Link Convergence-----30s
conditions that must be met:-----The original NDP is blocked, so it does not require a maximum 20s aging time.
When the topology changes in the two-tier network, the ports that are in the blocking state are transitioning to the forwarding state, which can take up to 30 seconds or 50 seconds. The cause of the failure satisfies the following conditions, the transition from the blocking state to the forwarding state takes 30 seconds, that is The direct connect link of Switch x is down and the blocking interface is also on top of Switch x , which can converge at 30 seconds [direct-attached detection mechanism]. all other conditions are 50 seconds.
Indirect link Convergence-----50s
Indirect: down switch x does not have a blocking port NDP, which requires 20s aging time.
Six, STP enhancement features
1.Portfast---acceleration 30s
Port acceleration for accelerating host access to the switch.
Note: If Portfast is enabled on a port that is connected to another switch, there is a risk of generating a root bridge loop
Configure and verify the Portfast features:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/70/91/wKioL1W5wMKyIOzfAAEWFJQJJh8994.jpg "title=" Image.png "alt=" Wkiol1w5wmkyiozfaaewfjqjjh8994.jpg "/>
2.uplinkfast-----Acceleration 30s
Ability to provide fast convergence after direct link failure, speeding up the election of new root ports.
Note: When the Uplinkfast feature is enabled, it affects all VLANs on the switch. The catalyst switch does not support VLAN-based configuration of the Uplinkfast feature.
After the switch starts uplinkfast, it is not suitable as a root bridge because it increases the path overhead for all ports on the switch.
Uplinkfast Activate a fast-reconfigured condition:
① the Uplinkfast function must be started on the switch
② at least one port in blocking (redundant link exists)
③ link failure must occur at root Port.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/70/91/wKioL1W5wRTzx8c4AAC5stByE-U185.jpg "title=" Image.png "alt=" Wkiol1w5wrtzx8c4aac5stbye-u185.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/70/91/wKioL1W5wTfiWxXYAACJYZZVChw774.jpg "title=" Image.png "alt=" Wkiol1w5wtfiwxxyaacjyzzvchw774.jpg "/>
3.Backbonefast------Acceleration 20s
Backbone acceleration for accelerating indirect link convergence and accelerating 20s
This feature reduces the default convergence time of 50s--->30s in cases where the root port is missing and the two paths are backed up by a different switch.
Note: By doing experiments on their own, in the indirect link convergence, the down port must be root port root.
This article is from the "9305074" blog, please be sure to keep this source http://9315074.blog.51cto.com/9305074/1680082
Analysis and summary of STP spanning Tree protocol