Do switches dream of electric cars?

I’ve had a nice half day at home today after doing some OOH work last week on Citrix and SQL issues at work, during which I’ve been getting my Spanning Tree Protocol knowledge firmed up, ironed out, straight in my head coz I failed hard on that category a year ago when I last took my BCMSN exam.

One thing that caught me out was the spanning-tree port-priority and spanning-tree cost commands. Being that Spanning Tree is always looking for the lowest cost path back to the root bridge, muggins here thought that essentially these commands did one of the same thing on the non-root switch you were working on. Well, they do and they don’t, it’s where you apply these commands that counts.

In a simple topology where you have two swtiches, one root, and one non-root bridge for highlighting the example..default VLAN 1 and with two cables plugged into each switches Fa 13 and 14 ports as described here:-

Non-Root Fa 0/13 <-> Root Fa 0/13
Non-Root Fa 0/14 <-> Root Fa 0/14

Entering the command show spanning-tree from your non-root switch would result in the output as shown here for VLAN 1 (we’re using Rapid Spanning Tree)

Interface           Role Sts Cost      Prio.Nbr Type
——————- —- — ——— ——– ——————————–
Fa0/13              Root FWD 19        128.13   P2p
Fa0/14              Altn BLK 19        128.14   P2p

This selection of the root port has been made by the non-root (downstream) switch because the Sender port of Fa 0/13 is lower than Fa 0/14 from the root bridge. Just to re-iterate, that 13 is linked to 13 and 14 to 14.
When referring to the Sender here, we’re remembering that configuration BPDUs are sent every two seconds from the root toward the downstream switches.

Lets just explore a little here, if I were to hook up the cables as such:-

Non-Root Fa 0/13 <-> Root Fa 0/15
Non-Root Fa 0/14 <-> Root Fa 0/14

the output of your show spanning-tree command from the non-root switch would look as such

Interface           Role Sts Cost      Prio.Nbr Type
——————- —- — ——— ——– ——————————–
Fa0/13              Altn BLK 19        128.13   P2p
Fa0/14              Root FWD 19        128.14   P2p

So to summarise, you’ve changed the cabling of your Root switch and this has cause the root port to change on the Non-root switch because the Sender port-id was lower coming in on Fa 0/14.

So this is where the two interface commands spanning-tree port-priority and spanning-tree cost come into play.

2960SW1(config-if)#spanning-tree cost <1-200000000>  port path cost

using this command on the Non-root switch will change the cost, normally determined by the bandwidth of the link, so changing the cost of the link, here already stated as 19 as it’s a 100MB link, to 1 – a lower cost, will force Spanning-tree to choose that port as the root port as displayed here

Interface           Role Sts Cost      Prio.Nbr Type
——————- —- — ——— ——– ——————————–
Fa0/13              Altn BLK 19        128.13   P2p
Fa0/14              Root FWD 1         128.14   P2p

See the Cost column is now one, and that is the new root port.
This command can be applied to the port for all VLANs using

2960SW1(config-if)#spanning-tree cost 1

or to a single VLAN on that port using the command as such

2960SW1(config-if)#spanning-tree vlan 66 cost 1

So that leaves the command spanning-tree port-priority doesn’t it! This command is used on the upstream switch and in this examples case, the root switch to influence downstream or non-root switches path decisions.

This time on your root or upstream switch, as an example you’d modify the higher interface’s properties as follows

3750SW1(config-if)#spanning-tree port-priority 112

the values accepted here are in increments of 16 away from the base value of 128, from 0 – 240. The value of 112 is the minimum you need to decrease the cost of the path using Fa 0/14 on the root switch. Again this can be done on a port or per-VLAN basis by changing the command to this

3750SW1(config-if)#spanning-tree vlan 66 port-priority 112

This configuration on the root switch would lead to this output on the non-root switch

Interface           Role Sts Cost      Prio.Nbr Type
——————- —- — ——— ——– ——————————–
Fa0/13              Altn BLK 19        128.13   P2p
Fa0/14              Root FWD 19         128.14   P2p

See this time that the Cost is equal, but the decision has been made as a result of your upstream switches configuration to use the Fa 0/14 port as the root port instead of 13 which would naturally take precedence in a default configuration.

I hope this helps peeps de-mystify the STP path decisions somewhat.

On a completely separate buzz, I’ve passed through another stage of the selection process for the Smart-EV trial  in the South-East and London. It’ll be interesting, though the motor is lease hire and it’ll mean a fair amount of cash down the drain over a calendar year, fuel will for all intents and purposes be free and I’ll actually have a motor to go places in which is a monumental thing. I’ve been without four wheels for many years now and I recently sold my motorbike as it was simply not getting used.
I think next stop is test drive whilst they credit check me, so I’ll post my thoughts once I’ve had a go in it and let y’all know what I think!

Be Cool

P

Advertisements

1 thought on “Do switches dream of electric cars?”

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