Posey's Tips & Tricks
Introduction to Hyper-V Switch Embedded Teaming, Part 2
Brien answers some common questions related to Hyper-V's SET capability, from how to configure virtual machines to use SET to determining your load balancing algorithm.
In Part 1 of this series, I explained that Switch Embedded Teaming (SET) was introduced in Windows Server 2016 and demonstrated the procedure for using PowerShell to create a switch embedded team. In this installment, I want to show you a few other important things you need to know about SET.
Let's start with the question of use. Once you have created a switch embedded team, how do you configure your virtual machines (VMs) to use it?
As you may recall from my previous column, I created an embedded team in a virtual switch that I named SET. If you look at Figure 1, you can see the Virtual Switch Manager, which is a part of the Hyper-V Manager. Although I had to use PowerShell to create the virtual switch, it is available for use from within the Virtual Switch Manager.
Because the newly created virtual switch is being exposed through the Virtual Switch Manager, it is accessible to VMs in the usual way. If you look at Figure 2, for instance, you can see that I am attaching a virtual network adapter to a VM. When doing so, Hyper-V always asks which virtual switch you want to attach the virtual network adapter to. As you can see in the figure, I have the ability to choose the virtual switch named SET, which is linked to an underlying team of physical network adapters.
Another thing you may be wondering is what type of load balancing is being used by the virtual switch. In Part 1, I talked about the differences between Port Mode and Dynamic Mode, and yet I didn't reference either mode when I showed you how to create a switch embedded team. So how do you assign one of these modes to the virtual switch?
To configure a virtual switch's mode, you will have to delve back into PowerShell. Once again, though, Microsoft makes the process relatively painless.
From an elevated PowerShell window, enter the Get-VMSwitchTeam cmdlet, followed by the name of the virtual switch that you want to configure. In my case, the virtual switch was named SET, so the command that I am using is:
Get-VMSwitchTeam -Name SET | Format-List
You can see the command's output in Figure 3.
If you look at the LoadBalancingAlgorithm field in the figure above, you will notice that the load balancing algorithm is set to Dynamic. Even though I didn't specify a load balancing algorithm when I created the virtual switch, Hyper-V used Dynamic Mode by default.
In the vast majority of cases, Dynamic should be your load balancing algorithm of choice. In fact, if you are ever in doubt as to which algorithm to use, I would recommend using Dynamic.
Since Dynamic Mode is appropriate for most situations, you normally won't even have to worry about setting the virtual switch to use a different load balancing algorithm. If you do decide to switch algorithms, however, you can use the Set-VMSwitchTeam cmdlet to do so. Just specify the name of the team that you want to modify and the load balancing algorithm you want to use. The load balancing algorithm names (as used by PowerShell) are Dynamic and HyperVPort. Here are a couple of examples of how to change the load balancing algorithm:
Set-VMSwitchTeam -Name SET -LoadBalancingAlgorithm HyperVPort
Set-VMSwitchTeam -Name SET -LoadBalancingAlgorithm Dynamic
Figure 4 shows what it looks like when you change the load balancing algorithm. Remember, if you are ever in doubt as to which algorithm is being used, you can use the Get-VMSwitchTeam cmdlet to find out.
One last thing that I want to mention is that when you change a virtual switch's load balancing algorithm, the change may not be immediate. If you look at the figure above, you will notice that at first, the load balancing algorithm seems not to have changed despite the fact that there was no error message. I simply waited for about a minute and then executed the Get-VMSwitchTeam cmdlet again. This time my change was reflected in the results.
Brien Posey is a 20-time Microsoft MVP with decades of IT experience. As a freelance writer, Posey has written thousands of articles and contributed to several dozen books on a wide variety of IT topics. Prior to going freelance, Posey was a CIO for a national chain of hospitals and health care facilities. He has also served as a network administrator for some of the country's largest insurance companies and for the Department of Defense at Fort Knox. In addition to his continued work in IT, Posey has spent the last several years actively training as a commercial scientist-astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space. You can follow his spaceflight training on his Web site.