cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
492
Views
10
Helpful
7
Replies

Loop

kzhen
Level 1
Level 1

Sounds silly question, But want to explanin to my management. Can everyone explain to me in detail how the loop is created in switch? What causes the loop? Appriciated.

7 Replies 7

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello Ken,

Lan switches try to avoid bridging loops using STP to manage link redundancy all the time.

Bridging loops can occur from time to time in campus networks.

A bridging loop forms when there are two paths betweeen two switches in a given Vlan (topology) that are both active at the same time.

the effect can be dramatic: broadcast frames are actually "multiplied" at each trip in the loop.

Quickly the campus network can become unusable and someone needs to break the loop by unplugging a cable or using shut if the switch is still manageable.

Shortly:

STP is really needed and modern trends try to use routed access layer to to limit STP range.

Hope to help

Giuseppe

Jon Marshall
Hall of Fame
Hall of Fame

Ken

Just to give another perspective -

switch 1 = SW1

switch 2 = SW2

SW1 is connected to SW2 with 2 different connections. So

SW1 gi0/1 -> gi0/1 SW2

SW1 gi0/2 -> gi0/2 SW2

So there is in effect a loop between the switches ie. a packet sent from SW1 on gi0/1 to gi0/1 on SW2 could actually be then sent from SW2 on gi0/2 back to SW1 on gi0/2.

As Giuseppe noted Cisco usually run an STP instance per vlan (MST being an exception). So lets say that each port gi0/1, gi0/2 on SW1 and gi0/1, gi0/2 on SW2 are in the same vlan. A broadcast packet is sent from SW1 on gi0/1 to SW2 on gi0/2. A L2 switch will forward a broadcast out of all ports (within that vlan) except the port it was received on. So SW2 sends the broadcast out of gi0/2 to SW1 on gi0/2. And SW1 then resends out gi0/1 etc...

It doesn't have to be a broadcast packet it can be a unicast packet as well with each switch learning the mac-address on the different interfaces.

That is a loop. STP should block one of these links so that there is no loop between the switches.

Jon

Hello Jon,

Thank you for the detail. I am still confused. why the SW2 sends the broadcast out of gi0/2 to SW1 on gi0/2? and why the SW1 resends out gi0/1 again? Also, can you explain the loop from MAC perspective?

Thanks,

Ken

Ken

A switch will forward a broadcast out of all it's ports except the one it receives it on.

So SW1 forwards a broadcast packet to SW2 out of gi0/1. SW2 receives this packet on it's gi0/1. Now bearing in mind the rule about how a switch handles broadcasts SW2 will not send the packet back out of gi0/1 because it received the packet on this port. But it will send it out of gi0/2.

SW1 now receives the same packet on it's gi0/2 interface. Again SW1 won't send it back out of gi0/2 because it received it on this port but it will send it out of gi0/1 etc...

Jon

Ken

Jon provides a good explanation based on the behavior of broadcast packets. Since you asked about an explanation from MAC perspective let me give one: assume that SW1 has received a frame with destination MAC address of 00-22-19-03-7B-F7 and looks in the switch forwarding table. If the switch does not find a match in the forwarding table then the switch forwards the frame to all ports in the VLAN. So SW1 will forward the frame over Gi0/1 to SW2. SW2 looks in its switch forwarding table for MAC 00-22-19-03-7B-F7 and does not find it. So SW2 forwards the frame. SW2 received the frame on Gi0/1 and will not send it over that port but will forward it over Gi0/2. So SW1 receives a frame on Gi0/2 with destination MAC of 00-22-19-03-7B-F7 and looks in its switch forwarding table. When it does not find a match it forwards the frame out Gi0/1... and the loop goes on and on.

HTH

Rick

HTH

Rick

Hello Rick,

"SW2 received the frame on Gi0/1 and will not send it over that port but will forward it over Gi0/2." Can you explain to me why the port Gi0/1 is not forward the packet instead of the port Gi0/2?

Thanks,

Ken

Ken

It is one of the basic properties of the Catalyst switch that the switch will not forward a frame back out the same interface on which it received the frame.

So if a switch receives a frame on Gi0/1 it can forward that frame on any other port but not on Gi0/1.

HTH

Rick

HTH

Rick
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: