3

I've got a terrible doubt that does not let me sleep for last few days. I have a network with different bandwidth interfaces (Gi0/2 and F0/2). The interfaces to which I'm referring are the ones inside the blue "circle".

I know that the cost for Gi0/2 is 4, and the cost for Fa0/2 is 19.

The thing is that I need to get the cost of that segment, but I'm really confused because I don't really know whether i make the sum of the 2 values. I mean 4 + 19 = 23 as the cost of the link, or I assume that the cost is the biggest value of both interfaces. For example, in this case would be Fa0/2 be a cost of 19, or if a take the cost of each one as separate value. For example, if I'm referring to Switch 2, do I take the cost of 4 because of Gi0/2 by default?

I can´t sleep because im trying to get certified, but I don't know how this concept works for STP

If someone can help me i will appreciate it a lot.

enter image description here

1
  • It's worth adding that many (most) modern switch platforms can use long path cost values - so rather than cramming everything into a 16-bit value (which is where you get 19 for a FE vs 4 for GE) it is, instead, 32-bits and the numbering changes accordingly. A gigabit link, for example, would be 20,000 and an FE 200,000.
    – rnxrx
    Feb 12, 2017 at 5:53

5 Answers 5

3

An ethernet connection such as you describe will only connect at 100 Mbps (FastEthernet). You are incorrect that the cost of G0/2 is 4 because it connects at 100 Mbps, then the cost is 19.

For STP, a switch looks at the cost on its interface for the link because the cost of a link is the same on both ends, there is only one cost for the link. You only add costs for multiple links to the root.

2
  • I understand the point that when you have a Fastethernet port is 100 mbps that is a cost of 19 and Gigabit ethernet is a 1,000 mbps that is a cost of 4. The question is. Why do i take the 100 mbps (cost of 19) as speed instead of the 1,000 mbps (cost of 4)? Feb 12, 2017 at 1:23
  • The cost of the interfaces on either side of the link must match because the link can only have one speed. You take the cost of the speed of the interface, which is going to be 100 Mbps. A FastEthernet interface cannot run at 1 Gbps, but a GigabitEthernet interface can run at 100 Mbps, and it will negotiate that speed on this link, unless you lock it into 1 Gbps, at which point, the link will not come up. The speed of the G0/2 interface must be 100 Mbps for the interface to work, so the STP interface cost will be 19.
    – Ron Maupin
    Feb 12, 2017 at 3:46
3

The cost is decided on the bandwidth of the link (cable). Now it is highly unlikely that the same cable will have different speeds at different ends. The speed of the wire is always the same. the speed is modulated through switch NIC interfaces. But as we are talking about STP here, I dont think there is any need for the switch to change/set speeds.

Long story short you can have only one speed per link and thus one cost per link. If the link is 100 mbps, the cost will be 19, regardless which switch you measure from .

2
  • I understand the point that when you have a Fastethernet port is 100 mbps that is a cost of 19 and Gigabit ethernet is a 1,000 mbps that is a cost of 4. The question is. Why do i take the 100 mbps (cost of 19) as speed instead of the 1,000 mbps (cost of 4)?. Feb 12, 2017 at 1:23
  • No, you need not necessarily take 19. But the link you are talking about can either be of 100 mbps or 1000 mbps and never both. Check the link and use that cost for your calculation.
    – john
    Feb 12, 2017 at 23:44
3

SW3 receives the same computed value from SW2 via the two links. When performing its own calculation it will add the locally determined value for its respective links. It doesn't need to know what any of SW2's link bandwidths may be - including the links it has to SW3.

0

STP has no concept of "cost of segment". STP convergence is 3 steps process:

  • Choosing root switch with better BID(lowest is better). Root switch will sends hello bpdu out of all his ports. In your scenario, SW2 will be root switch because he has BID of 8192 and he will sends hello bpdu out of Gi0/2 and Gi0/3 interfaceses with zero cost(because he is root).
  • Each non-root switch chooses one root port(port that has lowest cost to the root). In your scenario you have only 1 non-root switch, SW3. SW3's root port is Gi0/3 because he has cost of 4(he receives bpdu hello from root with 0 cost and then adds his Gi0/3 cost of 4, so summary cost is 0+4=4).
  • On each segment STP needs to choose one designated port(port that advertises lowest-cost hello onto a segment). In your scenario on serment SW2(Gi0/2) <--> SW3(Fa0/2), SW2's Gi0/2 it's designated port, because all root's ports are designated. So SW3's Fa0/2 will be in blocked state, because he is not root port or designated port. By the way, untill blocked, SW3's Fa0/2 will sends bpdu with cost of 23 on that segment(because default FastEthernet cost for stp is 19 plus 4 of SW3's Gi0/3 = 23).

Although this is not essential in this scenario, don't forget about autonegotiation rule that tells that SW2's Gi0/2 will works as FastEthernet port at 100Mbit/s.

2
  • I understand the point that when you have a Fastethernet port is 100 mbps that is a cost of 19 and Gigabit ethernet is a 1,000 mbps that is a cost of 4. The question is. Why do i take the 100 mbps (cost of 19) as speed instead of the 1,000 mbps (cost of 4)? Feb 12, 2017 at 1:24
  • Because of autonegotiation rule. SW2's Gi0/2 can works at 10/100/1000 mbit/s. In your scenario SW2's Gi0/2 will works at 100mbit/s, so cost will be 19. Feb 12, 2017 at 7:09
0

If you link GigabitEthernet & FastEthernet, speed will be auto-negotiated to the lowest speed i.e. 100Mbs hence the cost cost will be 19

1
  • what is your question?
    – infra
    Jul 5, 2019 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.