cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
729
Views
5
Helpful
7
Replies

STP switching logic

the Q
Level 1
Level 1

Pc-1 is connected to Sw-A

Pc-2 is connected to Sw-B

Sw-A and Sw-B are connected to Sw-C

Sw-C is connected to Sw-RB (which is the STP Root Bridge).

-

Pc-1  -- Sw-A

.                     >- Sw-C -- Sw-RB

Pc-2  -- Sw-B

-

If Pc-1 pings Pc-2, will the frame go through Sw-RB? 

1 Accepted Solution

Accepted Solutions

michelpe
Cisco Employee
Cisco Employee

Traffic forwarding through switches is done based on mac-address tables.

The mac-addresses are learned as soon as PC-1 or PC-2 would

send out a packet, if they arent learned yet , traffic will be flooded

Assuming both PC-1 and PC-2 send out something already the mac-address

table would look like the following. Under the Mac A and B colomns

the egress port connecting to... is mentioned

               Mac A    Mac B

Sw A       PC-1      Sw C

Sw B       Sw C     PC-2

Sw C      Sw A     Sw B

Sw RB    Sw C    Sw C

A packet destined to Mac B comes in on Sw A. And as per the table will be switched to the port

connecting to Sw C. On Sw C the packet will be switches to the port connected to Sw B

On Sw B it will be send out to the port connecting to Host 2

An ethernet switch will also not switch packets back to the port it came in on. So if a packet

would come in on the Sw RB it would not forward it back out the same interface as both Mac

A and Mac B would be learned on that port

The Spanning Tree protocol will assuere a loop free topology in your network.

So if you would connect an additional link between Sw A and B then spanning tree

would Block traffic between those 2 switches preventing a loop.

View solution in original post

7 Replies 7

Reza Sharifi
Hall of Fame
Hall of Fame

If pc-1 and pc-2 are in the same vlan and that vlan exist on sw-C then the answer is no.

yes, all the same vlan.

Hmmm.  So what is the logic then?  I thought all traffic went through the RootBridge.... Isn't that true? 

Disclaimer

The   Author of this posting offers the information contained within this   posting without consideration and with the reader's understanding that   there's no implied or expressed suitability or fitness for any purpose.   Information provided is for informational purposes only and should not   be construed as rendering professional advice of any kind. Usage of  this  posting's information is solely at reader's own risk.

Liability Disclaimer

In   no event shall Author be liable for any damages whatsoever (including,   without limitation, damages for loss of use, data or profit) arising  out  of the use or inability to use the posting's information even if  Author  has been advised of the possibility of such damage.

Posting

Hmmm.  So what is the logic then?  I thought all traffic went through the RootBridge.... Isn't that true?  

The logic is, STP creates a L2 loop free topology.  Your described topology (a star) doesn't have any loops, so which switch is the root bridge doesn't really matter.

If you added a link between switches A and B, then which switch was the root bridge would matter because you would have a loop between switches A, B and C.  I believe if you still had switch RB as the root, the link between A and B would block, forcing traffic, between switches A and B, to take the extra hop via switch C.  Even then, though, the traffic would not need to transit switch RB.

A few years ago I remember a CCNA instructor saying everything goes through the Root Bridge.  And that stuck with me, but I started wondering if there were exceptions. 

Sending everything through the RootBridge is kind of dumb routing, but easy to do.  But if STP doesn't send everything through the Root Bridge, how does it decide not to?

I understand the goal is a loop-free topology, but there have to be rules.  And actually, in most networks it often doesn't really make sense to send frames through the RB all the time, but that's the way they get routed, and that's the way STP works (or so I thought). 

Disclaimer

The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.

Liability Disclaimer

In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.

Posting

The root bridge is the root switch for the determining a loop free topology.  It's the center of which redundant links will be blocked or not.  Once there's a loop free topology, switches forward packets "normally", not caring where the root bridge is.  Again, in your original posting, there are no loops, so packets between switches A and B would transit switch C regardless of whether any STP was active, and if active, the root could be any switch; results would be the same.

Also again, if you interconnect switches A and B, and now a STP is needed.  The optimal path between those switches would be the direct link between those two switches, but depending on where the root bridge is located, its placement will help determine which link is blocked to break the loop A<>B, A<>C or C<>B. The shortest non-blocked path will be the path used for transit.  The root bridge may not be on that path, and if not, transit traffic won't cross it.

michelpe
Cisco Employee
Cisco Employee

Traffic forwarding through switches is done based on mac-address tables.

The mac-addresses are learned as soon as PC-1 or PC-2 would

send out a packet, if they arent learned yet , traffic will be flooded

Assuming both PC-1 and PC-2 send out something already the mac-address

table would look like the following. Under the Mac A and B colomns

the egress port connecting to... is mentioned

               Mac A    Mac B

Sw A       PC-1      Sw C

Sw B       Sw C     PC-2

Sw C      Sw A     Sw B

Sw RB    Sw C    Sw C

A packet destined to Mac B comes in on Sw A. And as per the table will be switched to the port

connecting to Sw C. On Sw C the packet will be switches to the port connected to Sw B

On Sw B it will be send out to the port connecting to Host 2

An ethernet switch will also not switch packets back to the port it came in on. So if a packet

would come in on the Sw RB it would not forward it back out the same interface as both Mac

A and Mac B would be learned on that port

The Spanning Tree protocol will assuere a loop free topology in your network.

So if you would connect an additional link between Sw A and B then spanning tree

would Block traffic between those 2 switches preventing a loop.

So, I greatly appreciate you explaining this.  I'm trying to get a firm grasp of it and playing with in my home lab.  I have more questions, but I want to see if I can figure them out.  If I can't, I'll come back.  Thanks again. 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: