Spanning Tree Manipulating the root bridge

From csn
Jump to navigation Jump to search

Overview

In this lab you will examine how STP operates in a multi VLAN environment. You will also control the STP topology by manually configuring a primary and a backup root switch.

Preparation

  • This lab builds on Spanning_Tree_Default_Behaviour so ensure that all of the steps in the basic STP lab have been completed and use the same topology.
  • If you shut down your original root switch, restore it to normal operation now.

Steps

Trunk configuration

As you will be making use of multiple VLANs you need trunks between the switches to carry the VLAN traffic. Although the switches may have already formed trunks, best practice requires that interswitch links be manually specified.

  • Over the years Cisco has varied in their default behaviour for switches. Some versions of the IOS default to trunking on ports while others do not.

Why are trunks automatically formed (or not)? ____________________________________________________________________________

  • Manually configure all inter-switch links to be a trunk using 802.1q as the trunking protocol.

You will need to be in interface configuration mode to do this. As we will be configuring multiple interfaces you may find it helpful to use the interface range command.

Example:

Switch(config)#interface range gigabitEthernet 0/0-3     (Some IOS are very picky needing spaces around the hyphen)

All subsequent commands will be applied to all of the ports in the range.


Useful commands:

switchport trunk encapsulation dot1q        (Use the industry standard 802.1Q protocol)
switchport mode trunk                       (Forcibly become a trunk, don't rely on switches to auto-negotiate - Best practice)
switchport nonegotiate                      (Optionally turn off the negotiation functionality, slightly improves performance
                                             Best practice)

You will save a lot of time if you create the commands in notepad(Windows)/gedit(Linux) and then paste them into your switches.

Configure VLANs

We'll use a retail environment as an example for our VLAN design. Example.com has three VLANs as follows:

VLAN10 Data     - Default VLAN for most data types.
VLAN20 Voice    - VLAN for IP phones.
VLAN30 POS      - Dedicated VLAN for point of sale devices (cash register etc).

Example:

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#VLAN 10 
Switch(config-vlan)#name Data 
Switch(config-vlan)#VLAN 20
Switch(config-vlan)#name Voice
Switch(config-vlan)#VLAN 30
Switch(config-vlan)#name POS
Switch(config-vlan)#end

Again, consider writing a template in an editor and pasting the commands.

  • Create and name your 3 VLANs on every switch.
  • Verify your configuration with the "show vlan" command.
Core1#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    
10   Data                             active    
20   Voice                            active    
30   POS                              active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0   
10   enet  100010     1500  -      -      -        -    -        0      0   
20   enet  100020     1500  -      -      -        -    -        0      0   
30   enet  100030     1500  -      -      -        -    -        0      0   
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------
 
Core1#

Default STP behaviour with multiple VLANs

  • Use the "show spanning-tree" command on each switch.

Notice that the command now provides STP information for each of the VLANs you created. The Cisco switches default to creating a seperate STP instance for every VLAN. This is known as PVST (Per VLAN Spanning Tree). Each instance of STP will create the same topology because all instances share the same default infomation (Priority, MAC address, port ID, bandwidth of links). This results in some links carrying no traffic which is inefficient.

Manipulating the root bridge

The root bridge is the device at the centre of the Tree. Consequently traffic often has to traverse the root bridge to get to it's destination. At layer 3 (IP) traffic has to go via it's default gateway to get to most destinations. For this reason it makes sense to have the root bridge and the router (Layer 3 switch) as the same device. In otherwords it is usual to configure the Distribution Layer switches as the STP root.

Setting the Primary Root Bridge

We'll make Distribution1 the root bridge for VLANs 10 and 30 and Distribution2 the root bridge for VLAN 20. This will give us two Spanning Tree topologies and allow us to dedicate the router on Distribution2 for Voice packets ensuring adequate performance to deliver the Quality of Service required by Voice.

  • On Distribution1 issue the following configuration commands:
spanning-tree vlan 10 root primary
spanning-tree vlan 30 root primary
  • On Distribution2 issue the following configuration commands:
spanning-tree vlan 20 root primary

Setting a backup root bridge

In the event that one of our Distribution Layer Switches fails, we want to avoid having an Access Layer switch the root of our Spanning Tree as this will result in inefficient traffic paths. To prevent this, configure the Distribution switches to act as a backup root bridge for the others VLANs.


  • On Distribution1 issue the following configuration commands:
spanning-tree vlan 20 root secondary
  • On Distribution2 issue the following configuration commands:
spanning-tree vlan 10 root secondary
spanning-tree vlan 30 root secondary

Verify the modified STP behaviour

  • Take time to examine the output of:
show spanning-tree

On each switch.

Pay particular attention to:

  • The root bridge on each VLAN.
  • The STP priority for each VLAN.
  • The difference between the topologies for VLANs 10&30 and 20.

Manipulating individual link behaviour

While the selection of the root bridge has the greatest impact on the topology, fine control over individual links can be achieved using the "spanning-tree cost" or "spanning-tree port-priority" interface commands.

For Example:

Switch(config)# interface gigabitEthernet 0/0
Switch(config-if)# spanning-tree cost 10
  • Use the commands to influence which links between Distribution1 and Access1 are used to carry traffic.

Things to think about:

  • Port cost and Port priority can achieve the same result. Why use one or the other?
  • Which side of the link needs to be configured to effect a change? The side where you want the change to occur or the opposite side?
  • Why should you configure both sides of a link when only one side seems to have an impact?

Discuss the above with your instructor if you are unsure

Solution for STP topology

Annotated topology showing STP port states for default root bridge