Manage accelerated networking for Azure Virtual Machines

The article discusses how to enable and manage Accelerated Networking on existing Azure Virtual Machines.

Prerequisites

Handle dynamic binding and revocation of virtual function

Binding to the synthetic network interface exposed in the virtual machine is a mandatory requirement for all applications that take advantage of Accelerated Networking.

Applications running directly over the virtual function network interface miss some packets destined for the virtual machine. These packets appear over the synthetic interface instead.

You must run an application over the synthetic network interface to guarantee that the application receives all packets that are destined to it. Binding to the synthetic network interface also ensures that the application keeps running even if the virtual function is revoked during host servicing.

For more information about application binding requirements, see How Accelerated Networking works in Linux and FreeBSD VMs.

Test the functionality on any Windows Hyper-V server to ensure that your custom image or applications correctly support the dynamic binding and revocation of virtual functions. Use a local Windows Server running Hyper-V in the following configuration:

  • Ensure you have a physical network adapter that supports SR-IOV.

  • An external virtual switch is created on top of this SR-IOV adapter with "Enable single-root I/O virtualization (SR-IOV)" checked.

  • A virtual machine running your operating system image or application is created/deployed.

  • The network adapters for this virtual machine, under Hardware Acceleration, have "Enable SR-IOV" selected.

Once you've verified your virtual machine and application are leveraging a network adapter using SR-IOV, you can modify the following example commands to toggle SR-IOV off/on in order to revoke and add the virtual function which will simulate what happens during Azure host servicing:

# Get the virtual network adapter to test
$vmNic = Get-VMNetworkAdapter -VMName "myvm" | where {$_.MacAddress -eq "001122334455"}

# Enable SR-IOV on a virtual network adapter
Set-VMNetworkAdapter $vmNic -IovWeight 100 -IovQueuePairsRequested 1

# Disable SR-IOV on a virtual network adapter
Set-VMNetworkAdapter $vmNic -IovWeight 0

Manage Accelerated Networking on existing VMs

It's possible to enable Accelerated Networking on an existing VM. The VM must meet the following requirements to support Accelerated Networking:

  • A supported size for Accelerated Networking.

  • A supported Azure Marketplace image and kernel version for Linux.

  • Stopped or deallocated before you can enable Accelerated Networking on any NIC. This requirement applies to all individual VMs or VMs in an availability set or Azure Virtual Machine Scale Sets.

Enable Accelerated Networking on individual VMs or VMs in availability sets

When you create a VM in the Azure portal, you can select the Enable accelerated networking checkbox on the Networking tab of the Create a virtual machine screen.

If the VM uses a supported operating system and VM size for Accelerated Networking, the Enable accelerated networking checkbox on the Networking tab of the Create a virtual machine screen is automatically selected. If Accelerated Networking isn't supported, the checkbox isn't selected, and a message explains the reason.

Note

  • You can enable Accelerated Networking during portal VM creation only for Azure Marketplace supported operating systems. To create and enable Accelerated Networking for a VM with a custom OS image, you must use Azure CLI or PowerShell.

  • The Accelerated Networking setting in the portal shows the user-selected state. Accelerated Networking allows choosing Disabled in the portal even if the VM size requires Accelerated Networking. VM sizes that require Accelerated Networking enable Accelerated Networking at runtime regardless of the user setting in the portal.

To enable or disable Accelerated Networking for an existing VM through the Azure portal:

  1. From the Azure portal page for the VM, select Networking from the left menu.

  2. On the Networking page, select the Network Interface.

  3. At the top of the NIC Overview page, select Edit accelerated networking.

  4. Select Automatic, Enabled, or Disabled, and then select Save.

To confirm whether Accelerated Networking is enabled for an existing VM:

  1. From the portal page for the VM, select Networking from the left menu.

  2. On the Networking page, select the Network Interface.

  3. On the network interface Overview page, under Essentials, note whether Accelerated networking is set to Enabled or Disabled.

To confirm whether Accelerated Networking is enabled for an existing VM:

  1. From the Azure portal page for the VM, select Networking from the left menu.

  2. On the Networking page, select the Network Interface.

  3. On the NIC Overview page, under Essentials, note whether Accelerated networking is set to Enabled or Disabled.

Once you restart and the upgrades finish, the VF appears inside VMs that use a supported OS and VM size.

Resize existing VMs with Accelerated Networking

You can resize VMs with Accelerated Networking enabled only to sizes that also support Accelerated Networking. You can't resize a VM with Accelerated Networking to a VM instance that doesn't support Accelerated Networking by using the resize operation. Instead, use the following process to resize these VMs:

  1. Stop and deallocate the VM or all the VMs in the availability set or Virtual Machine Scale Sets.

  2. Disable Accelerated Networking on the NIC of the VM or all the VMs in the availability set or Virtual Machine Scale Sets.

  3. Move the VM or VMs to a new size that doesn't support Accelerated Networking, and restart them.