Step-by-Step: Create a VM with multiple NICs in Azure


Hello folks,

The following topic is another one of those features that has been requested so many times by IT pros I’ve talked to in the past. Finally some said, we now support multiple network interface cards (NICs) on VMs in Azure so you can bring your own networking and security appliances such as load balancers and firewalls in your virtual cloud environment.  Multi-NIC capabilities can also provide you more capability to manage your network traffic. You can isolate traffic between the frontend NIC and backend NICs, or separating data plane traffic from the management plane communication.

In our Azure subscription I created a virtual network with 2 subnets.  a front end subnet (FE) and a backend subnet (BE).

image

Here is a view of the exported XML network definition file.

image


Requirements and Constraints of Multi-NIC

At this time, Multi-NIC has the following requirements and constraints:

  • Multi-NIC VMs must be in created in Azure virtual networks. Non-VNet VMs are not supported.
  • 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 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.
  • 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.

The VM size determines the number of NICS that can be created for a VM

VM Size (Standard SKUs) NICs (max allowed per VM)

Small (1 core) & Medium (2 cores)

1

Large (4 cores)

2

ExtraLarge (8 cores)

4

A8/A9

1

 

Create a VM with multiple NICs.

First step is to refresh your installation of the Azure PowerShell module. The PowerShell module are updated regularly.

image

Once the PowerShell Module is installed use the following command to create the new VM with multiple NICs.  to do that we will use PowerShell. (I ran each section separately)

# Create Windows Azure Storage Account and set it as default
New-AzureStorageAccount -StorageAccountName "vmmultinic1" -Label "VM-Multi-NICs" -AffinityGroup "VMstorage"

Set-AzureSubscription –SubscriptionName "Windows Azure MSDN – Visual Studio Ultimate" -CurrentStorageAccount vmmultinic1

# Set the "Windows Server 2012 Datacenter, October 2014" as the image for the new VM
$imagename = @( Get-AzureVMImage | where-object { $_.Label -like "Windows Server 2012 Datacenter, October 2014" } ).ImageName
$image = Get-AzureVMImage -ImageName $imagename

# Define the VM config
$vm = New-AzureVMConfig -Name "VM2nics" -InstanceSize "Large" -Image $imagename

# Add the credential for the machine creation
Add-AzureProvisioningConfig –VM $vm -Windows -AdminUserName “sysadmin” -Password “Passw0rd!”

# Set the configuration of the “default” NIC
Set-AzureSubnet -SubnetNames "FE" -VM $vm
Set-AzureStaticVNetIP -IPAddress "10.2.1.111" -VM $vm

# Add additional NICs to the VM configuration
Add-AzureNetworkInterfaceConfig -Name "Ethernet2" -SubnetName "BE" -StaticVNetIPAddress "10.2.2.222" -VM $vm

# create the VM – the servicename is the cloud service name I already have created Azure – -VNetName is the Virtual Network I already created as per the XML definition above
New-AzureVM -ServiceName "pr-net1" –VNetName “VNet1” –VM $vm

Once complete, you will be able to connect to the VM through the portal and once logged on, you can validate the configuration of the multiple NICs.

image

image

image

 

That’s it.  We now have a VM with multiple NICs running in our Azure Virtual Network.

Cheers!

Signature

Pierre Roman
Twitter | Facebook | LinkedIn

Comments (0)

Skip to main content