Tuesday, February 11, 2014

STP Root Bridge Election, STP Root Port Election, STP Designated Port Election, STP Priority, STP Cost, STP Port-Priority


Lessons learned:

How STP works.
·         Elect one root bridge
·         Elect one root port per bridge
·         Elect designated ports

First task of Spanning-tree is to find out who is the root bridge and from that you can determine the forwarding path for the network
Once the root bridge is elected each device selects the port that is closest to the root bridge this is called the “root port”
To forward upstream. Any downstream ports will be set as designated ports or blocking.

The Root bridge election –
The switch with the lowest bridge ID in the network becomes the root bridge. This bridge ID is based on three different fields.

The bridge priority – ID numbers from 0 to 61440 in increments of 4096
The system ID extension – 0 – 4095
The MAC address

Only the bridge priority is the only one that can be manually modified. The lower the Number the higher  the priority, and the chance the become the root bridge.
The reason for increments of 4096 is to allow for the system ID extension which in the case of Per-Vlan STP is basically the VLAN number.

Take the configure priority and add the system ID extension – which give the bridge it’s overall priority number. Also in a per-vlan instance of STP the MAC address doesn’t not change so the
System ID extension is used as the  “MAC reduction feature”. This means that you don’t need a separate MAC address allocated for each instance of spanning-tree.

Manually change the bridge priority
# Spanning-tree vlan (vlan) Priority  - Lower is better
You can also use the root bridge Macro.
# spaning-tree vlan (vlan) root (primary | Secondary) – this sets the local priority based on the current root priority.
Once you issue this command for a certain vlan – this will set that VLANS priority lower that the currently configures root BID. This option is basically a short cut so you don’t have to remember the currently configure root BID values.

Verification:
# show spanning-tree vlan (vlan)
# show Spanning-tree root

Exmaple:
# sh spanning-tree vlan 10

This top field pertains to the ROOT Bridge

VLAN0010
  Spanning tree enabled protocol rstp
  Root ID    Priority    24586              === shows the current BID for root.
             Address     001c.586c.5840  === MAC address
             This bridge is the root            === Show that this is the root bridge for VLAN 10
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec  === Spanning tree timers, inherited from root bridge.

NOTE: The bridges in the rest of the network will only use the timers that the root bridge is setting


The bottom portion of this  field id the local values?

  Bridge ID  Priority    24586  (priority 24576 sys-id-ext 10) the bridge priority plus the system ID extension (the VLAN – Vlan 10)
             Address     001c.586c.5840   === MAC address
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Note: the priority value will be the same unless modified. The root bridge

The default STP is per-Vlan STP +
This means we’re running a separate election and instance per every Vlan in the environment.

Output from a NON-ROOT STP Instance:


VLAN0010

 Root ID    Priority    24586
    Address     001c.586c.5840
    Cost        3                                = this is the calculated cost to reach the root.
    Port        1312 (Port-channel32)=This is the root port. The port that connects upstream to the root of the A STP
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

Note: The Root port is ALWAYS facing upstream towards the root. Where the designated port is always facing downstream away from root.
The switch by default with the lowest MAC address will normally be elected the Root Bridge. The problem with this is that this is normally the older switches in the network.

Note:
On the root bridge each port will be set as a designated port and all ports should be forwarding downstream. It doesn’t mean all links will be used for traffic, they will however all receive BPDU’s and could potentially have MAC addresses installed in the CAM table.
Devices Downstream from the root bridge – will determine what the forwarding path is.  The root is simply a reference point that other devices used to build the spanning-tree.

Cost Values:

Traffic to root will always follow the lowest cost path to reach root. The cost is a cumulative over all links to the root and based on link type. The links with the lowest cost will be elected the designated port. If there ends up a tie – then the switches will fall back to their own bridge ID

Bandwidth
OLD STP Value
New STP Value
10 MB
100
2,000,000
100MMbps
19
200,000
1GB
4
20,000
10GB
2
2,000
100GB
NA
2000
1Tbbs
NA
20
Port-channels

12 (depends on how many members are in channel (this example reflects 200Mb or 2 100MB links)


Diving deeper into STP (rstp in this case)
# sh spanning-tree vlan 10 detail
This will show all the spanning-tree information for VLAN 10. This will also show all possible paths to get to the Root and their state.

VLAN0010 is executing the rstp compatible Spanning Tree protocol
  Bridge Identifier has priority 28672, sysid 10, address 001c.586c.57c0     à The local switch information – Shows a priority of 28672, Sys-ID of 10 (vlan10) and MAC Address.
  Configured hello time 2, max age 20, forward delay 15, transmit hold-count 6   à Local Timers
  Current root has priority 24586, address 001c.586c.5840               à Root Bridge
  Root port is 1312 (Port-channel32), cost of root path is 3              à Total Cost to root
  Topology change flag not set, detected flag not set
  Number of topology changes 134 last change occurred 02:45:22 ago
          from Port-channel32
  Times:  hold 1, topology change 35, notification 2
          hello 2, max age 20, forward delay 15
  Timers: hello 0, topology change 0, notification 0, aging 300

Port 1 (TenGigabitEthernet1/1) of VLAN0010 is alternate blocking
   Port path cost 2, Port priority 128, Port Identifier 128.1.               à Underlined is local switch cost to get to root. The Root port
   Designated root has priority 24586, address 001c.586c.5840
   Designated bridge has priority 32778, address 44d3.ca58.1d00
   Designated port id is 128.109, designated path cost 2
   Timers: message age 16, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   Link type is point-to-point by default
   BPDU: sent 9, received 4327407             à BPDU’s  sent / received on the interface

Port 258 (GigabitEthernet3/2) of VLAN0010 is designated forwarding
   Port path cost 4, Port priority 128, Port Identifier 128.258.
   Designated root has priority 24586, address 001c.586c.5840
   Designated bridge has priority 28682, address 001c.586c.57c0  Notice this is the same MAC The switch is using (this means I’m the DP)
   Designated port id is 128.258, designated path cost 3
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 3
   Link type is point-to-point by default
   BPDU: sent 4344298, received 3306      à BPDU’s  sent / received on the interface


Note: the easiest way to change the Priority for root is to use the build in Macro.
Remember the switch will look for the lowest total cost out all of its uplinks to find the patch to root. If there’s a tie in the cost
The switch will then look at the neighbors Bridge ID ( Priority, system ID and MAC address) and the neighbors port ID (based on Port ID and port number).
The only real time you would use the port ID in the calculation is if you have multiple links to the upstream switch.

Note: For the most pat you would always use the cost to affect the selection. The cost is an inverse function of the bandwidth, when the bandwidth goes up the cost will go down.
Ex: The uplink changes from a Fast Ethernet to a gig interface, the bandwidth just went up.

The Designated port election:

Designated ports are downstream facing away from the Root bridge.
Election is based on.
1.lowest root path cost
2.Lowest Bridge ID
3.Lowest Port ID
All other ports go into blocking mode.
They:
Receive BPDU’s
Discard all other traffic
Cannot send traffic.

To change the ports role:
Best practice is to use the cost value.
To modify the ports cost
# spanning-tree (vlan) cost (number value)
(can also change the bandwidth on the port to change the cost)
Modify the bridge ID:
#spanning-tree vlan (vlan) priority
Modify the port ID:
#spanning-tree vlan (vlan) port-priorty

Verifaciton:
# sh spanning-tree interface (int) detail
#sh spaning-tree vlan (vlan) detail


No comments:

Post a Comment