Thursday 9 April 2015

Configuring Spanning Tree Protocol

Configuring Spanning-Tree Features


These sections contain this configuration information:
Default Spanning-Tree Configuration
Spanning-Tree Configuration Guidelines
Changing the Spanning-Tree Mode. (required)
Disabling Spanning Tree (optional)
Configuring the Root Switch (optional)

Default Spanning-Tree Configuration

Table 17-3 shows the default spanning-tree configuration.
Table 17-3 Default Spanning-Tree Configuration 

Feature

Default Setting

Enable state

Enabled on VLAN 1.

For more information, see the "Supported Spanning-Tree Instances" section.

Spanning-tree mode

PVST+. (Rapid PVST+ and MSTP are disabled.)

Switch priority

32768.

Spanning-tree port priority (configurable on a per-interface basis)

128.

Spanning-tree port cost (configurable on a per-interface basis)

1000 Mb/s: 4.

100 Mb/s: 19.

10 Mb/s: 100.

Spanning-tree VLAN port priority (configurable on a per-VLAN basis)

128.

Spanning-tree VLAN port cost (configurable on a per-VLAN basis)

1000 Mb/s: 4.

100 Mb/s: 19.

10 Mb/s: 100.

Spanning-tree timers

Hello time: 2 seconds.

Forward-delay time: 15 seconds.

Maximum-aging time: 20 seconds.

Transmit hold count: 6 BPDUs

Spanning-Tree Configuration Guidelines

Each stack member runs its own spanning tree, and the entire stack appears as a single switch to the rest of the network.
If more VLANs are defined in the VTP than there are spanning-tree instances, you can enable PVST+ or rapid PVST+ on only 128 VLANs on each switch stack. The remaining VLANs operate with spanning tree disabled. However, you can map multiple VLANs to the same spanning-tree instances by using MSTP. 
If 128 instances of spanning tree are already in use, you can disable spanning tree on one of the VLANs and then enable it on the VLAN where you want it to run. Use the no spanning-tree vlan vlan-id global configuration command to disable spanning tree on a specific VLAN, and use the spanning-tree vlanvlan-id global configuration command to enable spanning tree on the desired VLAN. 
Switches that are not running spanning tree still forward BPDUs that they receive so that the other switches on the VLAN that have a running spanning-tree instance can break loops. Therefore, spanning tree must be running on enough switches to break all the loops in the network; for example, at least one switch on each loop in the VLAN must be running spanning tree. It is not absolutely necessary to run spanning tree on all switches in the VLAN. However, if you are running spanning tree only on a minimal set of switches, an incautious change to the network that introduces another loop into the VLAN can result in a broadcast storm.

         If you have already used all available spanning-tree instances on your switch, adding another VLAN anywhere in the VTP domain creates a VLAN that is not running spanning tree on that switch. If you have the default allowed list on the trunk ports of that switch, the new VLAN is carried on all trunk ports. Depending on the topology of the network, this could create a loop in the new VLAN that will not be broken, particularly if there are several adjacent switches that have all run out of spanning-tree instances. You can prevent this possibility by setting up allowed lists on the trunk ports of switches that have used up their allocation of spanning-tree instances. Setting up allowed lists is not necessary in many cases and can make it more labor-intensive to add another VLAN to the network.

Spanning-tree commands control the configuration of VLAN spanning-tree instances. You create a spanning-tree instance when you assign an interface to a VLAN. The spanning-tree instance is removed when the last interface is moved to another VLAN. You can configure switch and port parameters before a spanning-tree instance is created; these parameters are applied when the spanning-tree instance is created.
The switch supports PVST+, rapid PVST+, and MSTP, but only one version can be active at any time. (For example, all VLANs run PVST+, all VLANs run rapid PVST+, or all VLANs run MSTP.) All stack members run the same version of spanning tree. For information about the different spanning-tree modes and how they interoperate,
For configuration guidelines about UplinkFast, BackboneFast, and cross-stack UplinkFast.
Loop guard works only on point-to-point links. We recommend that each end of the link has a directly connected device that is running STP.

Changing the Spanning-Tree Mode.

The switch supports three spanning-tree modes: PVST+, rapid PVST+, or MSTP. By default, the switch runs the PVST+ protocol.
Beginning in privileged EXEC mode, follow these steps to change the spanning-tree mode. If you want to enable a mode that is different from the default mode, this procedure is required.

Command

Purpose

Step 1 

configure terminal

Enter global configuration mode.

Step 2 

spanning-tree mode {pvst |mst | rapid-pvst}

Configure a spanning-tree mode. All stack members run the same version of spanning-tree.

Stacking is supported only on Catalyst 2960-S switches running the LAN base image.

Select pvst to enable PVST+ (the default setting).

Select mst to enable MSTP (and RSTP). For more configuration steps

Select rapid-pvst to enable rapid PVST+.

Step 3 

interfaceinterface-id

(Recommended for rapid-PVST+ mode only) Specify an interface to configure, and enter interface configuration mode. Valid interfaces include physical ports, VLANs, and port channels. The VLAN ID range is 1 to 4094. The port-channel range is 1 to 6.

