Wednesday, October 8, 2008

Spanning Tree


In this post i cover a couple of the basic spanning tree concepts. Root switch selection and how root ports are elected.

In the above scenario the requirement is to make Switch 1 the root switch for vlans 4 and 44. Additionally there is a requirement for the default path for all traffic to be port fa0/12. In the event that this fails then fa0/11 should be used.

To select the root switch for vlans 4 and 44 this is simply achieved by applying the following command on Switch 1.

spanning-tree vlan 4,44 root primary

show span vlan 4

VLAN0004
Spanning tree enabled protocol ieee
Root ID Priority 24580
Address 0013.80de.b880
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 24580 (priority 24576 sys-id-ext 4)
Address 0013.80de.b880
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/11 Desg FWD 19 128.11 P2p
Fa0/12 Desg FWD 19 128.12 P2p


The output states that 'This bridge is the root' and ports 11 and 12 are both designated ports.

I repeat this command on Switch 2

SW2#s span vlan 4

VLAN0004
Spanning tree enabled protocol ieee
Root ID Priority 24580
Address 0013.80de.b880
Cost 19
Port 11 (FastEthernet0/11)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32772 (priority 32768 sys-id-ext 4)
Address 0013.c34f.5000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/11 Root FWD 19 128.11 P2p
Fa0/12 Altn BLK 19 128.12 P2p


Here the Root ID specifies the MAC address of Switch 1. Since the cost and priority of all links to SW1 are equal SW2 has elected the lowest port id as the root port - in this case fa0/11.

To meet the requirements Fa0/12 needs to be the root port. Cost and priority can be used to influence the root port selection. However the question states the configuration must be done on SW1. An important consideration is that port cost is NOT transmitted to neighboring switches. Each switch calculates its own upstream cost metric, hence modifying the port cost on SW1 will NOT change SW2 cost calculations. This only leaves priority as the parameter to change.

The default port priority is 128 (see above output). As with cost the lower the priority the more desirable the path. Hence on SW1 i change the priority of fa0/12 to 16 as follows.

SW1(config-if)#spanning-tree vlan 4,44 port-priority 16

show span vlan 4

Interface Role Sts Cost Prio.Nbr Type
-- --- --------- -- ------ --------------------------------
Fa0/11 Desg FWD 19 128.11 P2p
Fa0/12 Desg FWD 19 16.12 P2p

I then check on SW2 to ensure that fa0/12 has now become the root port.

SW2#s span vlan 4
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/11 Altn BLK 19 128.11 P2p
Fa0/12 Root FWD 19 128.12 P2p

One note of caution. The spanning-tree port priority can be set for all vlans on a port with the command 'spanning-tree port-priority x'. Be sure to read the question requirements to understand whether the priority needs to be changed for explicit vlans or for all!

No comments: