Introduction to Spanning-Tree

Hi Rene

Very good explanations with examples
However one point.
To choose a designated port on a network segment which has got no root port , the first priority will be the least cost path to the root bridge.
The next would be the port on a switch whose bridge priority is less compared to the other port in the segment which you have already stated.
Iam I right ?

Ramananthan,
You are correct! Assuming equal cost paths to the root bridge, then the designated port will be the port that belongs to the switch with the lowest bridge ID. If there are multiple connections to this same switch (that has the lowest bridge ID), then the lowest port number will be the DP.

I know it’s a little off-topic, but thanks RenĂ©. I was looking for the Visio stencils as well. The ones you use look cleaner than the ones I was using. Much appreciated.

Hi Rene,
Please clear following doubts of spanning tree.

  1. In the Listening mode, each switch sends Hello BPDUs. In this stage, Root Bridge is decided. After Root Bridge is decided, then only Root Bridge sends BPDUs for deciding Port Roles like DP, RP etc.Please correct me if I am wrong.
  2. Regarding the TCN. In STP, root bridge receives TCN, then it will send BPDU message with TC bit set and this happens for Max Age + Fwd Delay time.
    So during this period only, transition of port is also happening. Its confusing. Can you please explain this point more cleary.

Hi Rene,

One more small doubt: what is the reason for the root bridge to sent the BPDUs with TC flag set for fwd Delay + Max Age time?

Suggestion to be clearer:
For example whenever the switch doesn’t know about a destination MAC address (unknown unicast) in the MAC address table of the switch, it will be flooded.

Hi Edi,

If your question is whether a switch receive a frame for a destination MAC address which doesn’t have an entry in the MAC address table of the switch, then it is correct that it will be flooded to all the ports of the switch in exception of the incoming port from where the frame has been received.

Here a lesson explaining this in details: How does a switch learn Mac addresses

Hope I could answer you.

Hi rene!I have a question
 if STP is disabled for a VLAN, what will be the state of the ports belonging to that vlan?

Thanks in advance!
Jimmy

Hi Jimmy,

You can disable STP per VLAN with the no spanning-tree vlan command. These interfaces will be forwarding traffic. They don’t go through the listening, learning and/or blocking states.

Rene

19 posts were merged into an existing topic: Introduction to Spanning-Tree

Superb explanation Rene!! Keep it up. :slight_smile: Thank you!!

Hi,

I have a doubt. Let’s take a below simple topology

SwitchA ----- switch B

Switch A - root bridge and it’s port connected to switch B is designated port

Switch B - non root bridge and it’s port connected to switch A is root port

Both switch A and switch B ports are in forwarding state.

when I lowered the bridge priority of switch B then switch B becomes root bridge and switch A is non root bridge

Switch B port connected to switch A is designated port and forwarding state

Switch A port connected to switch B is root port and forwarding state.

Now my question is when both switch A and switch B change its port role due to root bridge re-election because of change in switch B bridge priority what will be the port state of the both switch - forwarding? Listening? blocking? or port role continue to change in forwarding state only?

Previously both switch ports are in forwarding state.

Thanks

Raghu.K

Hello Raghu

I am assuming simple STP is configured on the switches.

Switches send a BPDU to each other every 2 seconds by default. The BPDUs contain the bridge priority and ID. Once you change the priority of Switch B, it’s BPDU will contain a superior bridge priority. Once Switch A receives this BPDU, it will no longer consider itself root bridge, but will see Switch B as root bridge.

For the specific topology that you mention, the ports will remain in the forwarding state. This is because the designated port in Switch B immediately becomes a root port since Switch B itself becomes the root bridge and no change of state is necessary. Secondly, the port on Switch A is directly connected to the root itself so again there is no need for a change of state. If there were additional switches with blocked and designated ports, then those would go through the listening, learning and forwarding (or blocking) states.

I tested this on a couple of switches and both ports remained in the forwarding state.

I hope this has been helpful!

Laz

Thx for your reply.

Let me put another topology

Switch A port 1 ----------------- port 1 switch B
Port 2 Port 2
- -
------- Port 1 switch C port 2 ---------

Switch A mac - A(lowest)
Switch B mac - B(second lowest)
Switch C mac - C(third lowest)

All switch inter connecting links are gigabit Ethernet

Switch A is root bridge ,port 1 and 2 is designated and forwarding
Switch B is non root bridge , port 1 is root(F) and port 2 is designated(F)
Switch C is non root bridge , port 1 is root(F) and port 2 is alternate(BLK)

Now if I lower switch B bridge priority and make it as root bridge then what happens to all switch port state?

My understanding is

Switch B is root bridge,port 1 change its role from root to designated and port 2 remains unchanged I.e. designated.Port 1 and 2 remains in forwarding state while changing its port role

Switch A is non root bridge,port 1 change its role from designated to root port and port 2 remains unchanged I.e designated.Port 1 and 2 remains in forwarding state while changing its port role

Switch C is non root bridge, port 1 change its role from root to alternate and state from forwarding to blocking and port 2 change its role from alternate to root and state from blocking to listening–>learning—>forwarding

