Root Bridge Configuration

Hell Really Exists

Hell Really Exists

Get Instant Access

To prevent the surprises outlined in the previous section, you should always do two things:

■ Configure one switch as a Root Bridge in a determined fashion.

■ Configure another switch as a secondary Root Bridge, in case of a primary Root Bridge failure.

As the common reference point, the Root Bridge (and the secondary) should be placed near the center of the Layer 2 network. For example, a switch in the distribution layer would make a better Root Bridge choice than one in the access layer because more traffic is expected to pass through the distribution-layer devices. In a flat switched network (no Layer 3 devices), a switch near a server farm would be a more efficient Root Bridge than switches elsewhere. Most traffic will be destined to and from the server farm and will benefit from a predetermined, direct path.

TIP A Catalyst switch can be configured to use one of the following formats for its STP Bridge ID:

■ Traditional 802.1D bridge priority value (16 bits), followed by the unique switch MAC address for the VLAN

■ The 802.1t extended system ID (4-bit priority multiplier, plus a 12-bit VLAN ID), followed by a nonunique switch MAC address for the VLAN

If the switch can't support 1,024 unique MAC addresses for its own use, the extended system ID is always enabled by default. Otherwise, the traditional method is enabled by default.

To begin using the extended system ID method, you can uses the following global configuration command:

Switch(config)# spanning-tree extend system-id

Otherwise, you can use the traditional method by beginning the command with the no keyword.

You can configure a Catalyst switch to become the Root Bridge using one of two methods, which are configured as follows:

■ Manually setting the bridge priority value so that a switch is given a lower-than-default Bridge ID value to win a Root Bridge election. You must know the bridge priorities of every other switch in a VLAN so that you can choose a value that is less than all the others. The command to accomplish this is as follows:

Switch(config)# spanning-tree vlan vlan-list priority bridge-priority The bridge-priority value defaults to 32,768, but you can also assign a value of 0 to 65,535. If STP extended system ID is enabled, the default bridge-priority is 32,768 plus the VLAN number. In that case, the value can range from 0 to 61,440, but only as multiples of 4,096. A lower bridge priority is preferable.

Remember that Catalyst switches run one instance of STP for each VLAN (PVST+), so the VLAN ID must always be given. You should designate an appropriate Root Bridge for each VLAN. For example, you could use the following command to set the bridge priority for VLAN 5 and VLANs 100 through 200 to 4096:

Switch(config)# spanning-tree vlan 5,100-200 priority 4096

■ Causing the would-be Root Bridge switch to choose its own priority, based on some assumptions about other switches in the network. You can accomplish this with the following command:

Switch(config)# spanning-tree vlan vlan-id root {primary I secondary} [diameter diameter]

This command is actually a macro on the Catalyst that executes several other commands. The result is a more direct and automatic way to force one switch to become the Root Bridge. Notice that the actual bridge priorities are not given in the command. Instead, the switch modifies its STP values according to the current values in use within the active network. These values are modified only once, when the macro command is issued. Use the primary keyword to make the switch attempt to become the primary Root Bridge. This command modifies the switch's bridge priority value to become less than the bridge priority of the current Root Bridge. If the current root priority is more than 24,576, the local switch sets its priority to 24,576. If the current root priority is less than that, the local switch sets its priority to 4096 less than the current root.

For the secondary Root Bridge, the root priority is set to an artificially low value of 28,672. There is no way to query or listen to the network to find another potential secondary root simply because there are no advertisements or elections of secondary Root Bridges. Instead, the fixed secondary priority is used under the assumption that it will be less than the default priorities (32,768) that might be used on switches elsewhere. You can also modify the network diameter by adding the diameter keyword to this command. This modification is discussed further in the "Tuning Spanning-Tree Convergence" section later in the chapter.

As a final example, consider a switch that is currently using its default bridge priority for VLAN 100. In the extended system-id mode, the default priority is 32,768 plus 100 (the VLAN number). The output in Example 9-1 demonstrates this under the Bridge ID information. The default priority is greater than the current Root Bridge priority of 4200, so the local switch cannot become the root.

Example 9-1 Displaying the STP Bridge Priority Values

Switch# show spanning-tree vlan 100

VLAN0100

Spanning tree enabled protocol ieee Root ID Priority 4200

Address 000b.5f65.1f80

