大网数据广告活动
网络与域名解析

Configure Quality of Service (QoS) for a VM network adapter

· 52CE 我爱测

You can configure SDN QoS for a VM network adapter to limit bandwidth on a virtual interface to prevent a high-traffic VM from blocking other users.

You can configure Software Defined Networking (SDN) Quality of Service (QoS) for a virtual machine (VM) network adapter to limit bandwidth on a virtual interface to prevent a high-traffic VM from contending with other VM network traffic. You can also configure SDN QoS to reserve a specific amount of bandwidth for a VM to ensure that the VM can send traffic regardless of other traffic on the network. This can be applied to VMs attached to traditional VLAN networks as well as VMs attached to SDN overlay networks.

You can also configure QoS Offload to enforce QoS rules at the physical network adapter rather than at the virtual switch, resulting in lower CPU utilization and improved enforcement. QoS Offload is an optional capability found in Windows Server 2022 certified NICs that have achieved the Windows Server Software-Defined Data Center (SDDC) Premium Additional Qualification (AQ). For more information, see Select a network adapter.

SDN QoS bandwidth limits

SDN QoS provides configuration of maximum permitted send-side or receive-side bandwidth for VMs. This is supported for VMs connected to a traditional VLAN network as well as VMs connected to an SDN virtual network. Once set, your VM will not be able to send or receive traffic above the configured maximum limits. For a VM, you can choose to configure either a send-side limit, a receive-side limit, or both.

The settings that can be configured through SDN QoS are:

  • OutboundReservedValue - If outboundReservedMode mode is "absolute", then the value indicates the bandwidth, in Mbps, guaranteed to the virtual port for transmission (egress). If outboundReservedMode mode is "weight", then the value indicates the weighted portion of the bandwidth guaranteed.

  • OutboundMaximumMbps - Indicates the maximum permitted send-side bandwidth, in Mbps, for the virtual port (egress).

  • InboundMaximumMbps - Indicates the maximum permitted receive-side bandwidth for the virtual port (ingress) in Mbps.

SDN QoS policies

Once Network Controller for SDN is setup, you can go ahead and deploy your QoS policies. Today, you can do this using Network Controller PowerShell cmdlets.

For all example scripts used below, -ConnectionUri is the REST URI of the Network Controller. For example: https://nc.contoso.com.

Step 1: Configure global QoS settings

Run the following PowerShell command on a Network Controller computer or a management client of Network Controller. This will enable the global settings to configure QoS policies through Network Controller:

$vswitchConfig=[Microsoft.Windows.NetworkController.VirtualSwitchManagerProperties]::new()
$qos=[Microsoft.Windows.NetworkController.VirtualSwitchQosSettings]::new()
$qos.EnableSoftwareReservations=$true
$vswitchConfig.QosSettings =$qos
Set-NetworkControllerVirtualSwitchConfiguration -ConnectionUri $uri -Properties $vswitchConfig

Step 2: Configure QoS policies

First, you will need to identify the workload VM network interface where you want to apply the policy:

$NwInterface=Get-NetworkControllerNetworkInterface -ConnectionUri $uri -ResourceId Vnet-VM2_Net_Adapter_0

Next, configure the inbound and outbound maximum throughput allowed on the network interface:

$NwInterface.Properties.PortSettings.QosSettings= [Microsoft.Windows.NetworkController.VirtualNetworkInterfaceQosSettings]::new()
$NwInterface.Properties.PortSettings.QosSettings.InboundMaximumMbps ="1000"
New-NetworkControllerNetworkInterface -ConnectionUri $uri -ResourceId $NwInterface.ResourceId -Properties $NwInterface.Properties

QoS Offload (optional)

You can configure the physical NIC to use QoS Offload. If your adapter supports QoS offload, ensure it is enabled using one of two methods:

  • Network ATC (recommended)
  • Manual enablement using the adapter properties

Use Network ATC

QoS Offload is automatically enabled on all adapters with the Compute intent type. For more information, see Simplify host networking with Network ATC.

Note: This option is only available to Azure Local subscribers.

Use manual enablement

Manual enablement is done through the built-in cmdlets used to manage the physical adapter properties.

Important: You must ensure that QosOffload is enabled on every physical NIC in the team across every host. Without this, the QoS rule will be enforced via the virtual switch and result in lower efficiency.

Use the following cmdlets to check if your adapters support QosOffload and then modify the adapter properties:

Get-NetAdapterAdvancedProperty -Name <physical NIC Name> -RegistryKeyword *QosOffload
Enable QosOffload for your adapters:
Set-NetAdapterAdvancedProperty -Name  <physical NIC Name> -RegistryKeyword *QosOffload -RegistryValue 1

Configure hardware QoS

You can configure hardware QoS using settings and policies.

Step 1 - Configure global QoS settings

Perform the below steps on a Network Controller computer or a management client of Network Controller. This will enable the global setting to configure QoS policies through Network Controller.

$vswitchConfig=[Microsoft.Windows.NetworkController.VirtualSwitchManagerProperties]::new()
$qos=[Microsoft.Windows.NetworkController.VirtualSwitchQosSettings]::new()
$qos.EnableHardwareLimits=$true
$vswitchConfig.QosSettings =$qos
Set-NetworkControllerVirtualSwitchConfiguration -ConnectionUri $uri -Properties $vswitchConfig

Step 2 - Configure QoS policies

First, identify the workload VM network interface where you want to apply the policy:

$NwInterface=Get-NetworkControllerNetworkInterface -ConnectionUri $uri -ResourceId Vnet-VM2_Net_Adapter_0

Next, configure the outbound maximum throughput allowed on the network interface. The following example creates a QoS rule limiting the outbound traffic from a VM interface to 1 Gbps.

Important: Qos Offload only supports OutboundMaximumMbps. You cannot use OutboundReservedValue or InboundMaximumMbps with Qos Offload.

$NwInterface.Properties.PortSettings.QosSettings= [Microsoft.Windows.NetworkController.VirtualNetworkInterfaceQosSettings]::new()
$NwInterface.Properties.PortSettings.QosSettings. EnableHardwareLimits=$true
$NwInterface.Properties.PortSettings.QosSettings.OutboundMaximumMbps ="1000"
New-NetworkControllerNetworkInterface -ConnectionUri $uri -ResourceId $NwInterface.ResourceId -Properties $NwInterface.Properties

Note: During live migration, it is possible that a VM moves to a host that does not support QoS Offload. In this scenario, live migration will succeed, but QoS will fallback to SDN QoS.

Source: Microsoft Learn / Windows Server documentation by Microsoft and contributors (upstream author metadata: robinharwood). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Server documentation
适用范围
Windows Server · Source date 11/02/2021
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。