Cisco Routing/Switching – Spanning Tree Protocol Lab 1

Just a small lab from the CCNA STP series, Here we will:

  1. Determine the version of STP running, port status and identify our Root Bridge
  2. Cause a Root port outage, determine how long convergence takes and the states upon which convergence takes while transitioning to forwarding
  3. Change Switches to RSTP and test the convergence again

You can use physical Switches, GNS3 or Packet Tracer whichever takes your fancy, I only have two Physical Switches so I’m going to use packet tracer in my sample.

Create yourself a network topology like this

Noting: all of these will have different outcomes, finding the root bridge yourself is a great way to learn STP as I have recently found myself

In my example, I have identified the Root Bridge by starting on the switch at the top (S1) and identifying which is the root switch by running the command as below:

Switch1#sh spanning-tree 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0002.1626.9443
             Cost        19
             Port        4(FastEthernet0/4)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0007.ECEB.3805
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg FWD 19        128.1    P2p
Fa0/4            Root FWD 19        128.4    P2p
Fa0/5            Desg FWD 19        128.5    P2p

Switch1#

This is the easiest method to find the root bridge and the information provided in a single show command is very detailed,

Line #5 We can see the Bridge ID of the Root Bridge,

Line #6 we can see the cost to get to the Root Bridge which is 19 (Fast Ethernet cost)

Line #7 we can see which port to go out of to reach the Root Bridge and as its only a cost of 19 it’s only 1 hop or a single link

Line #18 we can see that FA0/4 has been assigned as the Root Port

Now looking at our diagram and seeing where FA0/4 goes out to, this is Switch4, lets confirm by running the same command on our suspected Switch:

Switch4#sh spanning-tree
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0002.1626.9443
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0002.1626.9443
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg FWD 19        128.1    P2p
Fa0/2            Desg FWD 19        128.2    P2p

Switch4#

Let’s break it down a little easier

Line #5 – the Bridge ID of the root is matching the Bridge ID of this Switch (Line #10)

Line #6 – A dead giveaway (This Bridge is the Root!)

Line #10 – The Bridge ID of this Switch Matching the same as the Bridge ID of the Root Bridge

Lines #16,17 – All ports are Designated Ports, only the Root Bridge would have all of its ports as Designated Ports

Okay so lets update our diagram, make it a little more easier to work with:

 

Unfortunately I don’t have Visio on my home desktop so I’ve had to go with the scruffy Packet Tracer Diagram, plus it gives you a sense of realism in the lab so I guess it works.

Packet tracer does a good job of showing the blocked ports so we don’t need to note those, Your diagram will be different anyway as we are just using out of the box STP.

Next lets Cause a root port outage, I’m going to kill the port FA0/1 on Switch3 and see how long convergence takes:

Switch3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch3(config)#int fa0/1
Switch3(config-if)#shutdown

Switch3(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

Here we can see that Fa0/1 has vanished and is administratively disabled so doesn’t appear in the STP output, the alternative interface in the listening state, listening for BPDU’s (This is known as the Transitory State without MAC Learning and without forwarding)

Switch3#sh spanning
Switch3#sh spanning-tree 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0002.1626.9443
             Cost        38
             Port        2(FastEthernet0/2)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0030.A313.0C55
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Root LSN 19        128.2    P2p

Switch3#

This should be in the listening state for 15 seconds, after the 15 seconds this will then transition into the learning state (still in the Transitory State with MAC learning and without forwarding) this will be in this state for a further 15 seconds, total time (30 Seconds)

Switch3#sh spanning-tree 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0002.1626.9443
             Cost        38
             Port        2(FastEthernet0/2)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0030.A313.0C55
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Root LRN 19        128.2    P2p

Switch3#

Then you will finally see the alternative port is in the Forwarding State (a Stable state that allows MAC address learning and forwarding of Data Frames)

Switch3#sh spanning-tree 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0002.1626.9443
             Cost        38
             Port        2(FastEthernet0/2)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0030.A313.0C55
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Root FWD 19        128.2    P2p

Let’s see what happens when we change from STP to RSTP, let’s first re-enable our disabled port in the topology then change to RSTP:

Switch3>en
Switch3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch3(config)#int fa0/1
Switch3(config-if)#no shutdown

Switch3(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

Switch3(config-if)#

Then to enable RSTP on each Switch you will need to input the command as per below:

Switch3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch3(config)#spanning-tree mode rapid-pvst
Switch3(config)#

If you want to double check the switches, just log into one and run the command below:

Switch5#sh spanning-tree 
VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    32769
             Address     0002.1626.9443
             Cost        38
             Port        1(FastEthernet0/1)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0030.F26D.ECAB
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Root FWD 19        128.1    P2p
Fa0/2            Altn BLK 19        128.2    P2p

Switch5#

As you can see from Line #3 the protocol is RSTP if it was the standard STP it would say IEEE.

So let’s test with RSTP, I’m going to perform it exactly the same way taking down Fa0/1 on Switch3:

Switch3(config)#int fa0/1
Switch3(config-if)#shutdown

Switch3(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

Switch3(config-if)#

Instantly I saw within Packet Tracer that the interface switched in no less than a second or so, RSTP does not use the Listening State therefore is instantly learning MAC addresses and placed into the forwarding state

 

In the next Lab we will choose our own bridge priority and create our own Root Bridge and a backup root.

 

 

Leave a Reply

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