Monday, April 27, 2015

Create multiple virtual network interfaces (vNICs) on Microsoft Azure virtual machine

At TechEd Europe 2014, Microsoft announced support for multiple Network Interface (NICs) in Azure virtual machines. Microsoft listed a table related the numbers of NICs are supported by different sizes of virtual machines.

VM Size NICs supported

According to "Create a VM with Multuple NICs" article, the primary usage of multiple NICs on Azure virtual machines is intended for Network Virtual Appliances (NVA) VMs. I think we can also apply it to cluster VMs like Exchange Server and SQL Server.


There are some requirements and constraints of multiple NICs on Azure virtual machines.
  • Multi-NIC VMs must be in created in Azure virtual networks. Non-VNet VMs are not supported.
  • Currently, the multi-NIC feature is intended for NVA (Network Virtual Appliances) VMs only. Attempting to use it with the standard Gallery images may produce unexpected results.
  • The current release does NOT support adding or removing NICs after a VM is created. Multi-NIC can only be applied when a VM is created.
  • Multi-NIC VMs and single-NIC VMs are not supported in the same deployment. If you attempt to add a multi-NIC VM to a deployment that contains a single-NIC VM, or vice-versa, you will receive the following error: "Virtual machines with secondary network interfaces and virtual machines with no secondary network interfaces are not supported in the same deployment, also a virtual machine having no secondary network interfaces cannot be updated to have secondary network interfaces and vice-versa".
  • Multi-NIC VMs cannot forward traffic acting as Layer 3 (IP) gateways or routers. The packets MUST be destined to or sourced from one of the VNet IP addresses on the VM.
  • Internet-facing VIP is only supported on the "default" NIC. There is only one VIP to the IP of the default NIC.
  • At this time, PIP is not supported for multi-NIC VMs.
  • You can't apply network security groups (NSGs) or Forced Tunneling to the non-default NICs at this time.
  • The order of the NICs from inside the VM will be random, and could also change across Azure infrastructure updates. However, the IP addresses, and the corresponding Ethernet MAC addresses will remain the same. For example, assume Eth1 has IP address 10.1.0.100 and MAC address 00-0D-3A-B0-39-0D; after an Azure infrastructure update and reboot, it could be changed to Eth2, but the IP and MAC pairing will remain the same. When a restart is customer-initiated, the NIC order will remain the same.
  • Multiple NICs on the same virtual network subnet is supported.
  • The VM size determines the number of NICs that can be created for a VM. The above table listed the numbers of NICs corresponding to the size of the VMs.

I'm going to create a new virtual machine with 3 NICs under Azure virtual network named wuslabvnet2. I created the following address spaces and subnets in wuslabvnet2.



To configure multi-NICs for a virtual machine, we need to perform Azure PowerShell cmdlets to create and assign the settings to the virtual machine.

Prerequisites

  • The configuration computer is installed Microsoft Azure PowerShell module (latest version)
  • Create an Azure virtual network named wuslabvnet2 and then create the above address spaces and subnets
  • Make sure that the Azure subscription has been connected to Azure Storage Account
Goals
  • Create and test a multi NICs virtual machine in Microsoft Azure
Lab
1. Launch "Microsoft Azure PowerShell".
2. Perform "$vm = New-AzureVMConfig -Name <VM Name> -ImageName <Azure VM Image Name> -InstanceSize Extralarge | Add-AzureProvisioningConfig -Windows -AdminUsername <Administrator name> -Password <Administrator's password>" to save Azure VM configuration to a variable.


3. Perform Add-AzureNetworkInterfaceConfig -Name "Ethernet1" -SubnetName "Subnet-192-1" -StaticVNetIPAddress "192.168.1.10" -VM $vm to add a NIC with static IP to the virtual machine configuration variable.


4. Perform Add-AzureNetworkInterfaceConfig -Name "Ethernet2" -SubnetName "Subnet-172-2" -VM $vm to add the second NIC with dynamic IP to the virtual machine configuration variable.


5. Perform Set-AzureSubnet -SubnetNames "Subnet-10-1" -VM $vm to define the default subnet for the default NIC.


6. Perform Set-AzureStaticVNetIP -IPAddress "10.0.1.10" -VM $vm to assign static IP for the default NIC.


7. We can perform New-AzureVM -ServiceName MNICVM001 -VNetName wuslabvnet2 -VMs $vm -Location "West US" to create a virtual machine with 3 NICs.


The multi-NICs virtual machine was created.

Test result
The Azure management portal only displays the default NIC of the virtual machine.


To check other IP addresses from non default NICs of the virtual machine, we can perform Get-AzureVM -ServiceName MNICVM001 -Name MNICVM001 | Get-AzureNetworkInterfaceConfig | Select -ExpandProperty IpConfigurations to get the information.


Remark: Make sure the virtual machine is running before perform the above cmdlet.

Multi-NIC VMs and single-NIC VMs are not supported in the same deployment. You will get the error message when you create a virtual machine into the same cloud service.


References:
Create a VM with Multiple NICs

Multiple VM NICs and Network Virtual Appliances in Azure

This posting is provided “AS IS” with no warranties, and confers no rights!

No comments:

Post a Comment