Rawpixel - Fotolia

Tip

Manage Switch Embedded Teaming in Windows Server 2016 Hyper-V

You can create and manage a Switch Embedded Team in Hyper-V using just a few PowerShell commands, but there are specific requirements and limitations you should be aware of.

Although VM switches have been part of Hyper-V since its initial release, Microsoft has made a significant change in Windows Server 2016. Hyper-V now supports the use of Switch Embedded Teaming.

Normally, an external Hyper-V VM switch is bound to a physical network adapter within the host server. This allows VMs that are bound to the VM switch to communicate with the outside world through the associated network interface card (NIC).

Windows Server has also long-supported NIC teaming, which allows multiple physical NICs to be bound together into a logical NIC. It's then possible to bind a Hyper-V VM switch to this NIC team.

Managed Switch Embedded Teaming is different. Rather than a switch being attached to a NIC team, the NIC team exists as a part of the switch.

There are several differences between a NIC team and a Switch Embedded Team. One key difference is that a Switch Embedded Team supports two types of load balancing: Hyper-V Port and Dynamic. Hyper-V Port mode uses the switch port and the media access control address to load balance traffic. Dynamic mode rebalances outbound loads in real time based on a hash of the TCP port and IP address, and it handles inbound traffic in the same way as Hyper-V Port mode.

Create a Switch Embedded Team

There are a couple of things you need to know before creating a Switch Embedded Team. First, this technique only works on hosts running Windows Server 2016 Hyper-V. Older versions of Windows Server don't support Switch Embedded Teaming.

The other thing you need to know is that you can't add a Switch Embedded Team to an existing virtual switch. If you plan to use Switch Embedded Teaming, then you have to create the team as you create the switch.

Given those caveats, it isn't surprising that the first step in creating a Switch Embedded Team is to create a new VM switch. However, the method of doing so might be a little different than what you are used to. Switch Embedded Teaming isn't exposed through the Hyper-V Manager, so you have to create the VM switch through PowerShell.

Switch Embedded Teaming isn't exposed through the Hyper-V Manager, so you have to create the VM switch through PowerShell.

The PowerShell cmdlet used to create a new VM switch is New-VMSwitch. Any time you use this cmdlet to create a VM switch -- even if you aren't setting up a team -- you must specify a name for the new VM switch and the name of the physical network adapter that you want to bind to the switch.

As such, the first step in the process is to retrieve the names of your physical network adapters. You can get the adapter names by using the following command:

Get-NetAdapter | Select-Object Name, InterfaceDescription

The command listed above will prompt PowerShell to list the name and a description for every physical and virtual network adapter in the system. The interface description can be used to differentiate between physical and virtual adapters.

Switch Embedded Teaming brings together between two and eight physical adapters. Because you can't create a team with fewer than two adapters, you must specify at least two adapters when you create the VM switch.

You must also set the EnableEmbeddedTeaming parameter to $True. Below is an example of what such a command might look like. Keep in mind that you need to substitute your own NIC names for NIC 1 and NIC 2.

New-VMSwitch -Name EmbeddedTeamSwitch -NetAdapterName "NIC 1","NIC 2" -EnableEmbeddedTeaming $True

Manage a Switch Embedded Team

Switch Embedded Team management is accomplished using the Set-VMSwitchTeam cmdlet. There are two things you can do with this cmdlet. One is to change the NICs associated with the virtual switch. All you have to do is specify the VM switch name and the names of the adapters you want to use.

For example, if you want the switch to use NIC 4 and NIC 5 -- and no other NICs -- use the following command:

Set-VMSwitchTeam -Name EnbeddedTeamSwitch -NetAdapterName "NIC 4","NIC 5"

Another thing you can do with the Set-VMSwitchTeam cmdlet is change the load balancing type. To do so, just specify the name of the VM switch and then set the -LoadBalancingAlgorithm to either HyperVPort or Dynamic. Here is an example:

Set-VMSwitchTeam -Name EmbeddedTeamSwitch -LoadBalanchingAlgorithm HyperVPort

Even though Switch Embedded Teaming is relatively easy to use, it's a good idea to familiarize yourself with the Microsoft documentation, especially if you use Remote Direct Memory Access interfaces.

Dig Deeper on IT systems management and monitoring