Showing posts with label Spanning Tree. Show all posts
Showing posts with label Spanning Tree. Show all posts

Sunday, January 6, 2013

9 Common Spanning Tree Mistakes

Great read on STP common mistakes. Article is from 2013.

http://www.networkworld.com/community/blog/9-common-spanning-tree-mistakes?

Sunday, November 25, 2012

Spanning-Tree Customization - Port Cost & Port Priority

We are going to review how to modify STA(Spanning Tree Algorithm) selection. We are going to use figure 1 for this.


Figure 1

Keep the following STP Rules in mind that will be used to choose a path:
  1. Lowest Bridge ID -
  2. Lowest root path cost
  3. Lowest sender bridge ID
  4. Lowest sender port ID

Based on the below output we can see that the root port for vlan 25 is Gi1/47. Let supposed we wanted to use Gi1/48 instead of Gi1/47. How would we do this? We would need to modify the port cost on Switch 02 or modify the port priority that we are receiving from 01.  In our case we will modify the port cost on Switch 02 for Gi1/48.  The port cost is related to the port bandwidth. If you have a 10Mbit port then the port cost will be higher. Its an inverse affect.


Cisco_4948E_02#show spanning-tree vlan 25

VLAN0025
  Spanning tree enabled protocol rstp
  Root ID    Priority    32793
             Address     4055.39a7.bb80
             Cost        4
             Port        47 (GigabitEthernet1/47)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32793  (priority 32768 sys-id-ext 25)
             Address     4055.39a8.1000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi1/47              Root FWD 4         128.47   P2p
Gi1/48              Altn BLK 4         128.48   P2p


Lets make our changes and confirm Gi1/48 is now being used as the root port.

Cisco_4948E_02(config)#int gi 1/48
Cisco_4948E_02(config-if)#spanning-tree vlan 25 cost 2
Cisco_4948E_02(config-if)#end

Cisco_4948E_02#show spanning-tree vlan 25

VLAN0025
  Spanning tree enabled protocol rstp
  Root ID    Priority    32793
             Address     4055.39a7.bb80
             Cost        2
             Port        48 (GigabitEthernet1/48)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32793  (priority 32768 sys-id-ext 25)
             Address     4055.39a8.1000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi1/47              Altn BLK 4         128.47   P2p
Gi1/48              Root FWD 2         128.48   P2p

Now lets put everything back to default and we will modify the port-priority on Switch 01 and see how it affects the decision Switch 02 makes. Based on the below output all is back to Normal.

Cisco_4948E_02#show spanning-tree vlan 25

VLAN0025
  Spanning tree enabled protocol rstp
  Root ID    Priority    32793
             Address     4055.39a7.bb80
             Cost        4
             Port        47 (GigabitEthernet1/47)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32793  (priority 32768 sys-id-ext 25)
             Address     4055.39a8.1000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi1/47              Root FWD 4         128.47   P2p
Gi1/48              Altn BLK 4         128.48   P2p

Lets make some changes on Switch 01, but before we do this lets verify some details to compare afterwards. We can see the port id being received from Switch 01 is 128.47 for Gi1/47 and 128.48 for Gi1/48. We will modify this on Switch 01 and by changing this we will prefer Gi1/48. This will keep us inline with the original goal of using Gi1/48. 

Cisco_4948E_02#show spanning-tree vlan 25 detail

 VLAN0025 is executing the rstp compatible Spanning Tree protocol
  Bridge Identifier has priority 32768, sysid 25, address 4055.39a8.1000
  Configured hello time 2, max age 20, forward delay 15, transmit hold-count 6
  Current root has priority 32793, address 4055.39a7.bb80
  Root port is 47 (GigabitEthernet1/47), cost of root path is 4
  Topology change flag not set, detected flag not set
  Number of topology changes 10 last change occurred 00:32:15 ago
          from GigabitEthernet1/47
  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 47 (GigabitEthernet1/47) of VLAN0025 is root forwarding
   Port path cost 4, Port priority 128, Port Identifier 128.47.
   Designated root has priority 32793, address 4055.39a7.bb80
   Designated bridge has priority 32793, address 4055.39a7.bb80
   Designated port id is 128.47, designated path cost 0
   Timers: message age 16, forward delay 0, hold 0
   Number of transitions to forwarding state: 3
   Link type is point-to-point by default
   BPDU: sent 10, received 1362

 Port 48 (GigabitEthernet1/48) of VLAN0025 is alternate blocking
   Port path cost 4, Port priority 128, Port Identifier 128.48.
   Designated root has priority 32793, address 4055.39a7.bb80
   Designated bridge has priority 32793, address 4055.39a7.bb80
   Designated port id is 128.48, designated path cost 0
   Timers: message age 16, forward delay 0, hold 0
   Number of transitions to forwarding state: 4
   Link type is point-to-point by default
   BPDU: sent 14, received 88569


