07-03-2007 12:12 AM - edited 03-05-2019 05:05 PM
When I study the CCNP course about spanning-tree, I have a question confusing me.After the root bridge was elected,root port in every other switches should be elected.I don't know whether all ports on one switch have the same path cost to root switch.If not, how to calculate it.
For example,Fastethernet0/0 in Switch A and Fastethernet0/0 in Switch B are in same segment.Fastethernet0/1 in Switch A and Fastethernet0/0 in Switch C are in same segment.Fastethernet 0/1 in Switch B and Fastethernet 0/1 in Switch C are in same segment.
switchA
(0/0)| |(0/1)
(0/0| |(0/0)
switchB(0/1)--(0/1)switchC
Assumed three segment are all 100M links. switchA was elected as root bridge.I know path cost of fa0/0 in SwitchB and SwitchC are 19.But I don't know whether fa0/1 in SwitchB and SwitchC have the same path cost 19,or 38.How to calculate?
Solved! Go to Solution.
07-05-2007 09:47 AM
Port 0/2 and 0/3 are initially considered for root election. Actually, if bridge C has a better priority (i.e. inferior numerically) than B, it is possible that one of those port temporarily became root port. But as soon as B hears from A on 0/0 or 0/1, B will realize that it has a better path to the root than C and will put its port 0/2-3 in a designated role. Information is only flowing in one direction with STP. You advertise from the root toward the leaves of the tree. Only the designated port of a given segment is sending BPDUs. So basically, port 0/0 and 0/1 on C will only receive BPDUs in the final state.
Port 0/2 on B is designated because it sends the best information on the segment to which it is connected. Again, on a given segment, only the port that has the best information sends BPDUs. The other ports can only have an alternate, root or backup role and stay silent. When I say better information, I'm of course talking about this message priority vector, that includes root id, root path cost, sender id and port id. That's what gets compared.
Regards,
Francois
07-03-2007 01:08 AM
Hi
Okay, switch B fa0/0 is connected to the same segment as the root bridge so fa0/0 on switch B will be the root port.
Switch C fa0/0 is connected to the same segment as switch A so that fa0/0 on switch C will be the root port.
Switch C fa0/1 path to root is
fa0/1 -> Switch B fa0/1 -> Switch A fa0/0
So yes the cost of the path to root will be 38.
Switch B fa0/1 path to root is
fa0/1 -> Switch C fa0/1 -> Switch A fa0/0
so again yes the STP cost would be 38.
HTH
Jon
07-03-2007 01:58 AM
Hi,Jon
Thank you for your reply
Could you help me analyze following instance
There are two links between SwitchA and SwitchB,also between SwitchB and SwitchC.
A(0/0)---(0/0)B(0/2)---(0/0)C
A(0/1)---(0/1)B(0/3)---(0/1)C
Assumed that all segments are 100M links.SwitchA is elected as root bridge.I know that fa0/0 and fa0/1 in SwitchB have the same path cost 19.But I do not know how to calculate path cost of fa0/2 and fa0/3 in SwitchB?
07-03-2007 02:06 AM
Hi
It will be same 19 as u r both the ports are present in the same switch.here u need to calculate the path from switch C as it will be 38,becoz from switch C to switch B =19 and from switch B to switch A=19 so the sum of these two = 38.
Thanks
Mahmood
07-03-2007 03:48 AM
Hi,Mahmood
In your opinion,cost of both fa0/2 and fa0/3 in SwitchB are 19,right?
I want to know whether ports in same switch absolutely have the same cost
In my first instance, according to Jon's answer cost of fa0/1 in both SwitchB and SwitchC are 38,but fa0/0 in both SwitchB and SwitchC are 19.
Thanks
Martin
07-03-2007 11:13 AM
This question is difficult to answer because it is not clear exactly what is meant by "cost of port X" on a given bridge.
Let me use your latest topology to introduce STP in a nutshell:
A BDPU contains the following parameters, considered in sequence when it's a matter of comparing them:
-1- Root ID,
-2- Root path cost,
-3- Sender Bridge ID,
-4- Sender Port ID.
That's why the terminology of the IEEE specs calls the content of this message a message priority vector. The cost is just part of the information.
A bridge perform a root election taking into consideration their local priority and the best information (BPDU) they receive on any of their port. Here bridge A has the best Root ID in the network (meaning the lowest bridge ID). It means that it will beat any BPDU it receives and stays the root bridge.
Bridge A, the root, sends BPDUs with a Root path cost of 0. B will receive two different BPDUs from A, on two different ports. It will have to elect a single of those ports as its root port. To do so, B uses a "Root path priority vector" computed from the ?message priority vector? received on 0/0 and 0/1. I'm not going to insist too much on the IEEE terminology, because it's probably ignored by the CCNA exam you are preparing;-). You can just assume that, for the purpose of the election of the root port, the (locally configured) cost of the port receiving the BPDU is added to the root path cost received in the BPDU. So here, both port 0/0 and 0/1 have a root path cost of 0+19=19. The determination of the root port will thus be made using additional parameters in the received BPDUs. The two BPDUs have the same root ID, root path cost and sender bridge ID (they both come from A), so the sender port ID will make the difference. Here, 0/0 is likely to become the root port of B (because with default configuration on A port 0/0 will have a lower port ID than 0/1 on most Cisco bridges).
Bridge B has determined its cost to the root from the best BPDU it received. So its root path cost is 19, and B will include this value in the BPDUs it sends out to C on 0/2 and 0/3. Let's run the algorithm another time before I confuse you;-) Bridge C receives two BPDUs with the same cost 19 on 0/0 and 0/1. As they are coming from the same bridge, bridge C will use the sender port ID to elect (probably) 0/0 as its root port. The root path cost for bridge C is 38, this is the value that will be included in the BPDUs sent by C.
Now, suppose that I am configuring a cost of say 1000 on 0/1 on bridge C. The root port election will still designate 0/0 as a root port (because port 0/0 leads to a root path cost of 19, while port 0/1 leads to a root path cost of 1000+19=1019). But you can already feel how ambiguous the term "cost" is. When you talk about the port cost of 0/1, do you mean:
-a- The configured cost (1000),
-b- The cost received in the BPDU (19),
-c- The root path cost used for the root port election (1019),
-d- The root path cost of the bridge, i.e. the cost that the bridge would advertise on this port if it was designated (38)?
Also, 0/1 is a port that is actually receiving BPDUs and that is considered for the root port election. If the port is designated, it only sending BPDUS, and you cannot compute -b- or -c-.
I hope that it becomes clear why it's not obvious to answer: what is the cost of this port on this bridge;-)
07-03-2007 11:14 AM
Cisco's CLI is showing:
- the configured cost -a- for each port
- the root path cost for the bridge -d- along with the root port information, if the bridge is not root
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 4097
Address 0018.18d6.d580
Cost 19 <-------------------bridge root path cost
Port 6 (FastEthernet1/0/4)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0018.18d6.8700
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 15
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa1/0/4 Root FWD 19 128.6 P2p
Fa1/0/8 Desg FWD 19 128.10 P2p
^ cost of the port (configured or derived from bandwidth).
Hope this helped,
Francois
07-03-2007 07:14 PM
Hi,Ftallet
Thank you very much for your reply
But I also am confused that why port 0/2 and 0/3 would not be considered as candidates of root port of B.Is it because that B receive BPDU from root bridge only on port 0/0 and 0/1?
I also have another question.Port 0/2 and 0/3 in B are elected as designated port of two segments between B and C.Is it because that B has lower root path cost(19) than C(38) or because port 0/2 in B has lower root path cost (19) than port 0/0 in C(38)?
07-05-2007 09:47 AM
Port 0/2 and 0/3 are initially considered for root election. Actually, if bridge C has a better priority (i.e. inferior numerically) than B, it is possible that one of those port temporarily became root port. But as soon as B hears from A on 0/0 or 0/1, B will realize that it has a better path to the root than C and will put its port 0/2-3 in a designated role. Information is only flowing in one direction with STP. You advertise from the root toward the leaves of the tree. Only the designated port of a given segment is sending BPDUs. So basically, port 0/0 and 0/1 on C will only receive BPDUs in the final state.
Port 0/2 on B is designated because it sends the best information on the segment to which it is connected. Again, on a given segment, only the port that has the best information sends BPDUs. The other ports can only have an alternate, root or backup role and stay silent. When I say better information, I'm of course talking about this message priority vector, that includes root id, root path cost, sender id and port id. That's what gets compared.
Regards,
Francois
07-05-2007 05:54 PM
Hi,Francois
Your reply is extremely helpful for me
I mainly focus on how to calculate path cost in STP process and ignore the priority vector(BPDU) before I post this conversation.
Thank you very much
Martin
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide