Skip to main content

Configure Accelerated Networking for an Azure VM

Hands-On Lab

 

Photo of James Lee

James Lee

Training Architect

Length

01:30:00

Difficulty

Intermediate

Accelerated networking enables single root I/O virtualization (SR-IOV) to a VM, greatly improving its networking performance. This high-performance path bypasses the host from the datapath, reducing latency, jitter, and CPU utilization, for use with the most demanding network workloads on supported VM types. In this lab, we will see firsthand how enabling accelerated networking can drastically improve network throughput between two virtual machines in the same virtual network.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Configure Accelerated Networking for an Azure VM

Introduction

Accelerated networking enables single root I/O virtualization (SR-IOV) to a VM, greatly improving its networking performance. This high-performance path bypasses the host from the datapath, reducing latency, jitter, and CPU utilization, for use with the most demanding network workloads on supported VM types. In this lab, we will see firsthand how enabling accelerated networking can drastically improve network throughput between two virtual machines in the same virtual network.

Solution

Log in to the Azure Portal using the credentials provided on the lab instructions page.

Note: Throughout this lab guide, you'll see resources with -XXXXX appended to the end of their name. That indicates the unique five-character lab ID for the lab (e.g., vm1-np3bn).

Objective 1: Log In to the Azure Portal and Log On to the Virtual Machines

  1. Click on All Resources in the navigation hub menu and familiarize yourself with the Azure resources that have been provisioned, including:

    • An Azure virtual network and network security group allowing SSH access to virtual machines
    • Two CentOS 7.5 virtual machines, along with supporting components (NIC, public IP, disk, etc.)
    • One Azure storage account
  2. Click on the virtual machine named vm1-XXXXX.

  3. Inside the virtual machine blade, click the Connect button to download an RDP file for connecting to the virtual machine.

  4. Click on the virtual machine named vm2-XXXXX.

  5. Inside the virtual machine blade, click the Connect button to download an RDP file for connecting to the virtual machine.

  6. Using a remote desktop program of your choosing, use the files you just downloaded to connect and log in to each virtual machine. Use the following credentials:

    • Username: azureuser
    • Password: LA!2019!Lab1

Objective 2: Install Network Tools and Test Network Throughput

Verify Accelerated Networking Is Disabled

  1. On each virtual machine, click the Windows icon in the bottom-right corner of the screen.
  2. Click on Windows Administrative Tools in the menu and then click on Computer Management.
  3. In the Computer Management console, click on Device Manager in the left-hand pane.
  4. In the right-hand pane, expand Network adapters and note that the only network adapter for the VM is the Microsoft Hyper-V Network Adapter.

Disable Windows Firewall

  1. On each virtual machine, open a PowerShell window and run the following script:

    Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False

Download Networking Tools onto the Virtual Machines

  1. In each virtual machine's PowerShell window, run the following script to download PSTools and NTttcp:

    Add-Type -AssemblyName System.IO.Compression.FileSystem
    
    $url = "https://download.sysinternals.com/files/PSTools.zip"
    $url2 = "https://gallery.technet.microsoft.com/NTttcp-Version-528-Now-f8b12769/file/159655/1/NTttcp-v5.33.zip"
    
    $zipfile = "C:UsersazureuserDesktopPSTools.zip"
    $zipfile2 = "C:UsersazureuserDesktopNTttcp-v5.33.zip"
    
    $folder = "C:UsersazureuserDesktopPSTools"
    $folder2 = "C:UsersazureuserDesktopNTttcp"
    
    Invoke-WebRequest -UseBasicParsing -OutFile $zipfile $url
    
    [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $folder)
    
    Invoke-WebRequest -UseBasicParsing -OutFile $zipfile2 $url2
    
    [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile2, $folder2)
    
    Remove-Item -Path $zipfile
    Remove-Item -Path $zipfile2

PSPing - Determine Network Latency

Start PSPing in Server Mode on vm2-XXXXX

  1. On vm2-XXXXX, open up a command prompt by clicking the Windows icon.

  2. Click on Windows System in the menu and then click on Command Prompt.

  3. In the command prompt, start PSPing in server mode by typing the following commands:

    cd c:usersazureuserdesktoppstools
    
    psping.exe -f -s 10.0.1.4:1433
  4. Click Agree to agree to the licensing terms. PSPing will begin listening on TCP port 1433.

Start PSPing in Client Mode on vm1-XXXXX

  1. On vm1-XXXXX, open up a command prompt by click the Windows icon.

  2. Click on Windows System in the menu and then click on Command Prompt.

  3. In the command prompt, start PSPing in client mode by typing the following commands:

    cd c:usersazureuserdesktoppstools
    
    psping.exe -l 10m -n 2000 -4 -h -f 10.0.1.4:1433
  4. Click Agree to agree to the licensing terms.

  5. PSPing will begin a network latency test to vm2-XXXXX. Copy the output of the test, which should look similar to the following, and paste it into a text file on your local workstation.

PSPing1 results

  1. On vm2-XXXXX, type Control+C (Command+C on MacOS) to exit PSPing.

NTttcp - Determine Network Throughput

Start NTttcp in Server Mode on vm2-XXXXX

  1. On vm2-XXXXX, in the command prompt, start NTttcp in receiver mode by typing the following commands:

    cd c:usersazureuserdesktopntttcpamd64fre
    
    NTttcp.exe -r -p 50002 -m 8,*,10.0.1.4 -rb 10m -a 16 -t 300

    NTttcp will begin listening on TCP port 50002.