Thanks

Raghu.K

Hello Raghu

So, the first situation as you describe it is the following:

Then we change the priority of SWB so that it becomes the Root Bridge.

  • You are correct about Switch B, that both ports will remain in the forwarding state, but Port 1 will become Designated rather than Root. This is done immediately because there is no alternative. If you are the Root bridge, there is no need to listen for BPDUs to find out what role it will have.
  • You are correct about Switch A where Port 1 will change from Designated to Root and will remain in the forwarding state.
  • Now Port 2 on Switch A must go into blocking, listening and learning because it does not know whether it or the opposite end will become designated and which will become alternate. They must exchange BPDUs for this to occur.
  • You are correct that on Switch C, Port 2 will go from blocking to listening to learning to forwarding and will become a Root port.
  • Finally, Port 1 on Switch C must also go into blocking, listening and learning because it does not know whether it or the opposite end will become designated and which will become alternate. They must exchange BPDUs for this to be determined.

I hope this has been helpful!

Laz

Thanks for the clarification.

Raghu.K

1 Like

Thanks for your reply.

My question now is

Why would switch A port 2 and switch C port 1 goes from forwarding to blocking state?

Why I have put the above question is switch C port 2 is still in listening state with port role as root and it is going to take 30 seconds for that port to go into forwarding state(as we know no frame is forwarded in any of the port state except in forwarding state)

Switch A port 2 and switch C port 1 can continue to stay in forwarding state and elect its port role and change any one of the port in that LAN segment to alternate without any L2 loop - switch C port 2 still in transition phase before start forwarding any L2 frame.

Thanks

Raghu.K

Hello again Raghu.

Yes, if I understood your explanation correctly, you are correct. I tested it out on a lab topology and this is what I found out:

When Switch B becomes the root bridge, the only ports that go through the process of being blocked–>listening–>learning are port 1 and port 2 of Switch C. All other ports remain forwarding, but they change roles. So specifically:

Switch A port 1 goes from D to R and stays forwarding
Switch A port 2 remains D and stays forwarding
Switch B port 1 goes from R to D and remains forwarding
Switch B port 2 remains D and stays forwarding
Switch C port 1 goes through blocking–>listening–>learning and becomes B
Switch C port 2 goes through blocking–>listening–>learning and becomes R

The reason Switch C ports go through these stages is because:

  1. SWC port 1 has exchanged BPDUs with SWA port 2 and has determined that it should be B However, since it is changing its state from R to B, it must go through the transition of blocking–>listening–>learning
  2. SWC port 2 was originally B, so since it detects that the other end of the link has the root bridge, this port becomes R, but because it was originally B, it must go through the stages of transition blocking–>listening–>learning to become R.

To simplify the above explanation, when there is a change of root bridge and new BPDUs are exchanged, ports that don’t change their role based on the new topology DO NOT go through the blocking–>listening–>learning states. Ports that change their roles WILL go through the blocking–>listening–>learning states to determine those new roles.

I hope this has been helpful!

Laz

Thanks for your quick lab testing and confirmation.

I am still confused why switch C port 1 changes its state from forwarding to blocking and then goes to listening,learning and again blocking?

Instead switch C port 1 should have stayed in forwarding state and exchange bpdu’s with switch A port 2,change its role to alternate and move from forwarding to blocking.

As we know there won’t be any loop via switch C because port 2 still in transition phase and it would take 30 more seconds to bring port 2 in forwarding state.

My guess is switch C port 1 should change its state directly from forwarding to blocking and role to alternate after exchanging bpdu’s with switch A

Thanks

Raghu.K

Hello Raghu.

I understand your confusion. Keep in mind that the term “Blocking” can be used as a port role, that is the same as “Alternate” as well as a state “blocking”. Let me try to clarify:

In my previous post, we noted that of the six ports involved in STP, only Port 1 and Port 2 of SWC had a change of ROLE. The other four did not. Since their ROLEs did not change, they didn’t have to go throug the STP algorithm, that is, transitioning from blocking–> listening --> learning etc.

**Since the ports on SWC CHANGED their roles, they must run the STP algorithm, which means, they must transition between the blocking–> listening --> learning states to determine what their final ROLE and STATE will be.**

So:

Port 2 in SWC received new BPDUs that indicate that its ROLE must change. In order to determine that role, the STP algorithm begins to function and the port transitions between the blocking–> listening --> learning STATES where it waits for the default timers in each case until its ROLE is determined as ROOT in a state of FORWARDING.

Port 1 on SWC also received new BPDUs that indicate that its ROLE must change. Again, in order to determine that role, the STP algorithm begins to funciton and the port transitions between the blocking–> listening --> learning STATES where it waits for the default timers in each case until its ROLE is determined as ALTERNATE in a state of BLOCKING.

In other words, any BPDU that enters a port that indicates that there must be a change of role will initiate the STP algorthim. This causes the transitioning blocking–> listening --> learning to occur before the new ROLE and STATE are determined.

Keep in mind that all this has to do with simple STP, that is, 802.1D.

I hope this has been helpful!

Laz