Example 9-1 Displaying the STP Bridge Priority Values (Continued) Cost 4

Port 1 (GigabitEthernet0/1)

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32868 (priority 32768 sys-id-ext 100) Address 000c.8554.9a80

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 [output omitted]

Now, the automatic method is used to attempt to make the switch become root for VLAN 100, using the command demonstrated in Example 9-2.

Example 9-2 Using a Macro Command to Configure a Root Bridge

Switch(config)# spanning-tree vlan 100 root primary

% Failed to make the bridge root for vlan 100

% It may be possible to make the bridge root by setting the priority

% for some (or all) of these instances to zero.

Switch(config)#

Why did this method fail? The current Root Bridge has a bridge priority of 4200. Because that priority is less than 24,576, the local switch will try to set its priority to 4,096 less than the current root. Although the resulting priority would be 104, the local switch is using an extended system ID, which requires bridge priority values that are multiples of 4,096. The only value that would work is 0, but the automatic method will not use it. Instead, the only other option is to manually configure the bridge priority to 0 with the following command:

Switch(config)# spanning-tree vlan 100 priority 0 Remember that on switches that use an extended system ID, the bridge priority is the configured priority (multiple of 4,096) plus the VLAN number. Even though the priority was set to 0 with the previous command, the switch is actually using a value of 100—priority 0 plus VLAN number 100, as the output in Example 9-3 reveals.

Example 9-3 Displaying Bridge Priorities with Extended System IDs

Switch# show spanning-tree vlan 100

VLAN0100

Spanning tree enabled protocol ieee Root ID Priority 100

Address 000c.8554.9a80 This bridge is the root

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec continues

Example 9-3 Displaying Bridge Priorities with Extended System IDs (Continued)

Bridge ID Priority

100 (priority 0 sys-id-ext 100)

Address

000c.8554.9a80

Hello Time

2 sec Max Age 20 sec Forward Delay 15 sec

m

[output omitted]

NOTE The spanning-tree vlan vlan-id root command will not be shown in a Catalyst switch configuration because the command is actually a macro executing other switch commands. The actual commands and values produced by the macro will be shown, however. For example, the macro can potentially adjust the four STP values as follows:

Switch(config)# spanning-tree vlan 1 root primary vlan 1 bridge priority set to 24576 vlan 1 bridge max aging time unchanged at 20 vlan 1 bridge hello time unchanged at 2 vlan 1 bridge forward delay unchanged at 15

Be aware that this macro doesn't guarantee that the switch will become the root and maintain that status. After the macro is used, it is entirely possible for another switch in the network to have its bridge priority configured to a lower value. The other switch would become the new root, displacing the switch that ran the macro.

NOTE The spanning-tree vlan vlan-id root command will not be shown in a Catalyst switch configuration because the command is actually a macro executing other switch commands. The actual commands and values produced by the macro will be shown, however. For example, the macro can potentially adjust the four STP values as follows:

Switch(config)# spanning-tree vlan 1 root primary vlan 1 bridge priority set to 24576 vlan 1 bridge max aging time unchanged at 20 vlan 1 bridge hello time unchanged at 2 vlan 1 bridge forward delay unchanged at 15

Be aware that this macro doesn't guarantee that the switch will become the root and maintain that status. After the macro is used, it is entirely possible for another switch in the network to have its bridge priority configured to a lower value. The other switch would become the new root, displacing the switch that ran the macro.

On the root, it is usually good practice to directly modify the bridge priority to an artificially low value (even priority 1 or 0) with the spanning-tree vlan vlan-id priority bridge-priority command. This makes it more difficult for another switch in the network to win the Root Bridge election, unless it is manually configured with a priority that is even lower.

Was this article helpful?

+3 -5

Responses

  • Terhi
    How to configure a switch to be the root bridge?
    2 years ago
  • jaiden
    How to create root bridge on l3 switch?
    2 years ago
  • abdul
    What keyword in macro command is used to configure a root bridge and automatically adjust STP timers?
    9 months ago
  • marco
    Which VLAN bridge priority value is assigned by the set spantree root command?
    8 months ago
  • STACY
    How to configure a switch to be a root bridge for a vlan?
    7 months ago
  • alfrida goodchild
    How to configure a switch as root bridge configuration?
    6 months ago
  • arsenio
    Which VLAN bridge priority value is assigned by the set span tree root command?
    3 months ago

Post a comment