You are on page 1of 4

Spanning Tree Protocol

The ports on a switch with enabled Spanning Tree Protocol (STP) are in one of the following five port
states.

• Blocking

• Listening

• Learning

• Forwarding

• Disabled

A switch does not enter any of these port states immediately except the blocking state. When the
Spanning Tree Protocol (STP) is enabled, every switch in the network starts in the blocking state and
later changes to the listening and learning states.

-Disabled State

A port in the disabled state does not participate in frame forwarding or the operation of STP because
a port in the disabled state is considered non-operational.

Blocking State

The Switch Ports will go into a blocking state at the time of election process, when a switch receives
a BPDU on a port that indicates a better path to the Root Switch (Root Bridge), and if a port is not a
Root Port or a Designated Port.

A port in the blocking state does not participate in frame forwarding and also discards frames
received from the attached network segment. During blocking state, the port is only listening to and
processing BPDUs on its interfaces. After 20 seconds, the switch port changes from the blocking
state to the listening state.

Listening State

After blocking state, a Root Port or a Designated Port will move to a listening state. All other ports
will remain in a blocked state. During the listening state the port discards frames received from the
attached network segment and it also discards frames switched from another port for forwarding. At
this state, the port receives BPDUs from the network segment and directs them to the switch system
module for processing. After 15 seconds, the switch port moves from the listening state to the
learning state.

Only a root or designated port will move to the listening state. The non-designated port will stay in
the blocking state. No data transmission occurs at this state for 15 seconds just to make sure the
topology doesn’t change in the meantime. After the listening state we move to the learning state.

Learning State

A port changes to learning state after listening state. During the learning state, the port is listening
for and processing BPDUs . In the listening state, the port begins to process user frames and start
updating the MAC address table. But the user frames are not forwarded to the destination. After 15
seconds, the switch port moves from the learning state to the forwarding state.
At this moment the interface will process Ethernet frames by looking at the source MAC address to
fill the mac-address-table. Ethernet frames however are not forwarded to the destination. It takes
15 seconds to move to the next state called the forwarding state.

Forwarding State

A port in the forwarding state forwards frames across the attached network segment. In a
forwarding state, the port will process BPDUs , update its MAC Address table with frames that it
receives, and forward user traffic through the port. Forwarding State is the normal state. Data and
configuration messages are passed through the port, when it is in forwarding state.

 Forwarding state: This is the final state of the interface and finally the interface will forward
Ethernet frames so that we have data transmission!

When a port is not a designated or root port it will be in blocking mode.

What is Bridge Protocol Data Unit (BPDU) frame

Bridge Protocol Data Units (BPDUs) are messages exchanged between the switches inside an
interconnected redundant Local Area Network (LAN).

Bridge Protocol Data Units (BPDUs) frames contain information regarding the Switch ID, originating
switch port, MAC address, switch port priority, switch port cost etc.

Bridge Protocol Data Units (BPDUs) frames are sent out as multicast messages regularly at multicast
destination MAC address 01:80:c2:00:00:00. When Bridge Protocol Data Units (BPDUs) are received,
the Switch uses a mathematical formula called the Spanning Tree Algorithm (STA) to know when
there is a Layer 2 Switch loop in network and determines which of the redundant ports needs to be
shut down.

Three types of Bridge Protocol Data Units (BPDUs) are Configuration BPDU (CBPDU), Topology
Change Notification (TCN) BPDU and Topology Change Notification Acknowledgment (TCA).

The basic purpose of the Bridge Protocol Data Units (BPDUs) and the Spanning Tree Algorithm (STA)
is to avoid Layer 2 Switching loops and Broadcast storms.

Bridge Protocol Data Unit (BPDU) Frame Format

Two important Bridge Protocol Data Unit (BPDU) frames which switches exchange are configuration
Bridge Protocol Data Units (BPDUs) and topology change Bridge Protocol Data Units (BPDUs).
Configuration Bridge Protocol Data Units (BPDUs) are sent between bridges to establish a network
topology. Topology change Bridge Protocol Data Units (BPDUs) are sent after a topology change has
been detected to indicate that the Spanning Tree Protocol (STP) algorithm should be initiated.

• Root Bridge (Root Switch) ID (8 bytes): Identifies the root bridge by listing its 2-byte priority
number followed by its 6-byte MAC address.

• Root Path Cost (4 bytes) : Contains the cost of the path from the bridge sending the configuration
message to the Root Bridge (Root Switch) .

• Sender Bridge (Switch) ID (8 bytes): Identifies the Sender bridge by listing its 2-byte priority
number followed by its 6-byte MAC address.
• Port ID 2 bytes): Identifies the port from which the configuration message was sent.

• Message Age (2 bytes): Specifies the amount of time elapsed since the Root Bridge (Root Switch)
sent the configuration message on which the current configuration message is based.

• Maximum Age (2 bytes): Indicates when the current configuration message should be deleted.

• Hello time (2 bytes): Provides the time period between Root Bridge (Root Switch) configuration
messages.

• Forward Delay (2 bytes): Provides the length of time that bridges should wait before transitioning
to a new state after a topology change.

What is a Root Port

Once the Root Bridge (Switch) is elected, every other Switch in the network must select a single port
on it to reach the Root Bridge (Switch). The single selected port on a Switch with least Path Cost to
the Root Bridge is called the Root Port. Root Bridge (Switch) will never have a Root Port. Root Bridge
(Switch) is at the Root and therefore there is no need of a Root Port to reach the root.

Root port - The root port is always the link connected to the root bridge, or the shortest path to the
root bridge.  If more than one link connects to the root bridge, then a port cost is determined by
checking the bandwidth of each link.  The lowest cost port becomes the root port.  if multiple links
have the same cost, the bridge withe the lower advertising Bridge ID is used.  Since multiple links can
be from the same device, the lowest port number will be used.
The above layout of Switches shows that Switch 4 has two ports to reach the Root Bridge. If there
are multiple ports present in a Switch to reach the Root Bridge (Switch). Spanning Tree Protocol
Algorithm must select the best port from them to reach the Root Bridge. Here the port with least
path cost (4+4=8) is marked as Root Port.

Designated Port - a designated port is one that has been determined as having the best
(lowest)cost.  A designated port will be a forwarding port.

Spanning Tree Protocol priorities/ Path Selection


1. Lowest root bridge ID - Determines the root bridge

2. Lowest cost to the root bridge - Favors the upstream switch with the least cost to root

3. Lowest sender bridge ID - Serves as a tie breaker if multiple upstream switches have equal
cost to root

4. Lowest sender port ID - Serves as a tie breaker if a switch has multiple (non-Etherchannel)
links to a single upstream switch

• Interfaces with portfast enabled that come up will go to forwarding mode immediately, the
interface will skip the listening and learning state.
• A switch will never generate a topology change notification for an interface that has portfast
enabled.

You might also like