Now that you're familiar with STP's components and operations, let's discuss how to configure STP on your Catalyst switch. The following sections will cover how to tune 802.1D STP parameters to optimize STP for your network layout. Enabling and Disabling STPBy default, STP is enabled for every VLAN on Cisco's switches. STP can be globally enabled or disabled or on a per-VLAN basis. If a switch has only one connection to a switched network or is not part of a loop, STP could be disabled to decrease the likelihood of STP convergence problems disrupting services. However, care must be taken if you choose to take this approach.
For a Catalyst switch, use the following command to enable or disable STP: Switch(config)# [no] spanning-tree [vlan list_of_vlans] Here, the list of VLANs is separated by spaces. Selecting the Root SwitchThe STP command that has the most impact on your STP topology is the one to affect which switch will be the root. You'll need to take a look at your current topology, including existing traffic patterns, and make a decision as to which switch, for each VLAN, will become the root.
To change the priority (part of the bridge ID) to influence the root switch selection process, use the following command: Switch(config)# [no] spanning-tree [vlan list_of_vlans] priority new_priority You'll have to specify a priority less than 32,768 because this is the default priority for all switches that use IEEE's STP. Remember that the switch with the lowest bridge ID is elected as the root. Cisco recommends that the switch that will become the root have a priority of 4,096 and the backup root should have a priority of 8,096 all other switches should use the default bridge priority. Influencing Path SelectionsAfter a root switch is elected and is multicasting its BPDUs, the switches in the network will need to remove loops and provide a single path from any single source to a single destination. Three items affect which ports on a switch will be placed in forwarding or blocking modes:
Each port has an associated cost that's applied to a BPDU when it arrives on that port. These port costs are added as the BPDU is propagated through the network: The more switches that a BPDU passes through, the higher its cost. This value is called a path cost and is used to determine which port to use, if multiple ports exist, to reach the root switch. The path with the lowest value is chosen. If two paths have the same cost, priorities of the respective ports are used as a tiebreaker. You can modify these parameters to influence the port that a specific switch will use to reach the root. Cisco recommends, however, that you take care when using these commands because an incorrect configuration can create suboptimal paths, rather than solving them. You'll need to know all the path costs for each switch involved. The correct choice of the root will usually alleviate you from having to use these commands. Port CostSTP uses the cost of ports to determine which port will be chosen as a root port and thereby automatically placed into forwarding mode. The switch will automatically assign a default port cost based on the speed of the port. There are two versions of the formula. The old version usually takes 1,000 divided by the port speed in megabits per second. A 10Mbps port has a port cost of 100, whereas a 100Mbps port has a port cost of 10. The lower the number, the more preferred the port. The newer specification uses a nonlinear scale to assign costs to ports. Table 4.4 shows the old and new port costs. It's important to point out that this algorithm for port cost is not carved in stone different vendors might use different costs for the same speed port or even different switches among the same vendor.
Note that for 10/100Mbps auto-sensing ports, the cost is usually configured to 10 or 19 (reflecting Fast Ethernet), no matter what the speed is. Therefore, even if the port is configured as a 10Mbps port, the port cost is 10 and the switch will see it as equally as good as a 100Mbps link. Therefore, you should manually change the port cost value if you have a mixture of 10 and 100 speeds on auto-sensing ports. The possible range of values is from 1 to 65,535. If you've done your homework and want to change the port cost on a Catalyst switch, use the following configuration: Switch(config)# interface type slot_#/port_# Switch(config-if)# [no] spanning-tree [vlan list_of_vlans] cost new_cost Cost values can range from 1 200,000,000. Port PriorityA port can be assigned a priority that's used as a tiebreaker when two equal-cost paths to the root exist. The default port priority on a Catalyst switch is 128 and can be set from 0 to 240 in increments of 16 (0, 16, 32, 48, and so on). The lower the number, the more likely it is that the port will be chosen as a root port. If all ports have the same priority, the physically lowest numbered port is chosen by STP. To change the priority on a Catalyst switch, use this configuration: Switch(config)# interface type slot_#/port_# Switch(config-if)# [no] spanning-tree vlan [list_of_vlans] port-priority new_priority Verification of STPAfter you've made your changes, you'll want to verify them to make sure that STP is configured the way that you want it. On a Catalyst switch, you can use the show spanning-tree command to see the changes: Switch# show spanning-tree [vlan vlan_number]| [interface type slot_#/port_#] Note that if you do not specify a VLAN number after the command, the information displayed will be for VLAN 1. Switch# show spanning-tree Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol Bridge Identifier has priority 32768, address 00e0.1e3d.002e Configured hello time 2, max age 20, forward delay 15 Current root has priority 32768, address 00e0.1e2e.51f0 Root port is 10, cost of root path is 10 Topology change flag not set, detected flag not set, changes 1 Times: hold 1, topology change 25, notification 3 hello 2, max age 20, forward delay 15 Timers: hello 0, topology change 0, notification 0 Interface Fa0/1 in Spanning tree 1 is down Port path cost 100, Port priority 128 Designated root has priority 32768, 00e0.1e2e.51f0 Designated bridge has priority 32768, address 00e0.1e3d.002e Designated port is 1, path cost 10 Timers: message age 0, forward delay 0, hold 0 BPDU: sent 0, received 0 In the preceding example, this switch has a bridge ID of 32768.00e0.1e3d.002e and is not the root. This can be seen by comparing the bridge ID in the second line of output with the fourth line of output.
|