posted

0 Comments

powercli 5.8 iconWelcome to another episode of our Virtual SAN Troubleshooting series. In our last article we detailed guidelines and troubleshooting steps around the Virtual SAN networking requirement for layer 2 multicast. In today’s article we will show you how to quickly automate the modification of the Virtual SAN multicast group address in the event the need arises.

Requirements

  • PowerCLI 5.8 release 1
    – (Note: It is likely to work with PowerCLI version 5.5 or above however I just happened to have version 5.8 on my test system).
  • Microsoft .Net 2.0 or higher

Here is a one-line code example where we target a single host:

In the example above, you can see it would is quite easy to just pop into the PowerCLI  shell and paste the command (after modifying values to your choosing of course). Once you set the appropriate values, you can reuse this same command string for your other hosts as well. All you have to do is update the host IP following the -Server parameter (e.g. Change “192.168.100.1” to “192.168.100.2”).

The other values to modify are included in parenthesis at the end of the command string and need to remain in the following order:

agentmcaddr, agentmcport, interfacename, mastermcaddr, mastermcport, multicastttl

Notice I am using the Get-EsxCli cmdLet to modify this change. If you are not familiar with the Get-EsxCli cmdLet, head on over to the vSphere PowerCLI Reference and check it out. It is quite the powerful cmdLet.

Creating a loop

A very quick and easy method to modify multiple hosts is to simply create multiple copies of the one-line command string and simply modify the host IP address in each line as in the example below:

If you have a large number of servers or need to introduce more logic for other tasks, a proper script may be more suited to your solution. In the example below we display how to run this command string on a multiple number of hosts using the PowerShell Foreach-Object cmdlet. I have left out the usual add-snapin statements that load the environment for ease of reading.

Check out the comments within the script for an explanation of each step.

There are other avenues to modifying the multicast group addresses for Virtual SAN hosts. This is one functional example but do not hesitate to use any option that suits your scenario and experience (Esxcli, RVC, PowerCLI, etc.).

Happy scripting!

Disclaimer: Actual code examples from this article may or may not be officially supported by VMware. Please validate supportability and attempt first in a test environment before attempting anything in a production setting.


Resources

Changing the multicast address used for a VMware Virtual SAN Cluster (2075451)

VMware vSphere 5.5 Documentation Center: vSphere PowerCLI Reference: Get-EsxCLI