How to Configure Windows Server 2016 Virtual Switch

A Hyper-V Virtual Switch is a software-defined network switch that provides Layer 2 connectivity between virtual machines and between VMs and physical networks. In Windows Server 2016, the Hyper-V Virtual Switch has been extended with features like switch-embedded teaming (SET), network virtualization, and quality of service (QoS) policies. Understanding virtual switch types and configuration is essential for any Hyper-V deployment.

Virtual Switch Types

There are three types of virtual switches in Hyper-V:

  • External: Connects VMs to the physical network through a physical NIC. VMs can communicate with the physical network and external hosts.
  • Internal: Allows communication between VMs and the Hyper-V host, but not to the external network.
  • Private: Allows communication only between VMs on the same host. The host cannot communicate on this switch.

Step 1: List Available Network Adapters

Before creating a switch, identify available physical adapters:

Get-NetAdapter | Select-Object Name, InterfaceDescription, Status, LinkSpeed

Step 2: Create an External Virtual Switch

New-VMSwitch -Name "External-vSwitch" -NetAdapterName "Ethernet" -AllowManagementOS $true

The -AllowManagementOS parameter allows the Hyper-V host itself to use the switch for network communication. Set it to $false if you want to dedicate the adapter exclusively to VMs.

Step 3: Create an Internal Virtual Switch

New-VMSwitch -Name "Internal-vSwitch" -SwitchType Internal

After creating an internal switch, assign an IP address to the virtual NIC created on the host:

New-NetIPAddress -InterfaceAlias "vEthernet (Internal-vSwitch)" -IPAddress "10.0.0.1" -PrefixLength 24

Step 4: Create a Private Virtual Switch

New-VMSwitch -Name "Private-vSwitch" -SwitchType Private

Step 5: Configure Switch-Embedded Teaming (SET)

SET is a new feature in Windows Server 2016 that allows NIC teaming within a virtual switch for redundancy and bandwidth aggregation. Unlike traditional NIC teaming, SET integrates directly with Hyper-V:

New-VMSwitch -Name "SET-vSwitch" -NetAdapterName "Ethernet1", "Ethernet2" -EnableEmbeddedTeaming $true -AllowManagementOS $true

Verify SET configuration:

Get-VMSwitch -Name "SET-vSwitch" | Select-Object EmbeddedTeamingEnabled, NetAdapterInterfaceDescriptions

Step 6: Connect a VM to a Virtual Switch

Connect an existing VM’s network adapter to a virtual switch:

Connect-VMNetworkAdapter -VMName "VM01" -SwitchName "External-vSwitch"

Or add a new network adapter and connect it:

Add-VMNetworkAdapter -VMName "VM01" -SwitchName "Internal-vSwitch" -Name "InternalNIC"

Step 7: Configure VLAN Tagging

Assign a VLAN ID to a VM’s network adapter for network segmentation:

Set-VMNetworkAdapterVlan -VMName "VM01" -VMNetworkAdapterName "Network Adapter" -Access -VlanId 100

For trunk mode (multiple VLANs on one adapter):

Set-VMNetworkAdapterVlan -VMName "VM01" -Trunk -AllowedVlanIdList "100,200,300" -NativeVlanId 100

Step 8: Configure QoS Bandwidth Limits

Limit a VM’s network bandwidth to prevent a single VM from saturating the physical link:

Set-VMNetworkAdapter -VMName "VM01" -MaximumBandwidth 1000000000

Set minimum bandwidth reservation (in Mbps weight):

Set-VMNetworkAdapter -VMName "VM01" -MinimumBandwidthWeight 10

Step 9: Enable MAC Address Spoofing

Required when a VM hosts nested virtual machines or needs to use multiple MAC addresses:

Set-VMNetworkAdapter -VMName "VM01" -MacAddressSpoofing On

Step 10: Monitor Virtual Switch Traffic

View network adapter statistics for all VMs:

Get-VMNetworkAdapterStatistics -VMName *

List all virtual switches and their properties:

Get-VMSwitch | Format-List *

Step 11: Remove a Virtual Switch

To remove a virtual switch when it is no longer needed, first disconnect all VMs from it, then delete it:

Disconnect-VMNetworkAdapter -VMName "VM01" -Name "InternalNIC"
Remove-VMSwitch -Name "Private-vSwitch" -Force

Summary

Hyper-V Virtual Switches in Windows Server 2016 provide flexible, software-defined networking for VM environments. Whether you need full external connectivity, isolated internal networking, or high-bandwidth SET configurations, the virtual switch infrastructure supports all scenarios. VLAN tagging, QoS policies, and port ACLs enable enterprise-grade network management for virtualized workloads.