Wednesday, February 19, 2020

Spanning-Tree UplinkFast

Uplinkfast is a spanning-tree feature that was created to improve the convergence time. In this lesson we’ll take a look at how uplinkfast works. Here’s the topology that I will use to demonstrate it:

spanning tree uplinkfast topology
Three switches and SW1 is our root bridge. The fa0/16 interface on SW3 has been blocked. I’m only using VLAN 1 so nothing fancy here…
If we look at SW3 we see that the fa0/16 interface has been blocked and fa0/14 is the root port. Let’s see what happens with this topology when one of the links fails:
spanning tree uplinkfast link failure
When the fa0/14 interface on SW3 fails we’ll have to use fa0/16 to reach the root bridge. How long does it take for SW3 to make the transition? Let’s find out:
SW3#debug spanning-tree events 
Spanning Tree event debugging is on
SW3(config)#interface fa0/14
SW3(config-if)#shutdown
Now we’ll just wait for the magic to happen…
SW3#STP: VLAN0001 new root port Fa0/16, cost 38
SW3#STP: VLAN0001 Fa0/16 -> listening
SW3#STP: VLAN0001 Fa0/16 -> learning
SW3#STP: VLAN0001 Fa0/16 -> forwarding
BPDUs are originated from the root bridge so if we receive BPDUs on an interface the switch knows it can reach the root bridge on this interface. We have to go through the listening (15 seconds) and learning state (15 seconds) so it takes 30 seconds to end up in the forwarding state.
The good thing is that spanning-tree solves the link failure automatically but it also means that we have a downtime of 30 seconds. If you want you can tune the forward delay timer to speed up this process down to roughly 14 seconds.
SW3(config)#interface fa0/14
SW3(config-if)#no shutdown
Let’s restore connectivity first.
SW3(config)#spanning-tree uplinkfast
Now I’m going to enable spanning-tree uplinkfast. This is a global command, you can’t configure it on the interface level.
SW3(config)#interface fa0/14
SW3(config-if)#shutdown
SW3# STP: VLAN0001 new root port Fa0/16, cost 3038
SW3# %SPANTREE_FAST-7-PORT_FWD_UPLINK: VLAN0001 FastEthernet0/16 moved to Forwarding (UplinkFast).
Here’s the big difference. When uplinkfast is enabled a non-designated port will go to forwarding state immediately if the root port fails. Instead of 30 seconds downtime connectivity is restored immediately.
UplinkFast is useful but it will cause a problem with our MAC address tables. In the picture above I added two computers to our topology. Interface fa0/16 on SW3 is the non-designated port and fa0/14 is the root port. Take a look at the following topology:

spanning tree uplinkfast computers
Let me show you the MAC address tables for all switches:
SW1#show mac address-table dynamic 
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
   1    000c.2928.5c6c    DYNAMIC     Fa0/14
   1    000c.29e2.03ba    DYNAMIC     Fa0/17
SW2#show mac address-table dynamic 
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
   1    000c.2928.5c6c    DYNAMIC     Fa0/2
   1    000c.29e2.03ba    DYNAMIC     Fa0/14
SW3#show mac address-table dynamic 
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
   1    000c.2928.5c6c    DYNAMIC     Fa0/14
   1    000c.29e2.03ba    DYNAMIC     Fa0/3
Here are the MAC addresses of the computers:
  • H1: 000c.2928.5c6c
  • H2: 000c.29e2.03ba
spanning tree uplinkfast link failure 2
When the link between SW1 and SW3 fails, SW3 will use the fa0/16 interface immediately. However it will take 15 seconds for the topology change mechanism to age out the MAC address table!
SW2#show mac address-table dynamic 
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
   1    000c.2928.5c6c    DYNAMIC     Fa0/2
   1    000c.29e2.03ba    DYNAMIC     Fa0/14
Take a look again at the MAC address table for SW2. The MAC address (000c.29e2.03ba) that I highlighted belongs to H2. When SW2 receives an Ethernet Frame for H2 it will be forwarded to SW1 and it will be dropped! (Well at least for 15 seconds until the topology change mechanism kicks in…).
Of course we have a solution to speed this up, here’s what we will do:
spanning tree uplinkfast multicast
Once SW3 switches over to use its non-designated port it will create a dummy multicast frame. The source MAC address of this Ethernet Frame will be all the MAC addresses that it has in its MAC address table. In my example above this is only the MAC address of H2. The destination multicast address is a proprietary Cisco MAC address.
This multicast frame will be flooded to all other switches so they can update their MAC address tables right away.
Spanning-tree has saved the day again…anything else you need to know? What do you think will happen if I re-enable the fa0/14 interface on SW3 again (the original root port)?
spanning tree uplinkfast link restored
SW3(config)#interface fa0/14
SW3(config-if)#no shutdown
Let’s bring the interface back up. In my lab it’s not as exciting as in the picture…
SW3# STP: VLAN0001 Fa0/14 -> listening
SW3# STP: VLAN0001 Fa0/14: root port delay timer active
SW3# STP: VLAN0001 Fa0/14 -> blocking
SW3# STP: VLAN0001 new root port Fa0/14, cost 3019
SW3# STP: VLAN0001 Fa0/16 -> blocking (uplinkfast)
You can see we don’t immediately switch back to interface fa0/14. There’s no reason to switch back to this interface ASAP because we have a working root port. Even if we would switch back to interface fa0/14 right away we’d still have to wait because the fa0/17 interface on SW1 will have to go through the listening and learning state (which takes 30 seconds).
That’s all there is about spanning-tree uplinkfast. I hope this lesson has been useful!

No comments:

Post a Comment