Examining Spanning Tree Protocol in GNS3

We have examined the Spanning Tree Protocol in detail in our previous articles. The STP protocol is used to prevent loops occurring in the OSI 2nd layer.

Examining Spanning Tree Protocol in GNS3

Examining the Working Logic of the Spanning Tree with GNS3

In this article, we will discuss the operating logic of Spanning Tree Protocol on Layer 2 Switches using GNS3 network simulator. As we said before, in redundancy networks, the STP protocol blocks some ports and prevents the loops.

Now, let’s examine which ports will be selected as Designated, Root, and Blocked Port when configuring the STP protocol.

   Step 1

Run the GNS3 software and create a new project.

Creating a New Network Project in GNS3

   Step 2

Add 3 Layer 2 Switches to the workspace of the GNS3 program.

Adding Layer 2 Switch

   Step 3

After you have added three Layer 2 Switches, run all the Switches and open the command prompt. In the following topology, all Switches GigabitEthernet interfaces are used. Therefore, the STP GigabitEthernet Cost value is 4.

To select Root Bridge, first select the Switch with the smallest MAC address. If Root Bridge not configured manually, the MAC addresses values ​​use.

To obtain the MAC address of the Cisco Switch SW1, execute the show spanning-tree command at the SW1 CLI prompt.

show spanning-tree

   Step 4

As you can see in the image below, the MAC Address of SW1 is 00ff.9ee9.8a00. If you work by adding comments to the workspace, you can better understand its logic. Now, let’s learn the MAC addresses of SW2 and SW3.

Switch MAC Address

   Step 5

When you run show spanning-tree at the Switch SW2 command prompt, you can see the MAC address of the SW2.

L2 Switch MAC Address

   Step 6

The MAC address of SW3 is 00ff.9e54.7700 as you can see in the image below. Now let’s examine the Priority values ​​of all Switches and then compare these values.

Switch Priority Value

   Step 7

You can also use the show spanning-tree command to obtain Cisco Switch Priority values. The default Priority value for all Switches is 32769.

As you can see, the Priority value of SW1 is 32769.

Priority Default Value: 32769

   Step 8

The Priority value of SW2 is also 32769 because the Priority values ​​were not changed manually.

show spanning-tree command

   Step 9

Until now, we have learned the MAC addresses and Priority values ​​of Cisco Switches. Since the Priority values ​​of all Switches are equal, the Switch with the smallest MAC address will be Root Bridge.

Therefore, SW2 is a Root Bridge. Now, let’s examine the ports selected by the Spanning Tree protocol.

In the show spanning-tree command output on SW2, you can see that the Gig0/0 and Gig0/1 interfaces selected as the Designated Port. The interfaces of a Switch configured as Root Bridge always set to Designated. Because Root Bridge will send BPDU packets to other Switches at regular intervals.

Examining Port Status of GigabitEthernet Interfaces

   Step 10

Since SW2 is Root Bridge, these ports will set to Root Port since all Cost values ​​of SW1 and SW3 interfaces equal to SW2.

If SW2 and SW3 connected via FastEthernet, the GigabitEthernet 0/1 interface of SW3 would set to Blocked. Because the FastEthernet Cost value is 19.

You can see that these ports are set to Root Port in the show spanning-tree output of SW1 and SW3.

Root Port

   Step 11

One of the remaining interfaces must be set to Blocked. Because a loop will occur in the network environment. Since the main purpose of the Spanning Tree protocol is to prevent loops, the GigabitEthernet 0/1 interface of SW2 will be set to Blocked.

When the interfaces between SW2 and SW3 are evaluated, the smallest MAC address is also considered. As a result, the MAC address of the SW3 is set to Designated Port because it is smaller.

Designated Port

   Step 12

You can perform packet analysis using Wireshark. Right-click on the link/start capture to view the packets sent between SW1 and SW2.

Package Analysis with Wireshark

   Step 13

In the Packet Capture window, click OK.

Packet Capture

   Step 14

As soon as Wireshark opens, packet analysis will take place. As you can see in the image below, the STP protocol works effectively between Layer 2 Switches.

STP Protocol

Show Commands

SW1#show spanning-tree summary
Switch is in pvst mode
Root bridge for: none
Extended system ID is enabled
Portfast Default is disabled
PortFast BPDU Guard Default is disabled
Portfast BPDU Filter Default is disabled
Loopguard Default is disabled
EtherChannel misconfig guard is enabled
Configured Pathcost method used is short
UplinkFast is disabled
BackboneFast is disabled

Name Blocking Listening Learning Forwarding STP Active
---------------------- -------- --------- -------- ---------- ----------
VLAN0001 1 0 0 3 4
---------------------- -------- --------- -------- ---------- ----------
1 vlan 1 0 0 3 4
SW1#

 


SW1#show spanning-tree detail

VLAN0001 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, sysid 1, address 00ff.9ee9.8a00
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32769, address 00ff.9e19.6600
Root port is 1 (GigabitEthernet0/0), cost of root path is 4
Topology change flag not set, detected flag not set
Number of topology changes 1 last change occurred 00:14:22 ago
from GigabitEthernet0/3
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300

Port 1 (GigabitEthernet0/0) of VLAN0001 is root forwarding
Port path cost 4, Port priority 128, Port Identifier 128.1.
Designated root has priority 32769, address 00ff.9e19.6600
Designated bridge has priority 32769, address 00ff.9e19.6600
Designated port id is 128.1, designated path cost 0
Timers: message age 2, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is shared by default
BPDU: sent 2, received 446

Port 2 (GigabitEthernet0/1) of VLAN0001 is alternate blocking
Port path cost 4, Port priority 128, Port Identifier 128.2.
Designated root has priority 32769, address 00ff.9e19.6600
Designated bridge has priority 32769, address 00ff.9e54.7700
Designated port id is 128.1, designated path cost 4
Timers: message age 3, forward delay 0, hold 0
Number of transitions to forwarding state: 0
Link type is shared by default
BPDU: sent 1, received 449

Port 3 (GigabitEthernet0/2) of VLAN0001 is designated forwarding
Port path cost 4, Port priority 128, Port Identifier 128.3.
Designated root has priority 32769, address 00ff.9e19.6600
Designated bridge has priority 32769, address 00ff.9ee9.8a00
Designated port id is 128.3, designated path cost 4
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is shared by default
BPDU: sent 446, received 0

Port 4 (GigabitEthernet0/3) of VLAN0001 is designated forwarding
Port path cost 4, Port priority 128, Port Identifier 128.4.
Designated root has priority 32769, address 00ff.9e19.6600
Designated bridge has priority 32769, address 00ff.9ee9.8a00
Designated port id is 128.4, designated path cost 4
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is shared by default
BPDU: sent 446, received 0

 


SW1#show spanning-tree root

Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 32769 00ff.9e19.6600 4 2 20 15 Gi0/0
SW1#

 


SW1#show spanning-tree interface gigabitEthernet 0/0

Vlan Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
VLAN0001 Root FWD 4 128.1 Shr
SW1#

 

Examining STP in GNS3 ⇒ Video

You can watch the following video for configuring STP with GNS3 and also join our YouTube channel to support us!

   Final Word


In this article, we have examined the logic of working with Spanning Tree Protocol on Layer 2 Switches using GNS3 program. In the following articles, we will examine the STP protocol in more detail. Thanks for following us!

   Related Articles


How to Configure DHCP Relay Agent
How to Install Loopback Adapter
How to Configure OSPF
How to Configure EIGRP
How to Configure Port Security

Add a Comment

Your email address will not be published. Required fields are marked *

shares
error: