How To Prevent Cisco Switches Network Loop?

by linknewnet.com Writer : Zheng Hong Trade

What is a Network Loop?

A switching loop or bridge loop occurs in computer networks when there is more than one Layer 2 (OSI model) path between two endpoints (e.g. multiple connections between two network switches or two ports on the same switch connected to each other). The loop creates broadcast storms as broadcasts and multicasts are forwarded by switches out every port, the switch or switches will repeatedly rebroadcast the broadcast messages flooding the network. Since the Layer 2 header does not support a time to live (TTL) value, if a frame is sent into a looped topology, it can loop forever.

How do I stop a network loop?

A physical topology that contains switching or bridge loops is attractive for redundancy reasons, yet a switched network must not have loops. The solution is to allow physical loops, but create a loop-free logical topology using the shortest path bridging (SPB) protocol or the older spanning tree protocols (STP) on the network switches.

Below we do an experiment on how to prevent a Cisco switch network loop.
network loop experiment

Experiment name: Network loop.
Experiment purpose: The purpose of the experiment is to understand the impact of network loops on the switch and to master the methods to prevent network loops.
Technical principle: The network loop forms a broadcast storm, which not only affects the data forwarding of the switch, but also affects the switches that are cascaded with it. Enable the downlink loop detection function of the switch to detect the loop generated under the relevant port. When the loop is generated, the related port can be closed. After the network loop is released, manual intervention is required to reopen the relevant port before use. The downlink loop detection can also detect loops caused by the direct connection of the ports of the switch, thereby preventing the network loop from being generated.
Implementation function: Specify the downlink loop detection of the port.
Experimental equipment: two S2026, two PCs.
Experimental topology:
Experimental steps:

Step 1: The impact of the network loop on the switch

1. Connect the device according to the above topology. The ports F0/11 and F0/12 of the S2026-B are not short-circuited. Both switches are restored to the factory settings without any configuration. Configure the IP addresses of PC1 and PC2 as 192.168.10.2/24 and 192.168.10.3/24 respectively. The two PCs continue to ping each other:
Ping 192.168.10.3 –t
 
Observe the Ping packet and log in to the S2026-B to check the CPU utilization.
 
Switch(config)# show cpu //View CPU utilization
 
2. Short-circuit the F0/11 and F0/12 ports of the switch S2026-B, observe the blinking speed of the indicator on the switch interface, and check the Ping packets of the two PCs. Check the CPU usage on the S2026-B. And compare it with the last value viewed. Understand the impact of network loops on this switch.
 
3. Disconnect F0/11 and F0/12 ports of switch S2026-B to release the network loop.

Step 2: The impact of network loops on cascade switches

1. Keep the connection of PC1 unchanged, connect PC2 to the F0/3 interface of switch S2026-A, and continue to ping packets between the two PCs.
 
2. Log in to the two switches to check the CPU utilization.
 
3. Short-circuit the F0/11 and F0/12 ports on the switch S2026-B, observe the blinking speed of the indicators on the switch, check the Ping packets of the two PCs, and check the CPU usage on the two switches. Compare with the last viewed value. Understand the impact of network loops on cascade switches.
 
4. Disconnect the F0/11 and F0/12 ports of switch S2026-B to release the network loop.

Step 3: The downlink loop detection:

1. Make the following configuration on switch S2026-A:

S2026-a(config)# rldp enable //Open rldp protocol globally
S2026-a(config)# interface fastethernet 0/1
S2026-a(config-if)# rldp port loop-detect shutdown-port //Enable the rldp protocol on the F0/1 interface. Once the port detects a physical loop, shut down the port.

2. Short-circuit the F0/11 and F0/12 ports on the switch S2026-B and observe the change of the indicator on the F0/1 interface of the S2026-A. After the F0/1 interface indicator is off, check the status of the Ping packets between the two PCs. Check the status of the F0/1 interface on S2026-A.
 
S2026-a(config)# show interface fastethernet 0/1 //View port F0/1 status
 
A loop is generated under the port of F0/1. The status of this port changes to Down. Check the status of the Ping packets between the two PCs. If the communication is normal, the downlink loop detection function is enabled. Switch S2026-A disables the downlink interface F0/1 and is no longer affected by the loop of switch S2026-B.
 
3. Disconnect F0/11 and F0/12 ports of switch S2026-B to release the network loop.
 
4. Enter the following command on switch S2026-A to reopen the closed port:
 
S2026-a(config)# interface fastethernet 0/1
S2026-a(config-if)# errdisable recovery //Open the port that is closed due to the downstream loop

Step 4: Prevent the formation of network loops:

1. Connect PC2 to the F0/2 interface of switch S2026-B, and continue to ping packets between the two PCs.
 
2. Make the following configuration on switch S2026-B:
 
S2026-b(config)# rldp enable //Open rldp protocol globally
S2026-b(config)# interface fastethernet 0/11
S2026-b(config-if)# rldp port loop-detect shutdown-port //Enable the rldp protocol on the F0/11 interface. Once the port detects a physical loop, shut down the port.
S2026-b(config)# interface fastethernet 0/12
S2026-b(config-if)# rldp port loop-detect shutdown-port //Enable the rldp protocol on the F0/12 interface. Once the port detects a physical loop, shut down the port.
 
3. Short-circuit the F0/11 and F0/12 ports on the switch S2026-B. Observe the indicator changes on the interfaces of F0/11 and F0/12 on S2026-B. After the F0/11 and F0/12 interface indicators are off, check the status of the Ping packets between the two PCs. Check the status of the two interfaces on Switch S2026-B.

S2026-b(config)# show interface fastethernet 0/11 //View port F0/11 status
S2026-b(config)# show interface fastethernet 0/12 //View port F0/12 status
A loop is generated on the ports of F0/11 and F0/12, and the port status changes to Down. Check the status of the Ping packet between the two PCs. If the communication is normal, the downlink loop detection function takes effect.

4. Disconnect the F0/11 and F0/12 ports of switch S2026-B to release the network loop.

5. Enter the following command on switch S2026-A to reopen the closed port:

S2026-a(config)# interface fastethernet 0/11
S2026-a(config-if)# errdisable recovery //Open the port that is closed due to the downstream loop
S2026-a(config)# interface fastethernet 0/12
S2026-a(config-if)# errdisable recovery //Open the port that is closed due to the downstream loop

Precautions:
The switch shuts down the interface because it detects that there is a network loop on the downstream interface. You cannot use the no shutdown command to open the interface. Instead, use the errdisable recovery command.

Linknewnet.com provide NEW and Refurbished Cisco switches online. Have any need for Cisco network equopment please feel free to contact us.