Windows Azure Pack VM Role Virtual Machines : MAC addresses are static !

Hi All,

With Windows Azure Pack, when deploying Virtual Machines role instances, be careful regrading the Virtual Machines Network Interfaces MAC addresses. Unlike standalone virtual machines NIC MAC addresses that are assigned dynamically, the VM Role instances NIC interfaces MAC addresses are fixed during the deployment and the MAC addresses are assigned from the VMM Default MAC address pool.

This behavior is likely by design, and cannot be changed using a straight configuration or option.

You can create SMA workflows that are linked to the MicrosoftCompute VMRole object actions, that change the NICs MAC type to dynamic but you will need to develop these workflows (Powershell scripts): Not easy!

Finally, if you change manually the MAC addresses type to dynamic (via VMM console or VMM powershell), be aware that you missed a configuration. In fact, during deployment, VMM assigns the MAC addresses via a MAC addresses pool (The default pool), each NIC receives a MAC reservation, and this particular MAC address ‘belongs’ now to this NIC. When you set the NIC MAC to dynamic, the reservation still exist and the used MAC still owned by this NIC. This behavior can  lead to reserved MAC addresses that are not assigned, and that can’t be used by other NICs.

The solution is to give back the MAC address to the VMM MAC pool. This can be done by the Revoke-SCMACAddress VMM powershell cmdlet.

The hole process is defined below:

##### SCRIPT BEGINNING #####

#Get the VM

$VM = Get-SCVirtualMachine -Name “VMName”

#Get the VM’s NIC, 0 for the first NIC, 1 for the second…

$NIC = $VM.VirtualNetworkAdapters(0)

#Get the NIC MAC Address

$DEFMAC = Get-SCMACAddress -MACAddress $NIC.EthernetAddress

#Revoke the MAC address

Revoke-SCMACAddress -AllocatedMACAddress $DEFMAC

#Set the NIC MAC address to dynamic

Set-SCVirtualNetworkAdapter $NIC -MACAddressType dynamic

##### SCRIPT END #####

You can use a for loop for multiple NICs VM

##### SCRIPT BEGINNING #####

#Get the VM

$VM = Get-SCVirtualMachine -Name “VMName”

#Get the NIC count

$NICCount = $VM.VirtualNetworkAdapters.Count

#Start the iteration

For ($i=0 ;$i -lt $NICCount ; $i++) {

$NIC = $VM.VirtualNetworkAdapters(i)

$DEFMAC = Get-SCMACAddress -MACAddress $NIC.EthernetAddress

Revoke-SCMACAddress -AllocatedMACAddress $DEFMAC

Set-SCVirtualNetworkAdapter $NIC -MACAddressType dynamic

}

##### SCRIPT END #####

If you have questions, shoot!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s