cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
615
Views
15
Helpful
4
Replies

Regarding STP loop

ncnaveen_arasu
Level 1
Level 1

Hi Team,

Whenever there is a looping in switch how other switch and the same switch where loop occured will get a information about looping. What BPDU carries to inform about looping in a network.

PLease clarify

Thanks in advance

Naveen

1 Accepted Solution

Accepted Solutions

Peter Paluch
Cisco Employee
Cisco Employee

Hello Naveen,

With STP, switches do not really detect a loop. Rather, they decide to put a port into Forwarding state only if it is determined that the port is needed in an active topology.

What does it mean that the port is needed? Imagine a switched network that has no physical loops, i.e. there are no switching loops possible either. This network has a tree structure, then. One of the switches can be declared as the root of this tree (any of them - for now, forget even about STP). Notice now that each port on each switch in this network is needed - because it is either an "uplink", connecting the switch onto an upward branch towards the root, or it is a "downlink", connecting another network segment to this switch. Each of these ports is required and needed - if you removed any of them, a part of the network would get disconnected.

What STP does is locating these "uplink" and "downlink" ports and making sure that

  1. each switch (except the root switch) has exactly one "uplink" port - called the Root port
  2. on each segment, there is exactly one "downlink" port - called the Designated port

In fact, STP behaves as a very simple distance vector routing protocol that tries to locate the best path from each switch towards the root switch, and making sure that each switch has exactly one best path towards the root (if there were multiple paths there would be loops). BPDUs contain simple metrics that allow the bridge to decide which port should be the Root or Designated. Any port that is neither Root nor Designated is not needed in the topology, and will be left blocked.

Hence, STP does not detect switching loops. What STP does is make sure that the active topology is loop free and a switching loop cannot occur. The idea is that if STP can provide a loop-free logical switched topology, there is no need to detect loops because they cannot occur, anyway.

BPDUs contain, apart from a few technical fields, these data:

  1. Root Bridge ID
  2. Sender's distance from the Root Bridge (Root Path Cost)
  3. Sender Bridge ID
  4. Sender Port ID

The Root Bridge ID identifies the "destination" towards which STP tries to construct a shortest path from each switch. The primary tiebreaker is the sender's distance from the Root bridge - obviously, each switch selects that neighbor that provides the least cost path (after taking into account the cost of the link to the neighbor). If there are multiple paths left that provide the same cost path, the switch will select the path through the neighbor with the lowest Bridge ID, and if there are multiple links towards the same neighbor, then the link that is connected to the neighbor's port with the lowest Port ID. As you can see here, STP tries ardently to make sure that there is always a way to choose exactly one path towards the root even if there are multiple physical paths possible.

Once again, STP and BPDUs do not detect loops. They construct a loop-free topology in which it is not necessary to detect loops anymore.

Feel welcome to ask further!

Best regards,

Peter

View solution in original post

4 Replies 4

Peter Paluch
Cisco Employee
Cisco Employee

Hello Naveen,

With STP, switches do not really detect a loop. Rather, they decide to put a port into Forwarding state only if it is determined that the port is needed in an active topology.

What does it mean that the port is needed? Imagine a switched network that has no physical loops, i.e. there are no switching loops possible either. This network has a tree structure, then. One of the switches can be declared as the root of this tree (any of them - for now, forget even about STP). Notice now that each port on each switch in this network is needed - because it is either an "uplink", connecting the switch onto an upward branch towards the root, or it is a "downlink", connecting another network segment to this switch. Each of these ports is required and needed - if you removed any of them, a part of the network would get disconnected.

What STP does is locating these "uplink" and "downlink" ports and making sure that

  1. each switch (except the root switch) has exactly one "uplink" port - called the Root port
  2. on each segment, there is exactly one "downlink" port - called the Designated port

In fact, STP behaves as a very simple distance vector routing protocol that tries to locate the best path from each switch towards the root switch, and making sure that each switch has exactly one best path towards the root (if there were multiple paths there would be loops). BPDUs contain simple metrics that allow the bridge to decide which port should be the Root or Designated. Any port that is neither Root nor Designated is not needed in the topology, and will be left blocked.

Hence, STP does not detect switching loops. What STP does is make sure that the active topology is loop free and a switching loop cannot occur. The idea is that if STP can provide a loop-free logical switched topology, there is no need to detect loops because they cannot occur, anyway.

BPDUs contain, apart from a few technical fields, these data:

  1. Root Bridge ID
  2. Sender's distance from the Root Bridge (Root Path Cost)
  3. Sender Bridge ID
  4. Sender Port ID

The Root Bridge ID identifies the "destination" towards which STP tries to construct a shortest path from each switch. The primary tiebreaker is the sender's distance from the Root bridge - obviously, each switch selects that neighbor that provides the least cost path (after taking into account the cost of the link to the neighbor). If there are multiple paths left that provide the same cost path, the switch will select the path through the neighbor with the lowest Bridge ID, and if there are multiple links towards the same neighbor, then the link that is connected to the neighbor's port with the lowest Port ID. As you can see here, STP tries ardently to make sure that there is always a way to choose exactly one path towards the root even if there are multiple physical paths possible.

Once again, STP and BPDUs do not detect loops. They construct a loop-free topology in which it is not necessary to detect loops anymore.

Feel welcome to ask further!

Best regards,

Peter

Hello Peter,

What an amazing answer,

You rock man

Julio Carvajal

Julio Carvajal
Senior Network Security and Core Specialist
CCIE #42930, 2xCCNP, JNCIP-SEC

HI Peter thanks for the wonderful explaination. But my doubt is whenever BPDU filter or incase of UDLD failed to receive bpdu, STP topology will be not aware of the loop right. So if any uplink has been connected along with existing uplink and which is not a part of STP topology loop might occur. So in this case how the switches come to know there is a loop in the network.

Thanks & Regards,

Naveen

Hello Naveen,

I apologize for answering so late - I've been somewhat busy in the last days.

But my doubt is whenever BPDU filter or incase of UDLD failed to receive  bpdu, STP topology will be not aware of the loop right. So if any  uplink has been connected along with existing uplink and which is not a  part of STP topology loop might occur. So in this case how the switches  come to know there is a loop in the network.

I assume you are asking how are switches supposed to detect a switching loop if an uni-directional link condition occured, or if BPDU Filter is inappropriately used.

The answer is that the switches do not detect this loop in general. That is one of the weaknesses in STP in that it is very vulnerable when its BPDUs are filtered or lost. That is why there are additional mechanisms to STP that try to detect if there is something wrong with the BPDU delivery. These mechanisms also do not detect a loop. What they do is that they react to a sudden loss of BPDU or UDLD messages from the other side. These mechanisms are:

  • Uni Directional Link Detection (UDLD)
  • BPDU Loop Guard
  • RSTP Dispute Mechanism
  • Bridge Assurance

Once again, though, these mechanisms do not detect a loop but rather a condition that would cause a loop if STP was left to run without change.

Best regards,

Peter

Review Cisco Networking for a $25 gift card