Spanning Tree Protocol


how to
Switching - Spanning Tree Algorithm

 In this article I'll speak about a networking mechanism accustomed to give a loop-free network, the Spanning Tree Protocol (STP). I will demonstrate the main elements that comprise this protocol, their role and functionality. STP can be used to keep up on a regular basis one or more path active between two end points. As there is the possibility that loops can happen, STP automatically deactivates one path should there be multiple paths for the same destination point. With a redundant design, there's always an alternate path if the main link becomes inactive. Remember from a previous post that the hierarchical network model uses multiple switches and links between some time to another. Even though a core switch fails, there is another prepared to forward packets outside the network.

how to
 STP sends frames between devices called BPDU (bridge protocol data unit) frames that contain details about the state of the network. By intentionally blocking paths between devices, STP ensures on a regular basis there are no network loops. The physical path will still exist and you will be used as an alternative path in the event the main one fails. STP uses the Spanning Tree Algorithm to determine which paths ought to be deactivated. STA chooses the so called root bridge after BPDU frames are exchanged between devices. When BPDU frames are exchanged, STA selects the root bridge by studying the lowest bridge ID (BID). Each BPDU frames contains the BID which is a combination between the MAC address, a priority value and extended system ID. Initially, all switches work like root bridges and so they exchange BPDU frames in between each other. By comparing the BIDs from BPDU frames received, switches determine who's the most effective root bridge switch. Being an Administrator, it is possible to influence the root bridge selection by changing the switch priority. Automagically the switch priority is 32768 but you can assign important between 1 and 65536 (it should be a worth that's an increment of 4096). To change the switch priority, enter in the global configuration mode and type spanning-tree vlan [id] priority [number]. As an example, you are able to set the priority by typing spanning-tree vlan 1 priority 8192. If you try to assign another value that's not an increment of 4096, you'll be given a warning proclaiming that "% Bridge Priority should be in increments of 4096.

% Allowed values are:

 0 4096 8192 12288 16384 20480 24576 28672

 32768 36864 40960 45056 49152 53248 57344 61440"





 Following your root bridge was chosen, STA will determine the very best road to reach the root bridge for those switches within the network. The total cost from place to another will be the expense of a path. After calculating the costs, STA will set all switch ports that have fun with the STP algorithm towards the appropriate mode, the subsequent:

designated ports - ports which will forward network traffic

non designated ports - ports that'll be emerge the blocking state. These ports will not forward traffic and they will be used when the main path fails. These ports are positioned on this state to avoid routing loops.

root ports - the ports which are the nearest for the root bridge

Another way you can influence how ports are configured through the STP algorithm is as simple as changing the port's priority. This is a value that's by default set to 128 but tend to be changed to a value between 0 and 240. To improve a port's priority, use the spanning-tree port-priority [number] command in the interface configuration mode.

 I've said previously that STP will choose best paths by comparing the all inclusive costs from place to another. Which means that STP will sum all the costs all paths that the packet must traverse, to reach it's destination. The default cost is determined by the path's bandwidth. For example, a path with the speed of 1 Gb/s have a price of 4, one with 100 Mb/s will have the price of 19 etc. The trail using the lowest cost is desired. You can let STP chose paths by checking the link's cost or configure manually a cost to get a certain path. To configure the cost of a path, simply enter the interface configuration mode and type spanning-tree cost [number], as an example, spanning-tree cost 10. To verify your spanning tree configuration type show spanning-tree.

 Switch ports that participate in the spanning-tree algorithm must transition to many states before they're able to fully integrate in the STP process. By changing the ports state, STA ensures that there are no loops occurring inside the network. There are five states that a port can transition to:

Disable - the main harbour is not going to participate in the spanning-tree process and it will not forward data.

Blocking - the main harbour is not going to forward frames received however it will process BPDU frames to find out other switches states.

Listening - the main harbour will have fun with the STP algorithm, it's going to receive and forward BPDU frames.

