Post Image

Cisco Set Switch Stack Priority

When managing a switch stack it is beneficial to know what switch is the master, and reliably and consistently be able to predict what switch will be elected the master and in the event you need to shut down the master in order to replace it or it fails, you know what switch will be elected next. In this post I will walk you through how to check what switch is the master, rig the stack master election, and how to remove a master switch without affecting the rest of the stack operations.

 

Check Master Switch

Checking what switch is the master in the stack is very easy and can be done by issuing the following command

show switch

And you will see output similar to below.

Switch/Stack Mac Address : d0d0.fda0.0000
                                           H/W   Current
Switch#  Role   Mac Address     Priority Version  State
----------------------------------------------------------
 1       Member 3c08.f650.8180     1      3       Ready
*2       Master d0d0.fda0.0000     15     1       Ready
 3       Member 7c69.f659.b500     1      3       Ready
 4       Member f866.f2a0.af80     1      3       Ready

The key here is you want to look for the entry that has the asterisk next to it and says "Master" in the role column, that is the stack master so in this example we can see that switch 2 in the stack is the master switch. The reason in this example that switch 2 is the master is because of the priority, but I will get into that further in a moment.

 

Specify a Specific Switch to be the Master Node

During the boot sequence of a switch there is a part during boot that the switch checks for other switches that are in the stack ring and if any are detected it holds a stack master election where the switches elect a master, this is based on the user set priority first which is what was in the table above, and if those priorities match it goes onto other metrics such as uptime and feature sets. The priority is the key here because that is set by the user and is how we can rig the stack master election to consistently elect the switch we want.

 

To do this we issue the command

$ switch # priority #

And the priorities range from 15 to 1, 15 being the switch that will be elected master every time assuming it is booting at the same time as the rest of the stack.

 

In the configuration below I set switches 1-4 in priorities 15-12.

witch(config)#switch 2 priority 14
Changing the Switch Priority of Switch Number 2 to 14
Do you want to continue?[confirm]
New Priority has been set successfully

Switch(config)#switch 3 priority 13
Changing the Switch Priority of Switch Number 3 to 13
Do you want to continue?[confirm]
New Priority has been set successfully

Switch(config)#switch 4 priority 12
Changing the Switch Priority of Switch Number 3 to 12
Do you want to continue?[confirm]
New Priority has been set successfully

Switch(config)#switch 1 priority 15
Changing the Switch Priority of Switch Number 1 to 15
Do you want to continue?[confirm]
New Priority has been set successfully

Switch(config)#

And if we take a look at the output of show switch again

Switch/Stack Mac Address : d0d0.fda0.0000
                                           H/W   Current
Switch#  Role   Mac Address     Priority Version  State
----------------------------------------------------------
 1       Member 3c08.f650.8180     15     3       Ready
*2       Master d0d0.fda0.0000     14     1       Ready
 3       Member 7c69.f659.b500     13     3       Ready
 4       Member f866.f2a0.af80     12     3       Ready

And as you can see the priorities are set properly however the master remains the same. That is because as I referenced above the stack master election happens during the boot sequence so we need to reboot the switch in order to cause the master to change.

Switch#reload

System configuration has been modified. Save? [yes/no]: y
Proceed with reload? [confirm]
Switch#

 

If you have a console cable and physical access to the switch, connect to it and on your terminal emulator watch for the following output and you will be able to see the stack master election.

Waiting for Stack Master Election...
SM: Waiting for other switches in stack to boot...
#####################################
SM: All possible switches in stack are booted up

***Some Output Omitted***

Election Complete
Switch 1 booting as Master

 

And once the switches finish booting you can log back in and issue show switch again and see that switch1 is now the master.

Switch/Stack Mac Address : d0d0.fda0.0000
                                           H/W   Current
Switch#  Role   Mac Address     Priority Version  State
----------------------------------------------------------
*1       Master 3c08.f650.8180     15     3       Ready
 2       Member d0d0.fda0.0000     14     1       Ready
 3       Member 7c69.f659.b500     13     3       Ready
 4       Member f866.f2a0.af80     12     3       Ready

And now that we have specified the priority of all switches we can easily see that if we remove switch 1 or it dies, a stack master election will be caused and switch 2 will be elected as master if it is still up.

 

Considerations when Removing the Stack Master

 

Assumptions

You have up links over multiple switches in the stack in a port channel or spanning tree configuration so decommissioning or failure of the stack master does not cause the up link of the device to go down completely.

 

I have mentioned a few times about a reelection when the master is for whatever reason removed from the stack. In that case the management interface of the stack will go down for the re election so things like monitoring might lose a few pings however the re election typically happens within 15 - 60 seconds and in my experience traffic will still be switched during that time over the remaining nodes.

If you are removing the master switch in a controlled situation like a replacement of the node or decommissioning that node for whatever reason it is not a big deal I highly recommend following the procedure below.

  1. Power down the master switch
    1. This causes a stack master re election which you can typically see via the link lights blinking in unison. Wait til this is complete.
  2. Remove the stack cables from the master switch and the other ends from the switches they connect to
  3. Re connect the stack cables to the rest of the stack and validate the stack ring is running in "full" and not "half"
    1. There will be 1 port available on 2 switches of your stack, connect a cable between those 2 ports. It should be stack port 1 of one switch, and stack port 2 of the other.
  4. Finish decommission or swap
  5. If you are swapping re break the stack cables where inserting the switch using the extra stack cable you have from step 3.

If you follow that procedure and ONLY disconnect stacking cables that are connected to the master switch that you are removing and you will not cause disruption to any traffic running across the rest of the stack.

 

I hope that clears up some of the mystery for you in regards to Cisco stacks, their stack master elections, and working with the stacks in relation to the stack master. Most of the things I touched on here are non impactful to do ahead of time other than the reboot and swap of a device if it has devices on it of course. If things are still unclear feel free to leave a comment so I can clear things up!

 

 



Comments (0)
Leave a Comment