2 Followers
26 Following
TolgaBagci

Tolga Bagci

What is STP (Spanning Tree Protocol-802.1d) in Switches?

What is STP (Spanning Tree Protocol-802.1d) in Switches?

 

STP is a protocol that prevents looping of layer 2 devices during communication. STP uses a spanning tree algorithm to create a topology that does not cause loops.

Ethernet frames do not have a TTL value. Switches flood incoming and unknown packets from all ports except the incoming port. It means that the same package is looped and returned to the same switch. This cycle continues until the switch is closed. After a while, the switch will be down due to loop problems and become inoperable.

We know that the working logic of STP is to prevent and prevent loops in the network. To achieve this, only one path to each destination must be active.

STP makes certain interfaces back up and block. Makes the backup active when the other path becomes unavailable.

The STP first creates a topology database that includes all paths. It then runs the STA (spanning tree algorithm) algorithm to eliminate redundant links.

STA establishes 1 reference point in the network. From this reference point, it selects the best path if there is more than one path. This reference point (Bridge / Switch) is called Root Bridge. The bridge with the smallest Root Bridge id in the environment becomes a root bridge.
The ports of the root bridge are always the Designated port and are always forward.

STP 3-digit structure

Select the root bridge
Select root ports
Designated ports are selected
Only 1 Root port per switch, only 1 Designated port per segment
The closest ports of the Root bridge are Root ports. What we mean by proximity is the cost value which is the root bridge.
STP calculations make the best path selection using the Path Cost criterion. (1000 / Bandwidth)
Most commonly used Cost values:

10 Mbps 100 cost

100 mbps 19 cost

1 gbps 4 cost

10 gbps 2 cost

Bridge ID

Bridge ID = Priority + Mac Address

STP-1

By default, all switches' Biredge root id value is 32769.
If the default priority values ​​of the switches are not changed, the switch with the smallest MAC address becomes Bridge Root, since all will be equal.
Root Bridge selection

Lowest Bridge ID
Lowest path cost to the root bridge
Lowest sender BID
Lowest port ID
Root Bridge Setting

Road I

The switch with low priority is the root bridge. 0 is always root, 61440 is never root.

core (config) # spanning-tree vlan 1 priority 16384 (default is 32769)

ıı.yol

If all switches have the same priority,

core (config) # spanning-tree VLAN 1 root primary (This does not cancel the low priority switch.)

Control:

Switch # sh spanning-tree VLAN 1

Switch # sh spanning-tree active

STP PORT CONDITIONS

BPDU: All switches change their information (Bridge id, root path cost values) in root bridge selection as well as to use the next network configuration. Each switch sends what it takes from one neighbor to another. It performs these steps with the Bridge Protocol Data Unit (BPDU) frames.

Blocking: Does not transmit frameworks, BPDU listens. The purpose of the blocking port is to prevent the use of paths in the loop. The switch is in the blocking port by default when it is first turned on.

Listening: The BPDU continues to listen to the network to ensure there is no loop. The Listening port prepares the data frames for transmission without placing them in the MAC address table.

Learning: BPDU listens and learns all the paths in the switch network. MAC is placed in the address table but does not transmit data frames.

Note:

Listening → Learning time is 15 seconds.

Forwarding: Bridge receives and sends all data frames in the port. Switch ports are usually blocked or forwarding.

Note:

Blocking → Listening time is 20 seconds.

Listening → Learning time is 15 seconds.

Learning → Forwarding time is 15 seconds.

As a result, the port's Blocking → Forwarding time is 50 seconds. (If Portfast is not enabled)

Note: Convergence is completed when all switches are in forwarding or blocking mode. No data is transmitted until the Convergence is completed.

stp_bridge_priority

Note: For faster STP convergence, the core switch STP must be created as root.

PortFast (Cisco specific) (applicable to Host ports)

The STP spends 50 seconds to converge, and the DHCP requests of the hosts may time out. To prevent this, portfast should be applied to the ports. It is necessary to make sure that there are no switch loops in the interfacs that are activated portfast. In case of portfast active interfaces, we can avoid this risk by activating any of the BPDU filter or BPDU Guard in the same interface against the loop problem.

 

References

 

1. Cisco / https://www.cisco.com/
2. SYSNETTECH Solutions / https://www.sysnettechsolutions.com/en/