cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2922
Views
85
Helpful
11
Replies

Root port question on PVST

Jerome Vidal
Cisco Employee
Cisco Employee

Hi Folks,

I have attached a screen capture of a PVST topology, could somebody please explain how f0/2 on SW4 becomes a root port? I'm under the impression that it should be an alternate port because SW4 has a lower MAC address value than SW2. Plus, the root ports have the lowest-cost path  to the root bridge so in this scenario, the root ports are g1/2 on SW3 & g1/1 on SW2.

One more question (a general one), would it be possible for SW1 to be the rootbridge for multiple VLANs? let's say we have VLAN 1, VLAN 2, VLAN 3, if not, what would we do when when have more VLANs than we have switches in the topology?

1 Accepted Solution

Accepted Solutions

Hi,

You can view the spanning-tree cost by using the following command

"show spanning-tree interface fa0/2 cost" or "show spanning-tree interface fa0/2".

Please marked your question as answered if you got all your answer.

Spooster IT Services Team

View solution in original post

11 Replies 11

Hi Jerome,

Following are the procedure by which root port is elected

1) Prefer the lowest Root Path Cost.

2) In case of the same Root Path Cost, prefer the lowest Bridge ID of the designated switch (the neighbor that sends BPDUs).

According to the above condition, Switch 2 has lower Bridge ID than switch 3 so switch 2's BPDU will be preferred over switch 3. 

3) 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.

4) In case of all above are did not resolve the problem, prefer the lowest Port ID of the BPDU sender.

According to the above condition, Switch 2 is sending BPDU from two ports f0/1 and f0/2 from these two f0/1 has the lowest Port ID. i.e F0/2 of switch 4 become root port.

Question 2) Would it be possible for SW1 to be the rootbridge for multiple VLANs?

Yes you can achieve this by setting the lower spanning tree priority per vlan basis by using the global command "spanning-tree vlan <id> priority <increments of 4096>

Please rate if this is helpful. 

Spooster IT Services Team

Hi Spooster, thanks for your feedback! I understand your explanation but it's still puzzling.

As you conveyed, root port is elected with the lowest Path Cost towards the rootbridge, so if we do the math, f0/2 on SW4 has 23 Path Cost towards the rootbridge (SW1) compared to g1/1 on SW2 having a Path cost of 4 only towards the rootbridge (SW1). With this said my impression is g1/1 on SW2 should be the root port, rather than f0/2 on SW4.

Reference

Gigabit port - 4

Fast ethernet - 19 cost

Question 2) Optionally can I do the below commands given that a switch can be a root bridge for every VLAN?

spanning-tree vlan 10 root primary
spanning-tree vlan 20 root primary
spanning-tree vlan 30 root primary

The root port is the port the switch chooses for its overall best path to the rootswitch. Every switch must have (only) one root port and other's may be designated port or blocked/alternative port. So in our scenario, Gi1/1 is the root port (best path to root switch) for switch 2 where as fa0/2 is the root port (best path to root switch) for switch 4.

Question 2) Optionally can I do the below commands given that a switch can be a root bridge for every VLAN?

Spanning-tree vlan # root primary/secondary command doesn't guarantee that the switch will be the primary root or Secondary root switch in the network. The command doesn't self correct the priority value if the decreased priority value is greater than other switch/s in the network. The command is basically there to ease decrementing the priority value. Recommended way is to manually set the priority to lowest value by using the command "spanning-tree vlan <id> priority <increments of 4096>"  .

If this is helpful please give a thumbs up. :-)

Spooster IT Services Team

Hi Spooster,

It is indeed helpful! Appreciate it. I do have follow-up question thought. J

1) Are you advising that every non-root bridge should have a root-port? You explanation is clear when you say "fa0/2 is the root port (best path to root switch) for switch 4" but why not f0/3 instead of fa0/2? I'm seeing that both have the same path cost toward the root switch.

2) You previously conveyed that SW1 can be the rootbridge for multiple VLANs and the recommended way is to set the priority to lowest value rather than "root primary/secondary". Does it mean I can do the following commands for on SW1?

spanning-tree vlan10 priority 0

spanning-tree vlan20 priority 0

spanning-tree vlan30 priority 0

3) I did an internet search on PVST and found that it's a best practice to "configure one switch to be elected the root bridge for half of the VLANs in the network, and a second switch to be elected the root bridge for the other half of the VLANs" Is this something you can elaborate? Thanks a lot for sharing your knowledge, you deserve 5 stars!

