NX-OS – Layer 2 Redudancy

By | July 3, 2014

Layer 2 redundancy protocols exist to prevent loops from broadcasts and do so using BPDU packets.  These protocols include:

STP – Spanning Tree Protocol – 802.1D
RSTP – Rapid Spanning Tree Protocol – 802.1W
MSTP – Multiple Spanning Tree Protocol  – 802.1S
LAN Port Channeling – Also known as EtherChannels to bind multiple ports together.

There are 4 steps to spanning tree protocol:

  1. Elects a root bridge (root/primary switch) and creates designated ports that forward traffic (Designated Forwarding)
  2. Each non root bridge (exterior switches connected to the root switch) gets a root port elected (1 per non root bridge) that forwards.
  3. One designated port per segment (switches not directly connected to the root switch/bridge) gets elected.
  4. All other interconnected ports become non-designated AKA blocked.

The root bridge/switch gets elected by having the lowest Bridge ID.  The default priority is made up of 4 bits and comes to 32768.  The Extended Sys ID which is 12 bits and correlates to the VLAN ID gets tacked on along with the MAC address bits to determine the total value of the Bridge Priority ID:

Priority bits + Extended Sys ID (VLAN) + MAC = 8 bytes which is the Bridge ID.  By lowering the priority value we increase the chance of it being elected as root.

Other switches that are not the root bridge decide which interconnected links to use based on cost which is determined by Bandwidth:

10 Mbps = 100 cost
1 Gbps = 4 cost
10 Gbps = 2 cost

If the cost is the same for both ports it will tie break based on things including the interface ID if necessary.  When a port needs to change from blocking to forwarding in the event a link goes down, it goes through different states before forwarding:

  1. Turns Blocking off
  2. Moves into a Listening state (15 seconds)
  3. Changes to a Learning state (15 seconds)
  4. Finally Transitions to a Forwarding state

Due to the timers and the huge delay STP is rarely used in modern data centers which is why RSTP is used.  Rapid Spanning Tree Protocol improves things by removing the timers and uses a proposal and agreement process instead.  The port states become:

  1. Forwarding – The forwarding stage
  2. Discarding – The blocking stage
  3. Learning – The transition stage

Which will allow for quicker failover and convergence.  You can also assign port roles such as Alternate ports so the port can more quickly take over as needed.  This will be used as a quickly converging backup port.  RSTP also fixed Topology change notifications by allowing a topology change notification to bypass the root bridge and notify other switches on its own.

MSTP (Multi Spanning Tree Protocol) was introduced to allow multiple spanning tree topologies as needed based on what you prefer.  You could do multiple for multiple VLANs or just a couple of them for all VLANs.  The commands needed to configure Spanning Tree can be found below:

config t
spanning tree mode rapid-pvst - For standard RSTP.
spanning tree mode mst - for Multiple Spanning tree

show spanning tree summary - confirms mode

conf t
int e2/3
spanning-tree port type port-type - Where edge ports are used for servers, network ports are used for inter switch links, and normal to use normal spanning tree.  Edge or Network should be specified as one or the other depending on what was connected.

conf t
spanning-tree vlan 10 priority 4096 - Would dramatically lower the priority for RSTP on VLAN10 and ensure the device is used as the root bridge.  Adding to this value should be done on secondary switches.

If you wanted to load balance and share bandwidth on two links you can use port channels as opposed to RSTP.  This can be done as long as the 2 links are going to the same interconnected switch you configure a port channel.  It tricks spanning tree into thinking the 2 links are actually one.  The protocol for this is called LACP (Link Aggregation Control Protocol).  An EtherChannel link can do Active/Passive or Active/Active based on your needs.