Lab #15

Open vSwitch: Spanning Tree Protocol (STP)

The purpose of this lab is to show how STP (Spanning Tree Protocol) works in a simple network scenario.

Introduction

The Spanning Tree Protocol (STP) is a network protocol that builds a loop-free logical topology for Ethernet networks.
The basic function of STP is to prevent bridge loops and the resulting broadcast storm effect by selectively disabling links while keeping full connectivity among nodes.
STP allows a network design to include backup links providing fault tolerance if an active link fails.
In this lab we will create a simple network made of three swithes onnected in a triangle topology.
STP disables one of the ports of the three switches to block infinite recirculation of packets and prevent broadcast storms.

Preparation steps

This lab requires the GNS3 VM to instantiate Docker containers of Linux-based routers.
In particular, it requires that you have already executed once the preparation steps described for Lab #13.

Experiment steps

  1. Recreate the following topology in GNS3. Choose the "GNS3 VM" server to instantiate all the devices of this lab.
    Ignore the fact that one link appears as a dashed red line (this was achieved by editing the style of the line representing the link).

  2. lab-topology
  3. Start the OVS-1 switch and right-click on its icon to open an Auxiliary Console terminal.
  4. At the root command prompt, use vi /etc/openvswitch/start.sh to create the following script.
  5. #!/bin/sh
    ovs-vsctl set Bridge br0 stp_enable=true
    sysctl -w net.ipv6.conf.all.disable_ipv6=1
    sysctl -w net.ipv6.conf.default.disable_ipv6=1
    
  6. Then make the script executable with chmod 755 /etc/openvswitch/start.sh
  7. Execute the script with /etc/openvswitch/start.sh. This will enable STP and disable IPv6 in the switch.
  8. Do the same for switches OVS-2 and OVS-3.
  9. Execute the command ovs-appctl stp/show in all of the three switches to check STP status.
  10. Start PC1 and execute the following commands in its terminal:
  11. ip 192.168.10.2/24
    save
  12. Do the same for PC2, PC3 and PC4, by assigning to them the IP addresses 192.168.10.3, 192.168.10.4 and 192.168.10.5, respectively.
  13. Start capture on link connecting OVS1 to OVS2.
  14. Start capture on link connecting OVS1 to OVS3.
  15. Start capture on link connecting OVS2 to OVS3.
  16. In PC1 terminal execute the commands:
    ping 192.168.10.3
    ping 192.168.10.4
    ping 192.168.10.5
    and verify that answers are received.

Experiment results

We first understand how STP worked in this topology, then we will analyze packet captures on the three links connecting the switches.

STP status of OVS switches

In the auxiliary terminal of switches OVS-1, OVS-2 and OVS-3 execute the command:
ovs-appctl stp/show
and inspect that resulting output.

NOTE: Be aware that different results might be obtained in another experiment setup, due to the random MAC addresses assigned to the switches.

In our case, we obtained that:

Analysis of packet traces

By analysing the packet traces captured with Wireshark on the three links connecting the switches, we notice that:

STP reconfiguration after link failure

To prove that STP allows switches to react to link failures and topology changes, we will disable the link connecting the switch OVS-2 and OVS-3.


lab-topology

This link, in the previuos network state, was actively used to carry packets exchanged by hosts on the left (PC1 and PC2) and hosts on the right (PC3 and PC4).
We will verify that, after disabling the horizontal link, switch OVS-3 brings its port eth1 from blocked state to forwarding state.
In this way, packets exchanged by PC1 and PC3 will follow the route passing for OVS-1.

Return to list of labs

Copyright (c) 2024 - Roberto Canonico

Last updated: October 3, 2024 by Roberto Canonico