In this article I describe the STP and PVST for CCNA exam. STP stands for Spanning Tree Protocol and PVST stands for Per VLAN Spanning Tree. STP prevent the network loops at layer 2 between switches in a large network. The Spanning Tree Protocol STP provides low convergence time in network, Spanning tree algorithm (STA) used by STP to shut down the redundant links to avoid the loops.
Common Terms related to STP and PVST
I describe some common terms related to STP and PVST. The Root Bridge is a switch which have lowest bridge priority ID. The Root Bridge switch is the main focus point for all switches in the network. Root Bridge is the main switch of the network. In case the bridge priority value is same in all network switches, the lowest MAC ID use to select the root bridge. In Cisco switches the default bridge ID remains 32768. This Bridge Id can be changed manually. So if you want to make a particular switch root bridge, you need to change its bridge id. Every time when network topology changed the root bridge may be changed. I mean when a new switch added to network or any existing switch removed from the network.
In case of failure of Root Bridge, remaining switches automatically select the next root bridge. NON Root Bridges are remaining all switches which are not a root bridge. Bridge Protocol Data Unit (BPDU) is the information sent and received between different switches in the network. BPDU contains the bridge ID of a bridge. Port Cost is defined by the data transfer speed or bandwidth of a link. The Port cost is the main factor to determine the best path among the multiple links. Below image show the port cost of Cisco switches. Path Cost is very similar to the Port Cost. The value of path cost determine the best path for the data packets. Root Port is the port which have lowest path cost with the root bridge. The root bridge never have a root port all other switches than the root bridge have the root port.
Type of ports used in STP and PVST
Designated port is the port of switch with the best cost to transmit the data in the network. The Non designate port is the port with the worst cost and not used for any data transmission in the network. A forwarding port may be root port or designated port which is used to forward the frames in the network. A Blocked port never forward the frames in the network.
Convergence in STP and PVST
When a switch power on some initial process complete in the IOS of switch. No any data processed or forwarding during convergence time. STP processed the convergence in a switch, at that time all the end devices stop transmitting and receiving data within the network. The switches of the network update the database related to neighbour’s information like MAC address and network topology. Generally the convergence time taken by switch is one minute.
Link Cost for STP and PVST
There are multiple links remain in a switch in the network. Link cost define the best path for data packet forwarding. Link cost defined according to the data transfer speed and number of hopes between source and destination. Links are selected on the basis of link cost for data transfer between source and destination. Link cost used for calculation of best path for data transfer by the STP and PVST.
Speed | Link Cost |
1 Gb/s | 1 |
100 Mb/s | 5 |
10 Mb/s | 10 |
Types of STP and PVST
There are many types of STP and PVST which are running in networking today. Network administrator used the various types of STP and PVST in networking according to their requirement. The main purpose of each type of STP and PVST is to avoid the loop creation in network.
The basic standard of STP is IEEE802.1d, It works slow but requires low resources for function in the network. IEEE802.1d generally recognized as Common Spanning Tree or CST.
Cisco devices uses its own proprietary which is known as PVST+. It is possible that a network consist of multiple VLANs, in this case PVST+ provides separate STP for each VLAN. PVST+ stands for Per VLAN Spanning Tree, it supports multiple root bridges.
Another version of STP in networking is IEEE 802.1w. It is little bit different from the IEEE 802.d standard of STP. IEEE 802.1w is generally known as RSTP (Rapid Spanning Tree Protocol). It works for a single root bridge in a network. The speed of convergence can be increased by using RSTP but the issue is that it cannot support multiple VLAN.
IEEE 802.1s is one of STP type, which is a Cisco Propriety MISTP. It allow to map multiple VLAN with the Spanning Tree Protocol. This will save the process time of the switch or we can say the convergence time will be reduced in the network.
Rapid PVST+ provides PVST+ and IEEE 802.w for each VLAN in the network. It provides very fast convergence time in the network.
PortFast and BPDU Guard in STP and PVST
PortFast and BPDU Guard terms used in STP and PVST. The PortFast standard belongs to IEEE 802.1D which is a proprietary of Cisco. Every time when a port changes its state convergence process takes place in the network. The convergence time may be 50 seconds to 80 seconds in a simple network. PortFast function reduced the convergence time in the network. Every network administrator want to reduce the convergence time in the network to improve the efficiency of the network. An example of PortFast benefit is DHCP service in the network.
PORTFAST :- We know the STP enabled switchports to take some time during moving from blocking state to forwarding state. During this time no any data forwarded and this time is known as convergence. Many network services (like DHCP) required to connect with network devices before they will time out. So it is require to stop the STP feature for these networking services on particular switchports. PortFast enables a switchport to change the STP forwarding state immediately. In other words we can say PortFast feature bypass the listening and learning states. PortFast can be applied on any physical or logical port of a switch. PortFast feature configured on enter or exit ports towards network generally. These enter or exit ports are generally access ports.
STP service not Remember one more thing the BPDUs can be received on the port after enabling the PortFast feature on a switchport. When a BPDU received on a PortFast port the port changes to a non PortFast switchport.
Configuration of PortFast in a switch
See the below diagram. Here three switches are connected via trunk port with each other. A DHCP server connected with a switch1 on port Fa0/1 with access port. Similarly a PC is connected with the same switch1 on port Fa0/2.
We can see the requirement of switchport Fa0/1. Switchport Fa0/1 required to come in forwading state immediately because it will send the IP addresses to network devices. So in switch1 run the below commands in its CLI.
switch1>enable switch1#config t Enter configuration commands, one per line. End with CNTL/Z. switch1(config)#spanning-tree ? mode Spanning tree operating mode portfast Spanning tree portfast options vlan VLAN Switch Spanning Tree switch1(config)#
You can see in above command window there is a PortFast option available with spanning tree command. This option allows you to use the various features of PortFast mode. Let’s see the option available for PortFast mode.
switch1>enable switch1#config t Enter configuration commands, one per line. End with CNTL/Z. switch1(config)#spanning-tree portfast ? bpdufilter Enable portfast bdpu filter on this switch bpduguard Enable portfast bpdu guard on this switch default Enable portfast by default on all access ports switch1(config)#
In above command we can see there are three options available bpdu filter, bpdu guard and default. In case you are using the spanning tree portfast default, all the ports will change to portfast mode automatically. So In this scenario we require to made PortFast to only port Fa0/1. To do these changes run the below commands in CLI mode of switch.
switch1>enable switch1#config t switch1(config)#interface fastEthernet 0/1 switch1(config-if)#spanning-tree portfast %Warning: portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc... to this interface when portfast is enabled, can cause temporary bridging loops. Use with CAUTION %Portfast has been configured on FastEthernet0/1 but will only have effect when the interface is in a non-trunking mode. switch1(config-if)#exit switch1(config)#exit switch1# %SYS-5-CONFIG_I: Configured from console by console switch1#wr Building configuration... [OK] switch1#
By running above commands you can see the message prompt that FastEthernet0/1 has been configured. Similarly you can disable or enable PortFast on any port of the switch.
BPDU Guard in STP and PVST
PortFast feature used to reduce the convergence time in a network via STP and PVST. BPDU Guard property stop receiving the BPDU on a particular switch port.
When a port received any BPDU it will converts to non-PortFast mode. So it is necessary to block receiving of BPDUs on particular switchport. It is not necessary to make BPDU guard port when PortFast is enable, but it is good practice to do that. BPDU guard have two mode to configure one is default and another is globally.
So run the below commands to enable BPDU Guard on all ports globally.
switch1>enable switch1#config t Enter configuration commands, one per line. End with CNTL/Z. switch1(config)#spanning-tree portfast bpduguard default switch1(config-if)#do wr Building configuration... [OK] switch1(config-if)#
After running above command BPDU Guard set on all switchport globally. To apply BPDU Guard on a particular port run the below command.
switch1>enable switch1#config t Enter configuration commands, one per line. End with CNTL/Z. switch1(config)#interface fastEthernet 0/1 switch1(config-if)#spanning-tree bpduguard ? disable Disable BPDU guard for this interface enable Enable BPDU guard for this interface switch1(config-if)#spanning-tree bpduguard enable switch1(config-if)#do wr Building configuration... [OK] switch1(config-if)#
That is all about the PortFast and BPDU Guard in networking. Another term BPDU Filter is used in STP configuration. BPDU Filter allow some specific ports for sending or receiving BPDUs.
In this article I describe the STP and PVST for CCNA Exam. I hope you found this article helpful. You may drop a comment below or contact us for any suggestion. your suggestions are always welcome by us.