Spanning Tree Protocol Essentials for the CCNA Exam
Author: John Pherson
Abstract
The Spanning Tree Protocol (STP) was developed to solve the
problems caused by loops in a bridged, or switched, topology. This
white paper discusses how the STP is addressed in the CCNA exam. We
can use the terms bridge and switch interchangeably in this white
paper because they act in a similar fashion; switches are
essentially very fast multi-port bridges.
The underlying cause of bridging loops is the fact that switches
flood broadcast frames and frames with unknown destination MAC
addresses. When there are loops in the topology, switches receive
copies of the same frame on multiple ports which confuses the MAC
table. It also causes switches to multiply the number of frame
copies, since each switch floods the frames it is receiving. Each
switch then starts receiving multiple copies of the frames and
flooding the copies. This leads to broadcast storms and duplicate
unicast frames on the network.
STP stops this process by first identifying a bridge, called a
root bridge, to serve as a reference point for the topology. Once
the root bridge is selected, each non-root bridge determines the
lowest-cost path back to the root, and identifies the port
associated with that path as the root port. Once each bridge
determines its root port, it then evaluates any other paths to the
root that will cause loops. For each of these paths a single
bridge, called the designated bridge, is selected to provide
connectivity for that segment back to the root. Any other switches
on the same segment will be non-designated, and the ports on these
bridges will be put in blocking state.
Blocking state does not mean the port is shut down; it simply
means that no frames are allowed to be sent or received through
that port. Spanning tree information continues to be received via
that port from the designated bridge on that segment, which allows
STP to communicate a change in topology should one occur.
The Bridge ID (BID)
| Spanning Tree Priority (16 bits) |
Switch MAC Address (48 bits) |
Table 1. IEEE Spanning Tree
Bridge ID
Each switch has a spanning-tree bridge ID composed of two parts,
the priority and the MAC address. The MAC address is burned into
the switch at the time of manufacture, and can't be changed. But
the bridge ID as a whole can be modified by changing the priority
assigned to the switch. Since STP always prefers the switch with
the lowest bridge ID, lowering the priority value of a switch makes
it more likely to become the root, and makes it more likely to be
the designated switch for a segment. The spanning-tree vlan 1 root
[primary, secondary, # value] command modifies the priority
setting.
The default priority setting is 32768.
| Spanning Tree Priority (4 bits) |
VLAN ID (12 bits) |
Switch MAC Address (48 bits) |
Table 2. Extended System-ID
Bridge ID
Cisco's implementation of spanning-tree is done, by default, at
the VLAN level. Each VLAN runs its own instance of spanning-tree.
This is called PVST (per-vlan spanning-tree). To support this,
Cisco modified the bridge ID to include a 12-bit VLAN ID field in
the bridge ID which is called the Extended System ID. The rationale
for this was that the priority field did not need the granularity
provided by a 16-bit field, but instead could get by with the top
four bits of the field, leaving 12 bits to express a VLAN ID. This
is consistent with the VLAN ID field in a dot1q frame, which also
has a 12-bit VLAN ID field. It means then, that the priority bits
have decimal values of 4096, 8192, 16384, and 32768. Using this
form of the bridge ID means that priorities are always expressed as
some multiple of 4096.
Path and Port Cost
| Port Speed |
Port Cost |
| 10Mb |
100 |
| 100Mb |
19 |
| 1 Gb |
4 |
| 10 Gb |
2 |
Table 3. Port
Costs
The costs used by STP are derived from the above table, which
assigns cost based on the port speed. A switch directly attached to
the root looks at the port by which it is attached, and derives its
path cost to the root from the speed of that port. These switches
then advertise this path cost to their downstream neighbors. Each
downstream switch adds the path cost advertised by the upstream
switch to the cost associated with the local port receiving the
information. The sum of these costs becomes their own path cost
back to the root.
The table shows the current cost scheme used by IEEE
(traditional 802.1d) Spanning Tree and Rapid Spanning- Tree
protocols. This cost scheme supersedes an earlier cost scheme that
ran out of headroom as port speeds became faster. It has also been
superseded by a more recent cost scheme used on a variant of
spanning-tree called Multiple Spanning-Tree, which is outside the
scope of the CCNA content. You should be familiar with the costs
listed above.
Related Courses
ICND1 - Interconnecting Cisco Network Devices 1
ICND2 - Interconnecting Cisco Network Devices 2
BCMSN - Building Cisco Multilayer Switched Networks
v3.0