The learning algorithm from the previous LAN Switching Lab builds the MAC forwarding tables of bridges, without the need for a routing protocol. However, since learning bridges flood a packet on all ports when a destination is not known, it may happen that packets are forwarded in a cycle and loop indefinitely. The spanning tree protocol for bridges, standardized in the IEEE 802.1d specification, prevents such forwarding loops from occurring. This is done by organizing the bridges in a spanning tree topology. Learning bridges that run the spanning tree protocol are called transparent bridges.
The spanning tree protocol, which is used by virtually all Ethernet switches, works as follows. One bridge, called the root bridge, is elected to be the root of the tree. Each bridge determines which of its ports has the best path to the root bridge. This is the root port of the bridge. On each LAN, the bridges elect one bridge, called the designated bridge, which, among all bridges on the same LAN, has the best path to the root bridge. The port that connects a bridge to the LAN where it is a designated bridge is called the designated port. Then, all bridges disable all ports that are not root ports or designated ports. What results is a spanning tree of bridges. Since a tree topology does not have a loop, forwarding packets along the edges of the tree guarantees that forwarding loops are entirely avoided.
Commands useful in configuring the Spanning Tree Protocol
[no] spanning-tree vlan [vlan range]
-Enable/disable STP on indicated VLANs
spanning-tree vlan [#] priority [#]
-Set the priority of the current switch for the indicated VLAN
show spanning-tree [summary | root | interface | vlan| brief]
- Show information about a spanning-tree
summary shows summery of port states
root shows status and configuration of root bridge
interface shows spanning-tree interface status and configuration
vlan shows spanning-tree interfaces on specified VLAN
brief shows brief sumary of interface information
Spanning-Tree Protocol Configuration Example
Router1# configure terminal
Router1(config)# spanning-tree vlan 1
Router1(config)# spanning-tree vlan priority 8192
Router1(config)# exit
Identifying Spanning-Tree Port Roles in Cisco IOS 12.3
To identify the roles of the ports your CIsco devices after you have set up STP on the network, use the “show spanning-tree brief ” command.
Bridge ID Priority4096
Address cc02.70a9.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 0
Therefore, on router R2 in this example, fa0/2 is Root, fa0/3 is Designated, and fa0/5 is Blocked.
Cisco Ethernet Switch Module documentation (pdf)
PacketLife Cheat Sheets: Spanning Tree