The main advantage of VMware virtual distributed switch (VDS) over VMware virtual standard switch (VSS) is the centralized configuration which is pushed to ESXi hosts. This centralized management provides uniform virtual switch configuration across all ESXi hosts in VDS scope. Virtual switch specific settings can be generally reconfigured for each port-group. In other words, port-group is a virtual switch construct which defines how particular group of ports will behave. Port-groups inherit default settings from virtual switch.
So far so good. However, VDS and SVS differ. In VDS, you can change default settings of the switch and all port-groups on that particular switch inherit these settings. However, this is not possible on VDS. Actually, it is not possible through vSphere Client. Through, GUI you can change just settings of particular port-group as you can see on screenshot below.
It is very annoying and time consuming to change settings for each port-group manually. There is also very high probability of inconsistent settings across port-groups. To mitigate challenges described above, you can leverage PowerCLI and change default VDS settings (policy) as you can see in the example below. This will change default VDS settings and all new port-groups will be configured consistently and as required by particular design.
PowerCLI script below shows how to change default settings for traffic Shaping (in/out) and uplink teaming policy to LACP. This particular example shows how to configure LAG teaming with IP src/dst load balancing but any other teaming and load balancing can be used as well.
Another example reconfigures default DVS policy to VMware Load Based Teaming (aka LBT).
VDS supports following teaming policies (source: vSphere Documentation)
Please, note that examples above have to be altered to fulfill your particular needs but now you should have a pretty good idea how to change the default DVS.
So far so good. However, VDS and SVS differ. In VDS, you can change default settings of the switch and all port-groups on that particular switch inherit these settings. However, this is not possible on VDS. Actually, it is not possible through vSphere Client. Through, GUI you can change just settings of particular port-group as you can see on screenshot below.
DVS port-group various settings. |
It is very annoying and time consuming to change settings for each port-group manually. There is also very high probability of inconsistent settings across port-groups. To mitigate challenges described above, you can leverage PowerCLI and change default VDS settings (policy) as you can see in the example below. This will change default VDS settings and all new port-groups will be configured consistently and as required by particular design.
PowerCLI script below shows how to change default settings for traffic Shaping (in/out) and uplink teaming policy to LACP. This particular example shows how to configure LAG teaming with IP src/dst load balancing but any other teaming and load balancing can be used as well.
$vDSName = “vDS01”
$vds = Get-VDSwitch $vDSName
$spec = New-Object VMware.Vim.DVSConfigSpec
$spec.configVersion = $vds.ExtensionData.Config.ConfigVersion
$spec.defaultPortConfig = New-Object VMware.Vim.VMwareDVSPortSetting
$inShapingPolicy = New-Object VMware.Vim.DVSTrafficShapingPolicy
$inShapingPolicy.Enabled = New-Object VMware.Vim.BoolPolicy
$inShapingPolicy.AverageBandwidth = New-Object VMware.Vim.LongPolicy
$inShapingPolicy.PeakBandwidth = New-Object VMware.Vim.LongPolicy
$inShapingPolicy.BurstSize = New-Object VMware.Vim.LongPolicy
$inShapingPolicy.Enabled.Value = $true
$inShapingPolicy.AverageBandwidth.Value = 1000000000
$inShapingPolicy.PeakBandwidth.Value = 5000000000
$inShapingPolicy.BurstSize.Value = 19200000000
$inShapingPolicy.Inherited = $false
$outShapingPolicy = New-Object VMware.Vim.DVSTrafficShapingPolicy
$outShapingPolicy.Enabled = New-Object VMware.Vim.BoolPolicy
$outShapingPolicy.AverageBandwidth = New-Object VMware.Vim.LongPolicy
$outShapingPolicy.PeakBandwidth = New-Object VMware.Vim.LongPolicy
$outShapingPolicy.BurstSize = New-Object VMware.Vim.LongPolicy
$outShapingPolicy.Enabled.Value = $true
$outShapingPolicy.AverageBandwidth.Value = 1000000000
$outShapingPolicy.PeakBandwidth.Value = 5000000000
$outShapingPolicy.BurstSize.Value = 19200000000
$outShapingPolicy.Inherited = $false
$uplinkTeamingPolicy = New-Object VMware.Vim.VmwareUplinkPortTeamingPolicy
$uplinkTeamingPolicy.policy = New-Object VMware.Vim.StringPolicy
$uplinkTeamingPolicy.policy.inherited = $false
$uplinkTeamingPolicy.policy.value = “loadbalance_ip”
$uplinkTeamingPolicy.uplinkPortOrder = New-Object VMware.Vim.VMwareUplinkPortOrderPolicy
$uplinkTeamingPolicy.uplinkPortOrder.inherited = $false
$uplinkTeamingPolicy.uplinkPortOrder.activeUplinkPort = New-Object System.String[] (1) # designates the number of uplinks you will be specifying.
$uplinkTeamingPolicy.uplinkPortOrder.activeUplinkPort[0] = "LAG01"
$spec.DefaultPortConfig.InShapingPolicy = $inShapingPolicy
$spec.DefaultPortConfig.OutShapingPolicy = $outShapingPolicy
$spec.DefaultPortConfig.UplinkTeamingPolicy = $uplinkTeamingPolicy
$vds.ExtensionData.ReconfigureDvs_Task($spec)
Another example reconfigures default DVS policy to VMware Load Based Teaming (aka LBT).
Import-Module VMware.VimAutomation.vds
$vDSName = “test”
$vds = Get-VDSwitch $vDSName
$spec = New-Object VMwareåç.Vim.DVSConfigSpec
$spec.configVersion = $vds.ExtensionData.Config.ConfigVersion
$spec.defaultPortConfig = New-Object VMware.Vim.VMwareDVSPortSetting
$uplinkTeamingPolicy = New-Object VMware.Vim.VmwareUplinkPortTeamingPolicy
$uplinkTeamingPolicy.policy = New-Object VMware.Vim.StringPolicy
$uplinkTeamingPolicy.policy.value = “loadbalance_loadbased”
$spec.DefaultPortConfig.UplinkTeamingPolicy = $uplinkTeamingPolicy
$vds.ExtensionData.ReconfigureDvs_Task($spec)
VDS supports following teaming policies (source: vSphere Documentation)
- failover_explicit
- loadbalance_ip
- loadbalance_loadbased
- loadbalance_srcid
- loadbalance_srcmac
Please, note that examples above have to be altered to fulfill your particular needs but now you should have a pretty good idea how to change the default DVS.