I found that there are many engineers who don't understand STP Port-ID concept, so I decided to write this blogpost for ease of reference.
STP Tie-breaking sequence is as following:
1. Lowest Root Bridge ID.
2. Lowest Root Path Cost.
3. Lowest Sender Bridge ID.
4. Lowest Sender Port ID.
The key word in the last tie-breaker is "Sender" Port ID, not the local one.
Let's use this simple topology:
I will use RPVST+, but it doesn't really matter, which STP flavor you use.
Firstly, the Root Brdige is being elected (SW1, due to lower MAC-Address).
Then, each non-Root Bridge has to choose one Root Port. SW2 has two equal links connected to SW1.
The tie breaking sequence:
1. SW2 receives BPDUs with the same Root Bridge ID on both links.
2. Since both interfaces are the same, Root Path Cost is the same too.
3. Both links are connected to the same switch, thus Sender Bridge ID in these BPDUs are the same.
4. SW2 receives two BPDUs with different Sender Port ID and chooses the lowest one. It happens to be BPDUs on E0/0.
So, E0/0 is chosen as Root Port, and E0/1 is blocked.
SW2#show spanning-tree detail | begin Port
Port 1 (Ethernet0/0) of VLAN0001 is root forwarding
Port path cost 100, Port priority 128, Port Identifier 128.1.
Designated root has priority 32769, address aabb.cc00.6400
Designated bridge has priority 32769, address aabb.cc00.6400
Designated port id is 128.1, designated path cost 0
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point
BPDU: sent 5, received 233
Port 2 (Ethernet0/1) of VLAN0001 is alternate blocking
Port path cost 100, Port priority 128, Port Identifier 128.2.
Designated root has priority 32769, address aabb.cc00.6400
Designated bridge has priority 32769, address aabb.cc00.6400
Designated port id is 128.2, designated path cost 0
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 0
Link type is point-to-point
BPDU: sent 3, received 233
In the output above take a look at Designated port id. SW2 has no designated ports, so indeed upstream BPDU information is being analyzed.
Just to prove it let's swap ports on SW2:
Even though E0/0 on SW2 has lower Port ID, it is being blocked:
SW2#show spanning-tree detail | begin Port
Port 1 (Ethernet0/0) of VLAN0001 is alternate blocking
Port path cost 100, Port priority 128, Port Identifier 128.1.
Designated root has priority 32769, address aabb.cc00.6400
Designated bridge has priority 32769, address aabb.cc00.6400
Designated port id is 128.2, designated path cost 0
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 0
Link type is point-to-point
BPDU: sent 2, received 121
Port 2 (Ethernet0/1) of VLAN0001 is root forwarding
Port path cost 100, Port priority 128, Port Identifier 128.2.
Designated root has priority 32769, address aabb.cc00.6400
Designated bridge has priority 32769, address aabb.cc00.6400
Designated port id is 128.1, designated path cost 0
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point
BPDU: sent 4, received 121
Dont' forget that Port ID consists of two parts:
- Port Priority - 128 by default, can be configured with values from 0 to 192 in increments of 64.
- Port ID - usually starts with 1 and increments by 1, but with chassis and LAGs this value can be not quite obvious.
Let's change E0/1 Port Priority on SW1, so SW2 will block E0/1 port.
SW1#show running-config interface e0/1
interface Ethernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
duplex auto
spanning-tree link-type point-to-point
spanning-tree port-priority 64
end
SW2#show spanning-tree detail | begin Port
Port 1 (Ethernet0/0) of VLAN0001 is root forwarding
Port path cost 100, Port priority 128, Port Identifier 128.1.
Designated root has priority 32769, address aabb.cc00.6400
Designated bridge has priority 32769, address aabb.cc00.6400
Designated port id is 64.2, designated path cost 0
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point
BPDU: sent 5, received 316
Port 2 (Ethernet0/1) of VLAN0001 is alternate blocking
Port path cost 100, Port priority 128, Port Identifier 128.2.
Designated root has priority 32769, address aabb.cc00.6400
Designated bridge has priority 32769, address aabb.cc00.6400
Designated port id is 128.1, designated path cost 0
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point
BPDU: sent 4, received 317
As you can see, changing the Port Priority on the upstream switch affects blocking decision on the downstream switch.
The topology used along with the configuration files (IOU) is available here.
No comments:
Post a Comment