So far so good. However DVS and SVS differs. In SVS, 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 DVS. 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 DVS settings (policy) as you can see in example below. This will change default DVS settings and all new port-groups will be configured consistently and as required by particular design.
PowerCLI script below shows how to to change default settings for traffic Shaping (in/out) and uplink teaming policy. 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 = "LAG01"
$spec.DefaultPortConfig.InShapingPolicy = $inShapingPolicy $spec.DefaultPortConfig.OutShapingPolicy = $outShapingPolicy $spec.DefaultPortConfig.UplinkTeamingPolicy = $uplinkTeamingPolicy
Please, note that example above has to be altered to fulfill your particular needs but now you should have pretty good idea how to achieve it.