Cisco_4948E_01(config)#int gi 1/47
Cisco_4948E_01(config-if)#spanning-tree port-priority 32
Cisco_4948E_01(config-if)#int gi 1/48
Cisco_4948E_01(config-if)#spanning-tree port-priority 16
Cisco_4948E_01(config-if)#end
Cisco_4948E_02#show spanning-tree vlan 25 detail

 VLAN0025 is executing the rstp compatible Spanning Tree protocol
  Bridge Identifier has priority 32768, sysid 25, address 4055.39a8.1000
  Configured hello time 2, max age 20, forward delay 15, transmit hold-count 6
  Current root has priority 32793, address 4055.39a7.bb80
  Root port is 48 (GigabitEthernet1/48), cost of root path is 4
  Topology change flag set, detected flag not set
  Number of topology changes 11 last change occurred 00:00:02 ago
          from GigabitEthernet1/48
  Times:  hold 1, topology change 35, notification 2
          hello 2, max age 20, forward delay 15
  Timers: hello 0, topology change 32, notification 0, aging 300

 Port 47 (GigabitEthernet1/47) of VLAN0025 is alternate blocking
   Port path cost 4, Port priority 128, Port Identifier 128.47.
   Designated root has priority 32793, address 4055.39a7.bb80
   Designated bridge has priority 32793, address 4055.39a7.bb80
   Designated port id is 32.47, designated path cost 0
   Timers: message age 15, forward delay 0, hold 0
   Number of transitions to forwarding state: 3
   Link type is point-to-point by default
   BPDU: sent 10, received 1400

 Port 48 (GigabitEthernet1/48) of VLAN0025 is root forwarding
   Port path cost 4, Port priority 128, Port Identifier 128.48.
   Designated root has priority 32793, address 4055.39a7.bb80
   Designated bridge has priority 32793, address 4055.39a7.bb80
   Designated port id is 16.48, designated path cost 0
   Timers: message age 15, forward delay 0, hold 0
   Number of transitions to forwarding state: 5
   Link type is point-to-point by default
   BPDU: sent 16, received 88606

Cisco_4948E_02#
 

 Cisco_4948E_02#show spanning-tree vlan 25

VLAN0025
  Spanning tree enabled protocol rstp
  Root ID    Priority    32793
             Address     4055.39a7.bb80
             Cost        4
             Port        48 (GigabitEthernet1/48)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32793  (priority 32768 sys-id-ext 25)
             Address     4055.39a8.1000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi1/47              Altn BLK 4         128.47   P2p
Gi1/48              Root FWD 4         128.48   P2p


Friday, November 23, 2012

Spanning Tree (STP 802.1d and RSTP 802.1w) Debug & Notes

I am going to simulate a failure scenario while running 802.1d and then while running 802.1w. Currently Port Gi1/47(Green) and Gi1/48(Red) are configured as trunk ports and are allowing all vlans through. Gi1/48 is in a blocking(ALTN) state for Vlan 25 . I am going to admin down Gi1/47 and Enable debugging so we can see the events that occur. At the same time I will ping from SW01 to SW02 to see how long it takes to converge.

Figure 1


Verifications: 

Cisco_4948E_02#show spanning-tree root

                                        Root    Hello Max Fwd
Vlan                   Root ID          Cost    Time  Age Dly  Root Port
---------------- -------------------- --------- ----- --- ---  ------------
VLAN0001         20481 4055.39a8.1000         0    2   20  15
VLAN0025         32793 4055.39a7.bb80         4    2   20  15  Gi1/47
VLAN0026         32794 4055.39a8.1000         0    2   20  15
VLAN0052         32820 4055.39a8.1000         0    2   20  15

Cisco_4948E_02#show spanning-tree vlan 25

VLAN0025
  Spanning tree enabled protocol ieee
  Root ID    Priority    32793
             Address     4055.39a7.bb80
             Cost        4
             Port        47 (GigabitEthernet1/47)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32793  (priority 32768 sys-id-ext 25)
             Address     4055.39a8.1000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi1/47              Root FWD 4         128.47   P2p
Gi1/48              Altn BLK 4         128.48   P2p



Cisco_4948E_02#

Enable Debugging & Setup Ping:

Cisco_4948E_02#debug spanning-tree events
Spanning Tree event debugging is on
!
Cisco_4948E_02#terminal monitor
Cisco_4948E_02#

Cisco_4948E_01#ping 192.168.25.2 repeat 100000 timeout 5

Fail Over: 
Now we shutdown Gi1/47 while running 802.1d.





 Cisco_4948E_02(config)#int gi 1/47