Step 4 

spanning-tree link-type point-to-point

(Recommended for rapid-PVST+ mode only) Specify that the link type for this port is point-to-point.

If you connect this port (local port) to a remote port through a point-to-point link and the local port becomes a designated port, the switch negotiates with the remote port and rapidly changes the local port to the forwarding state.

Step 5 

end

Return to privileged EXEC mode.

Step 6 

clear spanning-tree detected-protocols

(Recommended for rapid-PVST+ mode only) If any port on the switch is connected to a port on a legacy IEEE 802.1D switch, restart the protocol migration process on the entire switch.

This step is optional if the designated switch detects that this switch is running rapid PVST+.

Step 7 

show spanning-tree summary

and

show spanning-tree interfaceinterface-id

Verify your entries.

Step 8 

copy running-config startup-config

(Optional) Save your entries in the configuration file.
To return to the default setting, use the no spanning-tree mode global configuration command. To return the port to its default setting, use the no spanning-tree link-type interface configuration command.

Disabling Spanning Tree

Spanning tree is enabled by default on VLAN 1 and on all newly created VLANs up to the spanning-tree limit specified in the "Supported Spanning-Tree Instances" section. Disable spanning tree only if you are sure there are no loops in the network topology.
When spanning tree is disabled and loops are present in the topology, excessive traffic and indefinite packet duplication can drastically reduce network performance.
Beginning in privileged EXEC mode, follow these steps to disable spanning-tree on a per-VLAN basis. This procedure is optional.

Command

Purpose

Step 1 

configure terminal

Enter global configuration mode.

Step 2 

no spanning-tree vlan vlan-id

For vlan-id, the range is 1 to 4094.

Step 3 

end

Return to privileged EXEC mode.

Step 4 

show spanning-tree vlan vlan-id

Verify your entries.

Step 5 

copy running-config startup-config

(Optional) Save your entries in the configuration file.
To re-enable spanning-tree, use the spanning-tree vlan vlan-id global configuration command.

Configuring the Root Switch

The switch maintains a separate spanning-tree instance for each active VLAN configured on it. A bridge ID, consisting of the switch priority and the switch MAC address, is associated with each instance. For each VLAN, the switch with the lowest bridge ID becomes the root switch for that VLAN.
To configure a switch to become the root for the specified VLAN, use the spanning-tree vlan vlan-id root global configuration command to modify the switch priority from the default value (32768) to a significantly lower value. When you enter this command, the software checks the switch priority of the root switches for each VLAN. Because of the extended system ID support, the switch sets its own priority for the specified VLAN to 24576 if this value will cause this switch to become the root for the specified VLAN.
If any root switch for the specified VLAN has a switch priority lower than 24576, the switch sets its own priority for the specified VLAN to 4096 less than the lowest switch priority. (4096 is the value of the least-significant bit of a 4-bit switch priority value as shown in Table 17-1.)
The spanning-tree vlan vlan-id root global configuration command fails if the value necessary to be the root switch is less than 1.
If your network consists of switches that both do and do not support the extended system ID, it is unlikely that the switch with the extended system ID support will become the root switch. The extended system ID increases the switch priority value every time the VLAN number is greater than the priority of the connected switches running older software.
The root switch for each spanning-tree instance should be a backbone or distribution switch. Do not configure an access switch as the spanning-tree primary root.
Use the diameter keyword to specify the Layer 2 network diameter (that is, the maximum number of switch hops between any two end stations in the Layer 2 network). When you specify the network diameter, the switch automatically sets an optimal hello time, forward-delay time, and maximum-age time for a network of that diameter, which can significantly reduce the convergence time. You can use the hello keyword to override the automatically calculated hello time.
After configuring the switch as the root switch, we recommend that you avoid manually configuring the hello time, forward-delay time, and maximum-age time through the spanning-tree vlan vlan-id hello-time, spanning-tree vlan vlan-id forward-time, and the spanning-tree vlan vlan-id max-age global configuration commands.
Beginning in privileged EXEC mode, follow these steps to configure a switch to become the root for the specified VLAN. This procedure is optional.

Command

Purpose

Step 1 

configure terminal

Enter global configuration mode.

Step 2 

spanning-tree vlan vlan-idroot primary [diameter net-diameter [hello-time seconds]]

Configure a switch to become the root for the specified VLAN.

For vlan-id, you can specify a single VLAN identified by VLAN ID number, a range of VLANs separated by a hyphen, or a series of VLANs separated by a comma. The range is 1 to 4094.

(Optional) For diameter net-diameter, specify the maximum number of switches between any two end stations. The range is 2 to 7.

(Optional) For hello-time seconds, specify the interval in seconds between the generation of configuration messages by the root switch. The range is 1 to 10; the default is 2.

Step 3 

end

Return to privileged EXEC mode.

Step 4 

show spanning-tree detail

Verify your entries.

Step 5 

copy running-config startup-config

(Optional) Save your entries in the configuration file.
To return to the default setting, use the no spanning-tree vlan vlan-id root global configuration command.

No comments:

Post a Comment