Hi Jerome Vidal,

1) Are you advising that every non-root bridge should have a root-port? You explanation is clear when you say "fa0/2 is the root port (best path to root switch) for switch 4" but why not f0/3 instead of fa0/2? I'm seeing that both have the same path cost toward the root switch.

Answer:- Every non-root bridge have only one root-port and other ports are either Designated ports or Alternative/Blocking ports.  

Spanning Tree Root Port selection process in a Non-Root Switch involves the following steps:-

1) Select the port connected to the path with the lowest accumulated Spanning Tree Path Cost to the Root Bridge (Root Switch) as the Root Port, when a Non-Root Switch has multiple paths to reach the Root Switch.

SW4 has the the two ports fa0/3 and fa0/2 and both ports has the same cost. So, root port selection falls to the second point. 

2) If multiple paths are available to reach the Root Bridge (Root Switch) with the same accumulated Spanning Tree Path Cost in a Non-Root Switch, select the port connected to the neighbor switch which has the lowest Switch ID value as the Root Port.

Sw2 and Sw3 are the two switches from where Sw4 receiving the BPDU's. Sw2 has the lowest bridge ID as compare to Sw3 so port connected to Sw2 should be elected as root-port but there are two ports that connects to Sw2 so root port selection falls to the third point.  

3) If all the multiple paths go through the same neighboring switch to reach the Root Bridge (Root Switch), Non-Root Switch will select the local port which receives the lowest port Spanning Tree Port Priority value from neighbor Switch as the Root Port.

Now Sw4 has two ports Fa0/2 and Fa0/3. Fa0/2 has the lower port priority than Fa0/3 hence Fa0/2 is elected as root port.

4) If the received Spanning Tree Port Priority value values are the same between the connecting ports to reach the Root Bridge (Root Switch), Non-Root Switch will select the port which receives the lowest physical port number from neighbor Switch as the Root Port.

2) You previously conveyed that SW1 can be the rootbridge for multiple VLANs and the recommended way is to set the priority to lowest value rather than "root primary/secondary". Does it mean I can do the following commands for on SW1?

spanning-tree vlan10 priority 0
spanning-tree vlan20 priority 0
spanning-tree vlan30 priority 0

Answer :- Yes

3) I did an internet search on PVST and found that it's a best practice to "configure one switch to be elected the root bridge for half of the VLANs in the network, and a second switch to be elected the root bridge for the other half of the VLANs" Is this something you can elaborate?

Answer:- It depends on the layer 2 network design. Let's say your layer 2 design will be the following then the best practice says that the switches at Distribution layer should be the root bridges in distribution manner (as you said above).

  

                     Image result for layer 2 network diagram

Spooster IT Services Team

Hi Spooster,

This is highly informative, massively appreciate it!

1) Could you tell how you determined that Fa0/2 has the lower port priority than Fa0/3? 

2) I see it says "image result for layer 2 network diagram" But I'm not seeing any image, were you supposed to show a diagram, if so, could you reattach it?

Thank you again!

1) Could you tell how you determined that Fa0/2 has the lower port priority than Fa0/3?

Answer:- It depends upon the physical location of ports. You can not modify the port priority. Fa0/0 has the lowest port priority then Fa0/, fa0/2, fa0/3 and so on.... If you want to make fa0/3 as a root then you need to modify path cost of port Fa0/2 of Sw2.

On Sw2,

interface fa0/2
spanning-tree cost <1-200000000> 

2) I see it says "image result for layer 2 network diagram" But I'm not seeing any image, were you supposed to show a diagram, if so, could you reattach it?

Please find attachment.

Thanks for rating. Please marked your question as answered if you got your answer.

Spooster IT Services Team

Hi Spooster,

Last question. Can I possibly view the spanning-tree cost using the "show interface fa0/2" command? Thanks again for being so helpful!

Hi,

You can view the spanning-tree cost by using the following command

"show spanning-tree interface fa0/2 cost" or "show spanning-tree interface fa0/2".

Please marked your question as answered if you got all your answer.

Spooster IT Services Team

Thanks so much Spooster! I have given you 5 stars!

Happy to help you. :-)

Spooster IT Services Team
Review Cisco Networking for a $25 gift card