Cisco_4948E_02(config-if)#shut
Cisco_4948E_02(config-if)#
*Nov 23 11:51:10.423: STP: VLAN0025 new root port Gi1/48, cost 4
*Nov 23 11:51:10.423: STP: VLAN0025 Gi1/48 -> listening
*Nov 23 11:51:12.419: %HSRP-5-STATECHANGE: Vlan25 Grp 25 state Standby -> Init
*Nov 23 11:51:12.423: STP: VLAN0025 sent Topology Change Notice on Gi1/48
*Nov 23 11:51:13.331: STP: VLAN0001 Topology Change rcvd on Gi1/48
*Nov 23 11:51:13.331: STP: VLAN0026 Topology Change rcvd on Gi1/48
*Nov 23 11:51:25.423: STP: VLAN0025 Gi1/48 -> learning
*Nov 23 11:51:40.423: STP: VLAN0025 Gi1/48 -> forwarding
*Nov 23 11:52:05.347: %HSRP-5-STATECHANGE: Vlan25 Grp 25 state Speak -> Standby

 Results:

It took forty seconds for spanning tree to converge. This can be seen from the below ping output which was set with a time out of 5 seconds.  By default it can take up to 50 seconds plus any additional time it takes your first hop redundancy protocols.

!!!!!!!........!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!
Success rate is 99 percent (9246/9254), round-trip min/avg/max = 1/1/28 ms
Cisco_4948E_01#

Lets do the same test while running 802.1w and all timers are default.

 Cisco_4948E_02#show spanning-tree root

                                        Root    Hello Max Fwd
Vlan                   Root ID          Cost    Time  Age Dly  Root Port
---------------- -------------------- --------- ----- --- ---  ------------
VLAN0001         20481 4055.39a8.1000         0    2   20  15
VLAN0025         32793 4055.39a7.bb80         4    2   20  15  Gi1/47
VLAN0026         32794 4055.39a8.1000         0    2   20  15
VLAN0052         32820 4055.39a8.1000         0    2   20  15
Cisco_4948E_02#show spanning-tree vlan 25

VLAN0025
  Spanning tree enabled protocol rstp
  Root ID    Priority    32793
             Address     4055.39a7.bb80
             Cost        4
             Port        47 (GigabitEthernet1/47)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32793  (priority 32768 sys-id-ext 25)
             Address     4055.39a8.1000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi1/47              Root FWD 4         128.47   P2p
Gi1/48              Altn BLK 4         128.48   P2p


Cisco_4948E_02(config-if)#
*Nov 23 14:13:30.643: RSTP(25): updt roles, root port Gi1/47 going down
*Nov 23 14:13:30.643: RSTP(25): Gi1/48 is now root port


Cisco_4948E_01#ping 192.168.25.2 repeat 100000 timeout 2

Type escape sequence to abort.
Sending 100000, 100-byte ICMP Echos to 192.168.25.2, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!
Success rate is 99 percent (984/985), round-trip min/avg/max = 1/1/16 ms
Cisco_4948E_01#

Since RSTP is much faster then legacy STP I set the timeout for 2 seconds. We can see that it converges well within 2 seconds. Compare that to the 40 seconds we waited for legacy STP.

Notes:

Default 802.1d Timers and States:
Disabled: Port is admin down.
Blocking: Port is up but not building the cam table or forwarding any frames via this interface.
Max Age: 20 Seconds -  How long the bridge(Switch) should wait before it stops hearings hellos.
Listening: 15 Seconds - Receiving BPDU's but not building the cam(MAC) table.
Learning: 15 Seconds -Starts building the cam (MAC) table.
Forwarding: Processing Frames.
Legacy Spanning Tree - The root bridge controls the forwarding delay as it is responsible for sending out BPDU.



Data rate STP Cost (802.1D-1998)
4 Mbit/s 250
10 Mbit/s 100
16 Mbit/s 62
100 Mbit/s 19
1 Gbit/s 4
2 Gbit/s 3
10 Gbit/s 2


Data rate RSTP Cost (802.1D-2004 / 802.1w)[3]
4 Mbit/s 5,000,000
10 Mbit/s 2,000,000
16 Mbit/s 1,250,000
100 Mbit/s 200,000
1 Gbit/s 20,000
2 Gbit/s 10,000
10 Gbit/s 2,000






















Monday, November 19, 2012

Understanding STP and RSTP Convergence

A must read on STP.

http://blog.ine.com/wp-content/uploads/2011/11/understanding-stp-rstp-convergence.pdf

Sunday, November 18, 2012

Spanning Tree Protocol (STP) Convergance

Two great articles that I highly recommend you read to get a deeper understanding of STP. I have been so busy with work and personal things, that It has taken time away from me being able to update this blog.  Hence why I am posting links to other sites. Never stop learning. I am studying for my switch Exam and would like to take the Exam sometime in late December.
  1. Understanding STP Convergence, Part I - INE
  2. Understanding STP Convergence, Part II - INE