How Spanning Tree Works

The Spanning Tree Algorithm places each bridge or switch port into either a forwarding state or a blocking state. All the ports in the forwarding state are considered to be in the current spanning tree. The collective set of forwarding ports creates a single path over which frames are sent between Ethernet segments. Switches can forward frames out ports and receive frames in ports that are in a forwarding state; switches do not forward frames out ports and receive frames in ports that are in a blocking state.

Figure 9-11 shows a simple STP tree with one port on SW3 in a blocking state. Figure 9-11 Network with Redundant Links, with STP









Now when Larry sends a frame to Bob's MAC address, the frame does not loop. SW1 sends a copy to SW3, but SW3 does not forward the frame to SW2 out its port 0/27 because that interface is blocking. STP's job is to figure out how to put the correct interfaces into blocking and forwarding states to prevent loops but allow frames to be sent between every segment. The process itself is not too difficult. First, STP uses Hello messages, also called Bridge Protocol Data Units (BPDUs). Each switch and bridge claims to be the root bridge, and the one with the lowest bridge ID is elected root. The 8-byte bridge ID is the combination of a priority (2-byte) and a MAC address on the switch (6-byte). STP places all ports on the root switch into a forwarding state. In Figure 9-11, SW1 became the root switch.


The root bridge continually sends Hello BPDUs. Each nonroot switch receives the Hellos, changes a few fields, and forwards out all ports. One of the fields that is changed is called cost. This cost field, in which each switch increments before forwarding the Hello message, helps the nonroot bridges decide how good a particular path is to the root bridge. A switch that receives a Hello that has been forwarded by ten other switches probably has a higher cost than a Hello received directly from the root switch, for instance.

Each switch decides which of its interfaces is this switch's root port. The root port of each switch is placed into a forwarding state. To decide which port is the root port, the switch compares the cost value in all the Hello messages that it receives via different physical paths to the root bridge. The interface that received the least-cost Hello message is that switch's root port. In Figure 9-11, SW2's 0/26 interface and SW3's 0/26 interface became their respective root ports.

Finally, each LAN segment has an STP designated bridge on that segment. Many switches can attach to the same Ethernet segment. The switch with the lowest administrative cost from itself to the root bridge, as compared to the other bridges attached to the same segment, is the designated bridge for that segment. The interface that the switch uses to connect to that segment is called the designated port for that segment; that port is placed into a forwarding state. In Figure 9-11, SW2's 0/27 interface became the designated port on the segment between SW2 and SW3.

STP places all other ports into a blocking state. In Figure 9-11, the only port that had not been placed into a forwarding state was SW3's 0/27 interface, so it was placed into a blocking state.

Table 9-5 summarizes the reasons why STP places a port in forwarding or blocking state. Table 9-5 STP: Reasons for Forwarding State

Characterization of Port


All root bridge's ports

The root bridge is always the designated bridge on all connected segments.

Each nonroot bridge's root port

The root port is the port that receives the lowest-cost BPDU from the root.

Each LAN's designated port

The bridge that forwards the lowest-cost BPDU onto the segment is the designated bridge for that segment.

All other ports

All ports that do not meet the other criteria are placed into a blocking state.

STP uses a couple of port states besides forwarding and blocking.

■ Listening—Listens to incoming Hello messages to ensure that there are no loops, but does not forward traffic or learn MAC addresses on the interface. This is an interim state between blocking and forwarding.

■ Learning—Still listens to BPDUs, plus learns MAC addresses from incoming frames. It does not forward traffic. This is an interim state between blocking and forwarding.

■ Disabled—Administratively down.

Under normal operation, when a port needs to change from blocking to forwarding, it first transitions to listening, then learning, and then forwarding. This process, with default timers, takes around 50 seconds.

STP might seem a bit overwhelming at this point. You should key on the general concepts, and the interface states, for the INTRO exam. Refer to Chapter 2, "Spanning Tree Protocol," of the CCNA ICND Exam Certification Guide for a detailed discussion on STP.

Was this article helpful?

0 0

Post a comment