Configure default settings on a VMware virtual distributed switch

If the portgroups on your VMware virtual distributed switch (vDS) need to have specific settings in order to work, you may want to set the defaults so that you don’t need to manually modify them each time a new one is created, which can lead to inconsistencies in the environment. For example, etherchannel is used in my environment so the portgroups must be configured according to http://kb.vmware.com/kb/1001938.

Unfortunately, when vCloud creates portgroups, it will honor all of the settings on the ‘Teaming and Failover’ page except for the uplinks. vCloud portgroups are always created with one active uplink and one standby uplink. I’ll describe how that can be resolved in an upcoming post.

Here is the PowerCLI script that will set the ‘Teaming and Failover’ defaults on the vDS to work with etherchannel and two active uplinks.

# Configure uplinks. If an uplink is not specified, it is placed into the ‘Unused Uplinks’ section.$uplinkTeamingPolicy.uplinkPortOrder = New-Object VMware.Vim.VMwareUplinkPortOrderPolicy$uplinkTeamingPolicy.uplinkPortOrder.inherited = $false$uplinkTeamingPolicy.uplinkPortOrder.activeUplinkPort = New-Object System.String[] (2) # (#) designates the number of uplinks you will be specifying.$uplinkTeamingPolicy.uplinkPortOrder.activeUplinkPort[0] = “dvUplink1”$uplinkTeamingPolicy.uplinkPortOrder.activeUplinkPort[1] = “dvUplink2”