Example Spanning-Tree Port Priority vs. Cost

from: http://www.cciecandidate.com/?p=585

I started responding to Nkl Hd ’s question, but realized it may be a little bit long-winded for a response.

Consider this example:
SW1-int g0/7 –> SW2-int F0/7
SW1-int g0/8 –> SW2-int F0/8

Root SW – SW1 for vlan 199
SW1(config)#spanning-tree vlan 199 root primary

SW1 – All ports in VLAN designated and forwarding because switch is root
##################################
SW1#sho spanning-tree int g0/7

Vlan Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
VLAN0001 Root FWD 19 128.7 P2p
VLAN0199 Desg FWD 19 128.7 P2p
SW1#sho spanning-tree int g0/8

Vlan Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
VLAN0001 Altn BLK 19 128.8 P2p
VLAN0199 Desg FWD 19 128.8 P2p
#################################

SW2
##################################
SW2#sho spanning-tree int f0/7

Vlan Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
VLAN0001 Desg FWD 19 128.7 P2p
VLAN0199 Root FWD 19 128.7 P2p
SW2#sho spanning-tree int f0/8

Vlan Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
VLAN0001 Desg FWD 19 128.8 P2p
VLAN0199 Altn BLK 19 128.8 P2p
##################################
int f0/7 is root switch and forwarding because cost is equal

PORT-PRIORITY

Port priority is utilized in this instance, but it’s the port priority on SW1 that is used (upstream) – the lower value is preferred

So, to move port SW2-f0/8 into a forwarding state you will change the port priority on one of SW1’s interfaces – REMEMBER, lowest value on the upstream (SW1) is utilized by SW2 to pick the root port

Default port priority is 128 & port # – you may change this in increments of 16
**Also remember to wait for topology change – you won’t see it immediately (forward delay timer X 2 15×2=30sec by default)**

SW1 – we can change the port priority on interface g0/7 OR g0/8 to influence this decision
OPTION 1 – You’re asked to change the config on port g0/7 – make the priority larger than 128
OPTION 2 – You’re asked to change the config on port g0/8 – make the priority lower than 128
OPTION 1 (priority)
############################################

SW1(config)#int g0/7
SW1(config-if)#spanning-tree port-priority ?
port priority in increments of 16
SW1(config-if)#spanning-tree port-priority 240
####################################

Notice, now F0/8 is the root port (forwarding)
####################################
SW2#sho spanning-tree int f0/7

Vlan Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
VLAN0001 Desg FWD 19 128.7 P2p
VLAN0199 Altn BLK 19 128.7 P2p
SW2#sho spanning-tree int f0/8

Vlan Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
VLAN0001 Desg FWD 19 128.8 P2p
VLAN0199 Root FWD 19 128.8 P2p
####################################

OPTION 2(priority)
####################################
SW1(config)#int g0/8
SW1(config-if)#spanning-tree port-priority ?
port priority in increments of 16

SW1(config-if)#spanning-tree port-priority 0
####################################
Notice, now F0/8 is the root port (forwarding)
####################################
SW2#sho spanning-tree int f0/7

Vlan Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
VLAN0001 Desg FWD 19 128.7 P2p
VLAN0199 Altn BLK 19 128.7 P2p
SW2#sho spanning-tree int f0/8

Vlan Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
VLAN0001 Desg FWD 19 128.8 P2p
VLAN0199 Root FWD 19 128.8 P2p
####################################

COST

Before any changes are made, check the topology

####################################

SW2#sho spanning-tree vlan 199 | beg Interface
Interface Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
Fa0/7 Root FWD 19 128.7 P2p
Fa0/8 Altn BLK 19 128.8 P2p

####################################

notice that path cost on both interfaces is equal (19) – so, as above there are 2 options

OPTION 1 – You’re asked to change the config on port SW2 f0/7 – make the cost higher than 19
OPTION 2 – You’re asked to change the config on port SW2 f0/8 – make the cost lower than 19

Option 1 (cost)
####################################
SW2(config)#int f0/7
SW2(config-if)#spanning-tree cost 21
####################################

####################################
SW2#sho spanning-tree vlan 199 | beg Interface
Interface Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
Fa0/7 Altn BLK 21 128.7 P2p
Fa0/8 Root FWD 19 128.8 P2p
####################################

Option 2 (cost)
####################################
SW2(config)#int f0/8
SW2(config-if)#spanning-tree cost 18
####################################

####################################
SW2#sho spanning-tree vlan 199 | beg Interface
Interface Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
Fa0/7 Altn BLK 19 128.7 P2p
Fa0/8 Root FWD 18 128.8 P2p
####################################

This can also be used for MST, the interface command is then SW2(config-if)# spanning-tree mst instance# [cost | port-priority]

Hopefully this clears things up a bit.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s