Hello Roger,
you are right that âshow running-config | include rootâ is not going to show you anything, because there is not root keyword in running-config.
On the other hand âshow spanning-tree | include rootâ is better approach, it is going to show you if switch is root for any of vlans. We can tweak it a bit more, so the output is going to show you for which vlan it is root.
SW1# show spanning-tree | include root|VLAN
VLAN0001
VLAN0010
This bridge is the root
VLAN0020
VLAN0030
VLAN0040
By using additional â|VLANâ output includes also all lines with âVLANâ in it, so it can give you overview for which VLAN it is the root.
The command âshow running-config | include priorityâ is going to give you vlan number and local switch priority, however, it does not guarantee that with this whatever priority switch is the root.
The best command to show you the root is probably this one.
SW1# show spanning-tree root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 32769 0c00.b82b.c100 4 2 20 15 Gi0/1
VLAN0010 24586 0c00.b8fc.7a00 0 2 20 15
VLAN0020 24596 0c00.b82b.c100 4 2 20 15 Gi0/1
VLAN0030 24606 0c00.b86d.3000 4 2 20 15 Gi0/2
VLAN0040 24616 0c00.b8c1.8300 4 2 20 15 Gi0/3
From this command output we can recognize that local SW1 is the root for vlan 10, because it is advertising Root Cost of 0 and does not have a Root Port. Root switches have only designated ports for the specific vlan(s) they are root for.
âshow spanning-tree rootâ is probably not supported on Packet Tracer, but you can give it a try.
You may also note that using pipe â|â for filtering output is most likely not going to be supported in Cisco exam simulations. If you cannot use pipe and âshow spanning-tree rootâ command, the best bet is to use old school âshow spanning-treeâ or âshow spanning-tree vlan #numberâ command. Or may be âshow spanning-tree summaryâ, in our case it is telling us that local switch is root bridge for vlan 10.
SW1# show spanning-tree summary
Switch is in rapid-pvst mode
Root bridge for: VLAN0010
Extended system ID is enabled
Portfast Default is disabled
Portfast Edge BPDU Guard Default is disabled
Portfast Edge BPDU Filter Default is disabled
Loopguard Default is disabled
PVST Simulation Default is enabled but inactive in rapid-pvst mode
Bridge Assurance is enabled
EtherChannel misconfig guard is enabled
Configured Pathcost method used is short
UplinkFast is disabled
BackboneFast is disabled
Name Blocking Listening Learning Forwarding STP Active
---------------------- -------- --------- -------- ---------- ----------
VLAN0001 2 0 0 14 16
VLAN0010 0 0 0 3 3
VLAN0020 2 0 0 1 3
VLAN0030 2 0 0 1 3
VLAN0040 2 0 0 1 3
5 vlans 8 0 0 20 28
Regarding to command âspanning-tree vlan #number root primary/secondaryâ, in reality this is not a command, but it calls macro that tries to set switchs priority.
If you use âspanning-tree vlan #number root secondaryâ. It sets the priority for specific vlan to 28672. This number is not dynamic, it always has base of 28672. It is because only BPDU from root bridge is propagated, thus we dont know what is second best priority, therefore we set default priority 32768 minus 4096 which equals to 28672.
If you use âspanning-tree vlan #number root primaryâ. This macro is trying to set your switchs priority dynamically to become the root for specific vlan. Priority here always starts with base of 24576 (= 32768 â 2 * 4096) and can go dynamically lower if needed. Remember that this macro is not able to make the switch root in case current root already has priority of 0 or 4096.
Because âroot primary/secondaryâ is not a command, but a macro, we cannot see it in running-config as a command. We can see only priority for certain vlans that may be or may be not, were set by these macros.