Start NTttcp in Client Mode on vm1-XXXXX

  1. On vm1-XXXXX, in the command prompt, start NTttcp in sender mode by typing the following commands:

    cd c:usersazureuserdesktopntttcpamd64fre
    
    NTttcp.exe -s -p 50002 -m 8,*,10.0.1.4 -l 10m -a 2 -t 300
  2. NTttcp will begin a network throughput test to vm2-XXXXX. Copy the Bytes section of the output of the test, which should look similar to the following, and paste it into a text file on your local workstation.

NTttcp1 results

Objective 3: Configure Cloud Shell

  1. In the Azure Portal, click the Cloud Shell button (which looks like >_) in the top right-hand corner of the screen.
  2. In the window that appears, select Bash and then click Show advanced settings.
  3. Configure the Cloud Shell with the following settings:
    • Subscription: Use the default
    • Resource group: Use existing, and ensure the resource group for the lab is selected.
    • Cloud Shell region: West US
    • Storage account: Use existing, and ensure the storage account named saXXXXX is selected.
    • File share: Create new, and name this anything you wish (e.g., "cloudshell").

Azure Cloud Shell Advanced

  1. Click Create storage.

Objective 4: Shut Down the Virtual Machines and Enable Accelerated Networking

  1. In Cloud Shell, shut down and deallocate each virtual machine with the following command:

    az vm deallocate --resource-group ResourceGroup --name vm-name

    Use your lab resource group and virtual machine names in place of ResourceGroup and vm-name. You can use the Tab key to populate the name of the resource group and VM in this lab.

  2. Update the network interfaces on each virtual machine to enable accelerated networking:

    az network nic update --resource-group ResourceGroup --name nic-name --accelerated-networking true

    Use your lab resource group and network interface names in place of ResourceGroup and nic-name. You can use the Tab key to populate the name of the resource group and NIC in this lab.

  3. In Cloud Shell, start each virtual machine with the following command:

    az vm start --resource-group ResourceGroup --name vm-name

    Use your lab resource group and virtual machine names in place of ResourceGroup and vm-name. You can use the Tab key to populate the name of the resource group and VM in this lab.

Objective 5: Log On to Each VM and Retest the Networking Throughput

  1. Using a remote desktop program of your choosing, use the files downloaded in Objective 1 to connect and log into the virtual machines. Use the following credentials:
    • Username: azureuser
    • Password: LA!2019!Lab1
  2. On each virtual machine, click the Windows icon.
  3. Click on Windows Administrative Tools in the menu and then click on Computer Management.
  4. In the Computer Management console, click on Device Manager in the left-hand pane.
  5. In the right-hand pane, expand Network adapters and note that an additional network adapter for the VM exists and is named the Mellanox ConnectX-3 Virtual Function Ethernet Adapter.

NIC results

  1. Follow the steps for testing PSPing and NTttcp again to compare the results with the earlier test.

PSPing - Determine Network Latency

Start PSPing in Server Mode on vm2-XXXXX

  1. On vm2-XXXXX, open up a command prompt by clicking the Windows icon.

  2. Click on Windows System in the menu and then click on Command Prompt.

  3. In the command prompt, start PSPing in server mode by typing the following commands:

    cd c:usersazureuserdesktoppstools
    
    psping.exe -f -s 10.0.1.4:1433
  4. Click Agree to agree to the licensing terms. PSPing will begin listening on TCP port 1433.

Start PSPing in Client Mode on vm1-XXXXX

  1. On vm1-XXXXX, open up a command prompt by click the Windows icon.

  2. Click on Windows System in the menu and then click on Command Prompt.

  3. In the command prompt, start PSPing in client mode by typing the following commands:

    cd c:usersazureuserdesktoppstools
    
    psping.exe -l 10m -n 2000 -4 -h -f 10.0.1.4:1433
  4. Click Agree to agree to the licensing terms.

  5. PSPing will begin a network latency test to vm2-XXXXX. Copy the output of the test, and paste it into a text file on your local workstation. Compare it to the earlier results — it should show an improvement in latency.

  6. On vm2-XXXXX, type Control+C (Command+C on MacOS) to exit PSPing.

NTttcp - Determine Network Throughput

Start NTttcp in Server Mode on vm2-XXXXX

  1. On vm2-XXXXX, in the command prompt, start NTttcp in receiver mode by typing the following commands:

    cd c:usersazureuserdesktopntttcpamd64fre
    
    NTttcp.exe -r -p 50002 -m 8,*,10.0.1.4 -rb 10m -a 16 -t 300

    NTttcp will begin listening on TCP port 50002.

Start NTttcp in Client Mode on vm1-XXXXX

  1. On vm1-XXXXX, in the command prompt, start NTttcp in sender mode by typing the following commands:

    cd c:usersazureuserdesktopntttcpamd64fre
    
    NTttcp.exe -s -p 50002 -m 8,*,10.0.1.4 -l 10m -a 2 -t 300
  2. NTttcp will begin a network throughput test to vm2-XXXXX. Copy the Bytes section of the output of the test, and paste it into a text file on your local workstation. Compare it to the earlier results — it should show an improvement in throughput.

Conclusion

We did it! Congratulations on successfully completing this lab!