you need to understand the next
Spanning-Tree Port Roles
- Root Port (RP) - It is a port on a non-root switch, which is the shortest (the best) path towards the root bridge. (i.e. port 0/4 0/3 in SW3)
- Designated Port (DP) - It is a port that is in the forwarding state. (i.e. port 0/1 0/2 SW2)
- Non-Designated Port (NDP) - It is a port that is in a blocking state in the STP topology.
so your question is about which port in SW3 will be selected as Root Port
As soon as the root has been elected, all non-root switches begin to calculate which port is the best (the least cost) towards the root bridge. This port will be called the root port.
What if the Root Cost Path is identical?
- Prefer the lowest Root Path Cost.
- In case of the same Root Path Cost, prefer the lowest Bridge ID of the designated switch (the neighbor that sends BPDUs).
- In case of receiving BPDUs on multiple ports from the same designated switch (BPDU sender), prefer the lowest Port ID (known also as port priority) of the sender. That parameter has a default value 128 and is configurable.
- In case of all above are did not resolve the problem, prefer the lowest Port ID of the BPDU sender.
so answer of your question (SW3's 0/4 is the Root Port because the Sending Port ID of 0/1 wins over 0/2)is YES
please make use of this very usful linke STP
You have basically asked the election process :p
So, here is what happens.
All switches that have STP enabled (which is defaut setting in most switches), send out BPDU's.
What the BPDU mainly contains is this : a. the ID of that switch b. The ID of the root according to that switch (At the beginning of the process every switch thinks it is the root).
As Ron pointed out, This is sent on a link local address which means that it will be sent to all the devices that are directly connected to the switch.
(Yes even end devices like desktops can receive this message but they will discard the packet as STP is not enabled on them)
Now as a switch when you receive the packet from all your neighboring switches, here is what you do, you compare their ID with your ID.
One of the two things can happen - your ID lower than their ID in that case you still think you are the root or you find out that your ID is not the lowest.
So in the next BPDU packet you will replace the root ID with the the ID of that device.
Now this process continues till all the devices unanimously agree as to which device is the root.
At this point the election stops and the root is elected.
I dont fully understand by what you mean by upward / downward packets, but after the root is elected all switches send their BPDU hello
packets before the dead time to the root (in RSTP not very sure about this) and the root sends its hello packet
(STP and RSTP).
if any device fails to reeive the hello packets before the dead interval there is a re election which I am not mentioning in detail here
BPDU's are forwarded on the designated ports
After the election, the non root switches can have one of these links:
a. in designated state - the one which is that is used to connect to the root
b. Forwarding - literal meaning , not connected to the root, but forwards packets
c. blocked - the link that could potentially cause loops and thus is blocked.(cannot send but can receive packets)
Hope it clears your doubts ..
Best Answer
It is a continuous process. It is continuous because the root bridge (or any other bridge) can fail. If root fails, new root needs to be selected, and if anyone else fails, affected part of the tree need to be recomputed again.
In order to prevent cycles in the topology, while the tree converges, there is a separate mechanisms to switch ports from non forwarding to forwarding states, which more or less works like "wait 30 secs, in 30sec the tree will definitely converge so it the port is still in forwarding state it is safe to turn forwarding on".
If you are thinking in a "termination" in a way it is defined in distributed algorithms[*], there is no such termination. Root (and everyone else) thinks it is a root unless it hears of a better root (which may happen if a better root is added to the topology later, or if some other switches' priority is changed).
no, from the point of the protocol there is only one phase, in which each bridge processes received PDU and acts accordingly.
the bridge considers all BPDUs on each LAN (including its own) and decides who is the root bridge, who is designated bridge for each LAN it is attached to, and where is his root port. Then it decides whether messages need to be sent out.
The above happens every time a new BPDU is received. The protocol is executed exactly the same on each PDU. Again, this is necessary because the protocol needs to deal with bridge/switch failures.
Basically yes.
Note 1: there is a minimal intra-BDPU interval, so SW1 cannot send new messages out faster than one per second (please check the standard for this value)
Note 2: Root election is made based on bridge ids. A bridge id is a combination of <prio, MAC address>, where MAC is one of the MAC addresses. Prio is set to some default value (one half of its max value if I am not mistaken) in the standard, and can be set to something else. This allows network operator to configure, which bridge will be selected root (but the protocol will still work if noone touches anything).
Note 3: the root, i.e., the bridge that haven't heard of a better bridge id than its own, continues to create new BPDUs every N seconds (also known as periodic or hello BPDUs). These as kind of keep-alives, telling everyone that root bridge has not failed. These BPDUs are also processed exactly the same as others. In a stable state they will result in every bridge sending copies of root BPDU on all designated ports thus informing every other bridge/switch that the tree has not changed.
[*] see e.g., ch 15.2 in Nancy Lynch's Book