STP BPDU Selection

The path selection for a STP network is:

1) lowest root bridge id
2) lowest cost to reach the root bridge
3) lowest sender bridge id
4) lowest sender port id

The path to the root bridge is calculated based on the bandwidth of the the link. The table below shows how the path cost is calculated based for each protocol.

Data rate STP Cost (802.1D-1998) RSTP Cost (802.1W-2001)
4 Mbit/s 250 5,000,000
10 Mbit/s 100 2,000,000
16 Mbit/s 62 1,250,000
100 Mbit/s 19 200,000
1 Gbit/s 4 20,000
2 Gbit/s 3 10,000
10 Gbit/s 2 2,000

If the speed/duplex of the port is changed, spanning tree recalculates the path cost automatically (if the switch runs IOS). If the switch runs CatOS then the port cost remains fixed.

In a etherchannel, If N links of capacity C are bundled in a single EtherChannel, Cisco Catalyst switches assign the default bandwidth of N x C to the corresponding Port-channel interface. The STP cost of this interface is subsequently computed from this value. If a member link goes down, the bandwidth of the Port-channel will be automatically updated and thus the STP cost will change as well.

Worked Example

stp

In this example assume Cat1 is already the root because it has the lowest [Priority.MAC]. All its ports will be set to forwarding.

Cat3 will receive BPDU on port F0/21 from Cat 1 and F0/19 from Cat 2. The path cost via (Cat3 – Cat 1) Fa0/21 is 19 and via Fa0/19 (Cat 3 – Cat 2 – Cat1) is 19+4 =23. As a result it will select F0/19 as its root port (ie port which it will use to get to the root) due to tie break #2.

Cat2 will receive two copies of the BPDU from Cat 1 on G0/1 and F0/23. Again tie break 2 will be used to decide which port and in this case G0/1 (with a cost of 4) will win compared to F0/23 (with a cost of 19).

Cat 4 will also receive two copies of BPDUs one each on F0/10 and F0/11. In this case tie break three is useless as the sender bridge id is that of Cat3 in both cases. So tie break 4 comes into play and F0/10 is select as the root port as it has the lowest [PortPriority.PortID]. IE [128.1] vs [128.2], these values are based on the senders port priority and port id!

The final network will look as follows

stp2

Advertisements

One thought on “STP BPDU Selection

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