A brief summary on Spanning-tree Protocol
NOTE:spanning-tree protocol Block redundant link with an intention to unblock them when something happens
*STP is a Layer 2 protocol that is used to prevent switching loops from occurring on a network with redundant links.
*This process prevents the flooding of multiple copies of the same packet across a network by placing switch ports into either forwarding or a blocking state.
*Ports in the forwarding state will forward received packets to the rest of the network.
*Ports in the Blocking state will not forward packets.
*The process begins by electing the Root Bridge-the center of the network | fabric of the network, the messages are exchanged from each switch using
Bridge Protocol Data Unit to determine which device has the lowest Bridge ID (BID)-this is a combination of the Bridge priority and the Bridge Mac address.
*BID is an 8-byte field divided into 2: - 2-byte Bridge Priority and 6-byte Mac address of the switch example: 32768:00A0.1101.B911.
*The 2-byte switch priority is considered first in the determination of the lowest BID and can be manually configured to ensure that the intended switch is elected as the root bridge. The default priority is 32768.
*The 6-byte MAC address is a unique value that is assigned to a device during the manufacturing process and cannot be changed.
*When two or more switches tie for the lowest priority, the switch with the lowest MAC address will have the lowest BID. Because all MAC addresses are unique, there will always be the lowest MAC address.
*Initially, each device includes its own BID in the portion on the BPDU that designates the root switch. However, as the switches receive BPDUs from other devices, the BIDs found in the root-device ID field are compared to determine which BID is lower. The root-device ID field is then updated to reflect the lower.
BID in subsequent BPDUs. This process continues until all switches on the network agree upon a single root device.
*After the Root bridge is elected the other switches, the network finds the best path to the Root Bridge.
*STP determines port states through the use of the Spanning Tree Algorithm (STA) that uses the following procedure to determine port state:
#All ports in a Root Bridge|Root Switch will be placed into the forwarding state (Designated).
#Each non-root Switch|nonroot Bridge places one of the ports with the lowest-cost to the Root Bridge to be a root port.
(Root port is typically a port used to reach the Root Bridg and forward traffic to the root bridge )
(The Port with the Lowest Cost is the root port. The lowest cost is determined by link Bandwidth used:
Link Bandwith|speed Cost
< 10Mbps - 100
< 100Mbps - 19
< 1Gbps - 4
< 10Gbps - 2
The higher the link speed, the lower the path cost and the better the path.
#All other port with the lowest cost, lowest priority, the lowest port number to the other non-root switches, are placed into designated-forwarding state
(Designated port are -basically, a port that is forwarding traffic )
#All other ports are placed into the blocking state.
NOTE: There can only be one Designated port per link
Per-VLAN Spanning Tree Plus:802.1Q
>PVST+ is a revision of the cisco-proprietary Per-VLAN spanning tree protocol, which enables a separate spanning tree to be established for each VLAN.
>PVST implementation of STP, such as PVST+, enables the location of a Root switch to be optimized on a per-VLAN basis.
>PVST+ implementation also offers load balancing between uplinks. However, the ability to load balance comes at the cost of more CPU cycles on the device and increased use of bandwidth by the device because each STP instance sends BPDUs that are unique to that instance.
>Configure PVST+ issue spanning-tree mode pvst-in global configuration mode.
>Each PVST+ instance can have its own unique BID, which means that each VLAN on a network can potentially have a different root bridge.
Rapid SpanningTreeProtocol(802.1w)
<RSTP was developed to reduce the low convergence times required in STP and introduces the alternate port and backup port roles.
<RSTP is an institute of Electrical and Electronics Engineers (IEEE) standard, 802.1w, and is interoperable with 802.1d (STP).
<It operates on the Data link layer of the OSI model.(layer 2)
<An alternate port is a port that has an alternative path or paths to the root bridge but is currently in a discarding state.
<A backup port is a port on a segment that could be used to reach the root port, but there is already an active designated port for the segment.
<An alternate port can also be described as a secondary, unused root port, and a backup port as a secondary, unused designated port.
STP Port States:
*There are five states in STP transition:#Blocking, Listening, Learning, Forwarding, and Disabled.
*After STP initialization, a port moves from blocking to listening, then to learning, and Forwarding state.
*In case of any errors or exceptions, a port may enter into a disabled state directly from any of the other four states.
*Once STP has fully converged, all ports on all switches will be in either a forwarding state or a blocking state. All other port states are transitioning states between blocking and forwarding.
*When STP is initialized, all ports start in the blocking state to prevent bridge loops. If a switch determines that a blocking port must transition to a forwarding state, the blocked port will first move into a listening state, where it begins sending Bridge Protocol Data Units(BPDU).
*Next, the port will transition to a learning state, which allows it to populate its Media Access Control(MAC) address table with addresses learned on the port, but it does not yet forward data frames.
*Finally, it moves into the forwarding state, where the port is capable of sending and receiving data. The switch only learns MAC addresses during the learning and forwarding states.
*All ports in an 802.1D-based STP-enabled network will transition through a series of states.
<listening state-a port is able to send and receive BPDUs from other switches. However, a port in the listening state discards data frames and does not populate the MAC address table.
*After the forward delay timer expires, ports will transition from the listening state to the learning state.
* Forward delay timer-is the time a port will wait before transitioning from the listening state to the learning state and before transitioning from the learning state to the forwarding or blocking state. The default timer is set to 15 seconds. Change the forward delay timer with the spanning-tree VLAN <vlan-id> forward-time <seconds>, where seconds is a value from 4 through 30.
<learning state, they begin to populate the MAC address table with the MAC address of the network based on the frames that they receive. After the forward delay timer expires, root ports and designated ports will transition to the forwarding state. All other ports will transition to the blocking state.
<Forwarding state-a port send and receive BPDUs, populate the MAC address table, and forward data frames. A topology change could cause a port to transition from the forwarding state to the blocking state.
TIMERS:
*The hello timer-is the frequency in which BPDUs are sent from a switch port. By default, BPDUs are sent every two seconds. To change the hello timer issue spanning-tree VLAN <vlan-id>hello-time seconds command.
*The max-age timer-is the maximum amount of time that a port will wait for a BPDU. Whenever a BPDU is received by a port the max-age timer resets. By default the max-age timer is set to a value of 20 seconds, to change issue spanning-tree VLAN <vlan-id>max-age <seconds> where seconds is a value from 6 through 40
PortFast:
<PortFast is a feature that provides immediate access to the network for edge ports.
<PortFast transitions the port into the STP forwarding state without going through the STP listening and learning states.
<Since the ports are not expected to receive BPDUs, they are not required to listen for BPDUs and learn the network topology.
<PortFast can be enabled as a global default as well as on a specific port.
<If enabled as a global default, each port that is configured as an access port is enabled with PortFast.Command spanning-tree portfast in global config mode.
<Enable PortFast on a per-port basis by issuing the Spanning-tree portfast<interface>command in global configuration mode.
BPDU Guard:
<BPDU guard is used to disabling ports that erroneously receive BPDUs.
<BPDU guard is applied to edge ports that have PortFast enabled.
<When BPDU is applied, the receipt of a BPDU on a port will result in the port being placed into the error-disabled state, which prevents loops from occurring
<Whenever a port is that is configured with PortFast receives a BPDUs, the BPDU guard immediately puts that port into the error-disabled state and shuts down the port.
<The port must then be manually re-enabled, or it can be recovered automatically by configuring the errdisable recovery cause bpduguard and errdisable recovery
interval <interval> commands.
<Enable BPDU guard for the entire switch by issuing the spanning-tree port bpduguard default command in global config mode, or enable BPDU guard on a specific
port by issuing the spanning-tree bpduguard enable command in interface config mode.
Root Guard:
<Root guard is used to preventing newly introduced switches from being elected as the new root switch. This allows administrators to maintain control over which the switch is the root.
<Root guard is applied on a per-port basis by issuing the spanning-tree guard root command. If root guard is enabled on a loop guard-enabled port, loop guard will be automatically disabled.
Anyway that about it if you found this to be useful kindly let me know
Thank you
I like the Network insights you have in store, do keep on sharing more of these. 👍