Spanning Tree Protocol

Simulate and study the spanning tree protocol

Introduction#

Spanning Tree Protocol (STP) is a link management protocol. Using the spanning tree algorithm, STP provides path redundancy while preventing undesirable loops in a network that are created by multiple active paths between stations. Loops occur when there are alternate routes between hosts. To establish path redundancy, STP creates a tree that spans all of the switches in an extended network, forcing redundant paths into a standby, or blocked state. STP allows only one active path at a time between any two network devices (this prevents the loops) but establishes the redundant links as a backup if the initial link should fail. Without spanning tree in place, it is possible that both connections may simultaneously live, which could result in an endless loop of traffic on the LAN.

(Reference: A good reference for this topic is Section 3.1.4: Bridges and LAN switches, of the book, Computer Networks, 5^th^ Edition by Peterson and Davie)

Network Setup#

Open NetSim and click on Experiments> Internetworks> Routing and Switching> Simulate and study the spanning tree protocol then click on the tile in the middle panel to load the example as shown in below Figure 6‑1.

Graphical user interface, text, application Description automatically
generated

Figure 6‑1: List of scenarios for the example of Simulate and study the spanning tree protocol

NetSim UI displays the configuration file corresponding to this experiment as shown below Figure 6‑2.

Figure 6‑2: Network set up for studying the STP 1

Note: At least three L2 Switches are required in the network to analyze the spanning tree formation.

Procedure#

STP-1

Step 1: A network scenario is designed in the NetSim GUI comprising of 3 Wired Nodes and 3 L2 Switches in the "Internetworks" Network Library.

Step 2: Go to L2 Switch 1 Properties. In the Interface 1 (ETHERNET) > Datalink Layer, "Switch Priority" is set to 2. Similarly, for the other interfaces of L2 Switch 1, Switch Priority is set to 2.

Step 3: Go to L2 Switch 2 Properties. In the Interface 1 (ETHERNET) > Datalink Layer, "Switch Priority" is set to 1. Similarly, for the other interfaces of L2 Switch 2, Switch Priority is set to 1.

Step 4: Go to L2 Switch 3 Properties. In the Interface 1 (ETHERNET) > Datalink Layer, "Switch Priority" is set to 3. Similarly, for the other interfaces of L2 Switch 3, Switch Priority is set to 3.


L2_Switch Properties L2_Switch 1 L2_Switch 2 L2_Switch 3


Switch Priority 2 1 3


Table 6‑1: Switch Priorities for STP-1

NOTE:* Switch Priority is set to all the 3 L2 Switches and Switch Priority has to be changed for all the interfaces of L2 Switch.***

Switch Priority is interpreted as the weights associated with each interface of a L2 Switch. A higher value indicates a higher priority.

Step 5: Right click on the Application Flow "App1 CUSTOM" and select Properties or click on the Application icon present in the top ribbon/toolbar.

A CUSTOM Application is generated from Wired Node 4 i.e., Source to Wired Node 5 i.e., Destination with Packet Size remaining 1460Bytes and Inter Arrival Time remaining 20000µs. Additionally, the "Start Time" parameter is set to 1 second while configuring the application see Figure 6‑3.

Figure 6‑3: Application Configuring Window

Note: Wired Node 6 is not generating traffic to any other nodes.

Here, Wired Node 4 is sending data to Wired Node 5 and the node properties are set to default.

Step 6: Enable the plots and click on Run simulation. The simulation time is set to 10 seconds.

STP-2

The following changes in settings are done from the previous sample:

In STP-2, the "Switch Priority" of all the 3 L2 Switches are changed as follows Table 6‑2.


L2_Switch Properties L2_Switch 1 L2_Switch 2 L2_Switch 3


Switch Priority 1 2 3


Table 6‑2: Switch Priorities for STP-2

Output#

In the NetSim Design Window, click on Display Settings > Spanning Tree check box see Figure 6‑4.

STP-1

Figure 6‑4: NetSim Design Window - Display Setting for STP-1

Go to NetSim Packet Animation Window and click on Play button. We can notice that, after the exchange of control packets, the data packets take the following path. Wired Node 4 > L2 Switch 1 > L2 Switch 2 > L2 Switch 3 > Wired Node 5.

STP-2

Figure 6‑5: NetSim Design Window - Display Setting for STP-2

Go to NetSim Packet Animation window and click on Play button. We can notice that, after the exchange of control packets, the data packets take the following path. Wired Node 4 > L2 Switch 1 > L2 Switch 3 > Wired Node 5.

Go to Simulation Results window, In the left-hand-side of the Results Dashboard, click on the arrow pointer of Switch MAC address table to obtain the Switch MAC address table list of all the L2 Switches.

For each L2 Switch, a Switch MAC Address Table containing the MAC address entries see Figure 6‑6, the port that is used for reaching it, along with the type of entry can be obtained at the end of Simulation.

Graphical user interface, table Description automatically
generated

Figure 6‑6: MAC Address Table

Inference#

Each L2 Switch has an ID which is a combination of its Lowest MAC address and priority. The Spanning tree algorithm selects the L2 Switch with the smallest ID as the root node of the Spanning Tree. The root node forward frames out over all its ports. In the other L2 Switches, the ports that have the least cost of reaching the root switch are set as Forward Ports and the remaining are set as Blocked Ports. In the STP-1, L2_Switch 2 was assigned least priority and was selected as a Root Switch. The green line indicates the forward path, and the red line indicates the blocked path. The frame from Wired Node 4 should take the path through the L2_Switch 1, 2 and 3 to reach the Wired Node 5. In the STP-2, L2_Switch 1 was assigned least priority and selected as a Root switch. In this case, the frame from Wired Node 4 takes the path through the L2_Switch 1 and 3 to reach the destination Wired Node 5.