Press ESC to close · Ctrl+K to open

Networks: GNS3, Broadcast Storm and STP Protocol

Networks: GNS3, Broadcast Storm and STP Protocol

Introduction

In today\'s article, we will learn about the GNS3 network simulation software. It is very useful for emulating scenarios that we may encounter in the industry, as well as for understanding how some architectures work, anticipating and solving problems that may arise.

First, we will talk about the software, then we will build a basic architecture and see how it works. Subsequently, we will force a network loop or broadcast storm and finally, we will use the STP protocol to correct the error through the managed switch.

What is GNS3?

GNS3 is a free network simulation tool that allows you to create and test network topologies virtually, using real or emulated devices. It is ideal for learning, testing, and developing network environments without the need for physical hardware.

Features:

  • Intuitive graphical interface: Allows you to create and manage network topologies using drag and drop
  • Compatibility with real images: Supports Cisco IOS as well as devices from other manufacturers, allowing for accurate simulation of real networks.
  • Integration with physical hardware: You can connect physical devices to the simulation, facilitating testing in hybrid environments.
  • Scalability: Capable of handling everything from small networks to complex topologies with multiple devices.
  • Integrated traffic capture: Tools like Wireshark are directly integrated to analyze traffic in real time.
  • Free and open source: GNS3 is accessible to anyone, making it an ideal option for both students and professionals.

Other programs: In addition to GNS3, there are other similar programs, such as Cisco Packet Tracer, a network simulation tool developed by Cisco that allows you to design, configure, and test networks virtually.

Basic Architecture

In the following example, we have configured two PCs with two managed switches and one unmanaged switch. In this case, I have used the free version of managed switches "Open vSwitch". Real switch images can also be used.

Note: we do not delve into the configuration of GNS3 and the virtual machines, but it is important to highlight that it exists and needs to be done. The idea is that the devices must run on virtual machines or dockers. It is not complicated.

For the configuration of the elements, it can be done through configuration or via console commands. In this case, the command console has been used. To do this, we must start the simulation with the "PLAY" button, as we are going to simulate that they are turned on and we can access them via the console.

  • Assign IPs to the PCs. Command: "ip 192.168.1.11" and "ip 192.168.1.12"

For the example, we have connected the PCs as seen in the image, and we have not generated any special configuration on the switches, so the PCs should see each other, acting as unmanaged switches.

To test the communication between them, we perform a reciprocal infinite ping.

Code
PC1: ping 192.168.1.12 -t
Code
PC2: ping 192.168.1.11 -t

As seen in the following image, there is communication between both.

Broadcast Storm

Having our architecture functioning in simulation and both PCs seeing each other correctly, we now move on to simulate a network loop or broadcast storm.

This phenomenon occurs when packets sent by a device are duplicated in a network due to the network configuration, having more than one path for the packets. This causes collisions between packets and network saturation.

The following link visually shows the problem:

Link to animation

As a curiosity, a ring network would generate a network loop if it weren\'t for the fact that managed switches only enable one of the paths of the ring.

Generating the Loop in the Example:

We include an unmanaged switch in the network, and connect it to the two managed switches, thus creating a loop in the network.

Wireshark: until the introduction of the last unmanaged switch, the frames were normal and matched the times with the reciprocal pings of the PCs. However, as seen in the image, from the generation of the loop, the frames grow exponentially, filling the entire history.

Furthermore, it is observed in the consoles of the PCs that the packets are no longer sent correctly, generating timeout problems, as expected.

In this situation, we already have a loop in a network and we have managed to saturate it. Next, we will see how to detect and eliminate it.

In reality, it is not difficult to generate this type of problems by mistakenly connecting different ports of a switch in an electrical installation.

STP Protocol

To eliminate the problem generated in the previous section of Broadcast Storm or network loop, there is the Spanning Tree Protocol.

STP is a protocol that prevents loops in networks with multiple connections between switches, blocking redundant paths and activating them only if necessary. It keeps the network stable and functional.

STP works by selecting a root switch (Root Bridge) and calculating the best paths to avoid loops. It blocks redundant ports, ensuring that there is only one active path between devices. If a link fails, it enables one of the blocked paths.

Other protocols:

  • STP (Spanning Tree Protocol) – Prevents loops in networks with switches.
  • RSTP (Rapid Spanning Tree Protocol) – Improved version of STP with faster convergence.
  • MSTP (Multiple Spanning Tree Protocol) – Allows multiple instances of STP in a single network.

Example: Activating STP in Open vSwitch

Command to activate in the Open vSwitch

Code
ovs-vsctl set bridge br0 stp_enable=true

By activating the STP option on the managed switch, on one of the managed switches, we achieve that it "closes" one of the paths that causes the loop. This way, everything starts working correctly again, as if the cable had been cut.

In the previous image, it can be seen that everything returns to normal in the consoles and in Wireshark the packet frequency returns to normal.

Conclusions

GNS3 is a very powerful program for anticipating real-world problems through the simulation of communication elements.

The broadcast storm is a common problem that can occur in real environments, leading to network saturation with the consequences this can have at functional levels.

STP is a protocol of modern managed switches that prevents broadcast storms by eliminating the redundant paths through which packets travel.

Thank you Jose Manuel!

Pedro Pagán Pallarés

Professional in industrial automation.