STP: PVST+ configuration

STP: PVST+ configuration

- in Enterprise Infrastructure
7944
0

PVST+ (Peer-VLAN Spanning-Tree)

First of all, let’s remember:

  • Common spanning-Tree (CST) only handles one instance of STP on switches, based on 802.1Q trunks, by default over vlan 1 (native vlan).
  • PVST handles one instance for each vlan over ISL trunks.

PVST+ handles one STP instance per vlan, i.e. we can play with the logical topologies for each of them. It is compatible with switches that handle CST (other manufacturers) and PVST (other Cisco switches). Current catalyst switches are configured by default with PVST+.

Configuring the root bridge

The first step is to choose the root bridge for the vlans, and there are two ways to do it:

1.- Manually set the switch priority value to a value less than 32768 (default value):

Switch(config)# spanning-tree vlan 10,20-50 priority 4096

The priority value can be between 0 and 65,535, but the configuration is only allowed in multiples of 4096. If we set a priority that is not a multiple of 4096, the switch will send us a message like the following:

Switch(config)# spanning vlan 10,20-50 priority 4000
 % Bridge Priority must be in increments of 4096.
 % Allowed values are:
   0 4096 8192 12288 16384 20480 24576 28672
   32768 36864 40960 45056 49152 53248 57344 61440

Switch(config)#

2.- Designate the root bridge switch to choose its own priority:

Switch(config)# spanning-tree vlan vlan-id root  { primary | secondary }

With the above command, we can define the primary and secondary root bridge. Let’s use the primary keyword to make the switch try to become the primary root bridge. This command modifies the bridge priority value of the switch to be lower than the priority of the current root bridge. For example, suppose the priority of the current root bridge is 20,480. In that case, the local switch sets its priority in 16,384 to become the new root bridge, i.e., it reduces its priority by 4096.

The command with the primary keyword does not work if the current root bridge has a priority of 4096. It does not work because the switch cannot assign itself a priority of zero dynamically. To achieve this configuration, it is necessary to manually set the priority to zero with the spanning-tree vlan <id_vlan> priority 0 command.

When we configure a switch with the secondary keyword, the priority is changed from the default value (32768) to 28672. With this priority, the switch will likely become the root bridge for the specified VLAN if the primary root bridge fails as long as the other switches on the network use the switch priority per default 32768.

Some switches use the extended system ID to represent their bridge priority; this new value is made up of the priority configured on the switch plus the vlan id. If a priority of 4096 is configured for vlan 10, the total priority will be 5006 (4096+10).

The extended system ID method is enabled or disabled with the following command globally:

Switch(config)# [no] spanning-tree extend system-id

Validation command:

Switch# show spanning-tree vlan 10

Note: If the choice of root bridge is left in its default state, several things can happen that result in a wrong choice. For example, the switch with lower performance characteristics could be chosen as the root bridge. If heavy traffic loads are expected to pass through the root bridge, the switch with the lowest performance is not the one. We must properly design our topology to know who will be our primary and secondary root bridge.

Port costs

As we already know, the root path cost for each active port of a switch is determined by the cost accumulated as a BPDU travels along the network. By default, STP assigns costs to ports based on their bandwidth, but the cost can be modified to choose or manipulate the topology for one or more vlans.

Let’s use the following command on a switch interface to modify the cost of a port:

Switch (config-if)# spanning-tree [ vlan vlan-id] cost valor_costo

Example:

Change the cost for vlan 10 port g0/1.

Switch(config)# interface g0/1
Switch(config-if)# spanning-tree vlan 10 cost 2

If the vlan parameter is provided, the port cost is modified only for the specified VLAN. Otherwise, the cost is modified for all active VLANs on the port. The cost value can vary from 1 to 200,000,000.

Command to validate the cost of a port:

Switch# show spanning-tree interface type member/module/number [cost]

Port priority

The port priority is a final criterion for determining the lowest path through STP. The port priority is a 16-bit value: 8 bits for the priority and 8 bits for the port number. The port priority ranges from 0 to 255; the default is 128.

The port number of a switch port is fixed because it is based only on its location or hardware index. However, the port ID can be modified to influence an STP decision by using the port priority.

We can configure the port priority with this configuration command on the interface:

Switch(config-if)# spanning-tree [ vlan vlan-list] port-priority Value

You can change the port priority for one or more VLANs using the vlan parameter. The VLAN numbers are given as vlan-list, a list of individual values or ranges of values separated by commas. If no vlan is specified, the port priority is set to all active VLANs. A lower port priority value indicates a preferred path to the root bridge.

Example: Changing the port priority

Switch(config)# interface gigabitethernet g1/1
Switch(config-if)# spanning-tree vlan 10,20 port-priority 32

Validation of port priority:

Switch# show spanning-tree interface g1/1

Modify STP timers

The default STP timers are usually sufficient to keep a network free of loops. However, on certain occasions and after a thorough review of the STP operation, they will likely need to be modified.

The command to modify the timers is as follows:

Switch(config)# spanning-tree [ vlan vlan-id] hello-time seconds
Switch(config)# spanning-tree [ vlan vlan-id] forward-time seconds
Switch(config)# spanning-tree [vlan vlan-id] max-age seconds

The timers can be modified for one or more vlans. If no vlan is specified, the command will apply to all STP instances of the active vlans on the switch.

Disable STP

By default, STP is enabled for all active VLANs and on all ports of a switch. STP must remain enabled on a network to prevent loops from forming. However, you may find that STP has been disabled in some way.

You can enable or disable STP instances for one or more vlans globally from the global configuration:

Switch (config) # [no] spanning-tree vlan vlan-id

Or it can be applied only to an interface:

Switch (config-if) # [no] spanning-tree vlan vlan-id

For more information:

https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst3750x_3560x/software/release/15-2_4_e/configurationguide/b_1524e_consolidated_3750x_3560x_cg/b_1524e_consolidated_3750x_3560x_cg_chapter_0111111.html

Facebook Comments

You may also like

How-to Install SSH Server on Linux 

1.- Install with apt-get command on Ubuntu: sudo