As many of our students and clients have learned, Spanning Tree in Layer 2 Ethernets is a basic control protocol that removes logical loops from physically looped networks creating the Spanning Tree.
This How To focuses on the essential configuration commands in Cisco IOS that you need to know to manage Spanning Tree.
Important note: Before we start, you should know that “low is high and high is low”. Â This means that with any of the numbers used as parameters below, the lower the number the higher its importance or value.
OK. Â With that in place let’s look at what you can change/administer in Spanning Tree.
Changing the Root Bridge
The most important command is the ability to change or administer the Root Bridge. Â The root bridge is determined by the STP sending BPDU’s. Â These BPDU’s contain the MAC address and priority of each switch in the Ethernet. Â The switch with the lowest MAC and Priority wins!
Seems simple enough. Â But what if you place an old switch, which will likely have a low (old) MAC address into the loop? Â The answer is, it could become the root!!
Whoa!
Another critical issue is that when the administrator looks at the network of Core, Distribution, and Access switches, they will want the Root to be somewhere in the core.
The way you ensure that a given switch is going to be the Root is to issue the following command:
Cell_Switch(config)# spanning-tree vlan [x] root primary
Note: the ‘x’ above is for the VLAN as Spanning Tree will be running in Per VLAN mode (PVST) by default. Â You can have multiple VLAN’s in the command. Â You can also set up a ‘secondary’ root bridge as well.
When you issue this command the switch will take the default priority (32768) and reduce it by two increments (-4096) resulting in a new priority of 24577. Â Remember lower is higher priority.
Another option is to actually set the priority number administratively:
Cell_Switch(config)# spanning-tree vlan [x] priority [y]
‘y’ above is the number you select. Â This allows you to override switches that may have the ‘primary’ or ‘secondary’ options creating confusion.
Changing Port Priority
When two switches have multiple interfaces connected between them, there are physical loops created. Â Again, spanning tree will resolve this using the MAC address of the ports and the priority settings defined in the switch for the port speeds:
Link Speed | Old IEEE Costs | New IEEE Costs |
10 MB/s | 100 | 100 |
100 MB/s | 10 | 19 |
1 GB/s | 1 | 4 |
10 Gb/s | NA | 2 |
100 Gb/s | NA | 1 |
There are some others as well: 4Mb/s = cost 250, 16Mb/s = cost 62, 45Mb/s = cost 39, 155Mb/s = cost 14, 622Mb/s = cost 6.
So if you have two interfaces, both running at Gigabit Ethernet, their costs will be the same, thus STP will pick the lowest MAC, which in the case of switch ports is the lower port number.
What if you want this reversed? Â The answer is to configure the switch port administratively with the cost to override the defaults:
Cell-Switch(config-if)# spanning-tree port-priority [y]
Changing the Path Costs
STP adds up the port priorities on different paths around the physical loops. Â Again, if you want to override a particular path cost, you can do this with the following command:
Cell-Switch(config-if)# spanning-tree port-priority [y]
Changing the Hello Timer Delault (2 seconds)
Not sure why you would mess with this other than to attempt to speed up STP. Â Here is the command nonetheless:
Cell-Switch(config)# spanning-tree vlan [x] hello-time [y]
‘y’ is a number in seconds. Â The minimum is 1.
Well, we hope this quick reference helps with Spanning Tree.