Learning - the main harbour will get and forward BPDU frames and will also include entries for the MAC address table

Forwarding - the main harbour is fully taking part in the STP process, it's going to forward/receive frames and BPDU frames.

 There are several timers created to manage the length of time a port will stay in a certain state. The hello time may be the interval between BPDU frames (the time it should pass before another BPDU frame is distributed), automagically it is 2 seconds however this can be easily changed to a value between 1 and Around 10 secs. The forward delay time is the time a port will need attain the learning state. By default, the forward delay time is defined to fifteen seconds , but it can be changed to a value between 4 and 30. Usually, you won't have to change these timers since they have been configured to some network diameter of seven that is usually enough for the majority of network implementations. In the event you really want to affect the spanning tree network diameter, utilize the command spanning-tree vlan [number] root primary/secondary diameter [number], as an example spanning-tree vlan 10 root primary diameter 9.

 Portfast ports will transition from your blocking state to the forwarding state just after a switch is powered on. Portfast ports can be configured on access ports since these ports are used to connect end devices for example computers/printers and do no have fun playing the STP convergence process. Also, it is recommended that you determine these ports within the BPDU guard mode. A port within the BPDU guard mode won't forward BPDU packets to get rid of devices since there is no need to. To allow the Portfast and the BPDU guard features, make use of the following commands:



 To look at the configured ports, use the show running-config command:



 In the end, I would like to talk a bit concerning the different STP versions. Because you have probably seen, Cisco created some customized versions from the Spanning Tree Protocol. Because this protocol had been a standard, IEEE created their own version of STP which you can use by all networking devices.

 An older form of STP created by Cisco may be the Per-VLAN spanning tree protocol (PVST). This protocol stated that STP can run a different instance for each and every VLAN. What this means is that the switch can be elected as the root bridge for just one VLAN and the other switch may be elected as the root bridge for an additional VLAN. By implementing this kind of design, the redundancy is increased as well as load balancing can be implemented because visitors are spread between different VLANs. in PVST, BPDU frames support the VLAN ID to tell apart between different STP instances. It is possible to set the basis bridge to get a VLAN by using the spanning-tree vlan [id] root primary/secondary command. For example, you are able to set the primary root bridge for VLAN 10 by typing spanning-tree vlan 10 root primary over a switch and spanning-tree vlan 10 root secondary on another switch. The same could be configured should you change the priority value with all the spanning-tree vlan [id] priority [number] (a worth incremented by 4096) command.



On this simple topology, I've selected the S2 switch the signal from function as the root bridge for vlan 10 and S3 the secondary root bridge for vlan 10. Also, I've selected S1 to become the root bridge for vlan 20 by changing the priority value underneath the default value.



 Another form of Cisco STP will be the Rapid-PVST which can be an implementation from the IEEE RSTP protocol. When Rapid spanning tree protocol was invented, it had some new features that did not existed before. RSTP had a heightened speed in network convergence, it added more port state and roles and was also suitable for all the previous versions of STP. RSTP introduced edge ports which can be somehow like Portfast ports simply because they connect end devices. Edge ports do not have fun with the STP algorithm but unlike Portfast ports, when they receive a BPDU frame, hawaii is automatically changed to a active STP port (inside the forwarding state). I will not talk an excessive amount of concerning this protocol, you will need to realize that it has only three port states: discarding, learning and forwarding. Through the use of only three states, the STP speed is increased. The Rapid-PVST can be set on a Cisco switch using the spanning-tree mode rapid-pvst command from your global configuration mode.



 There is certainly much more to say about the STP protocol, I really hope I've pointed out all of the main reasons that define this protocol. I hope you will discover this informative article interesting, leave a comment/share. Thanks for reading this and have a wonderful day.

This free website was made using Yola.

No HTML skills required. Build your website in minutes.

Go to www.yola.com and sign up today!

Make a free website with Yola