Hyper-V static MAC address greyed out

For the most reliable licensing mechanism on a Virtual Machine it is recommended to be running the latest version of TOP Server.

Care must be taken so that the virtualized hardware profile of the virtual machine does not change, or the license will break. In most cases, the hypervisor will dynamically generate the MAC address of a virtual machine, which will result in a broken license - to avoid this statically define the MAC address for any virtual machine that the TOP Server will be running on.

Additionally, when moving a virtual machine between two hosts special care should be taken to ensure that the MAC Address, VM UUID, and VM Generation ID do not change - which would result in a broken license binding. Cloning or copying a VM (as opposed to migrating it) will break the license binding and is a violation of the EULA. 

To statically define the MAC Address on a virtual machine, take the following steps, and please note that on systems with more than one network interface, the MAC address must be set statically for all network adapters.

Hyper-V

  1. By default Hyper-V is configured to dynamically generate MAC address on certain events. This will break the licensing if the VM is ever migrated, load balanced, etc - which will prevent the server from working correctly in any high-availability (HA) environment.
  2. The Dynamic MAC Generation must be manually disabled in the Virtual Machine NIC Settings. In order to do this;
    1. Power down the virtual machine
    2. Find the Virtual Machine in the Hyper-V Manager
    3. Right click the machine and open the settings
    4. Find the Network adapter and open the Advanced Features
    5. Under MAC Address specific the static MAC to be used.

VMWare ESXi

  1. Power down the virtual machine
  2. Locate the virtual machine in the vSphere Web Client
  3. Right Click on the VM and select Edit Settings. Alternatively, you can find the "Edit Virtual Machine settings button
  4. On the Virtual Hardware tab, expand the network adapter section.
  5. In the MAC Address section, select Manual from the drop-down menu. 
  6. Type a static MAC address and click OK.

VMWare Workstation

Power down the VM and locate the VM’s vmx file. View in a text editor and make the following changes:

  • Add the following lines to the file

ethernet0.checkMACAddress = "false"

ethernet0.addressType = "static"

ethernet0.address = "11:22:33:aa:bb:cc"

  • Remove the following lines from the file

ethernet0.addressType = "generated"

ethernet0.generatedAddress = "11:22:33:aa:bb:cc"

ethernet0.generatedAddressOffset = "0"

Nutanix AHV

For details on assigning a static MAC address, refer to the following Nutanix technical resource: (NOTE: Nutanix indicates that a static MAC address must be assigned when first creating a network adapter.)

    Hey everybody,

    I have a question concerning MAC addresses in a two-node HyperV 2012 R2 failover cluster.

    One of our sites is running such a two-node HyperV 2012 R2 cluster with 17 VMs.

    One of these VMs acts as the license server for a couple of Autodesk Autocad workstations.

    Since the license file of Autocad is married to the MAC address of the license server, the server stopped giving out licenses when the VM moved from one host to the other during the monthly patching by the cluster aware updating role.

    I've gone ahead and switched the setting of the MAC address for this particular VM from dynamic MAC addresses to static.

    Since all the other VMs are still using dynamic MAC addresses I fear that I may have a MAC address conflict on my hands when the VMs move from host to host during next months patch cycle.

    Is HyperV intelligent enough to determine that a particular MAC address is already in use by another VM or are there countermeasures which need to be taken?

    Thanks in advance,

    Dominik

    Introduction

    Before we talk about setting a static MAC address on a guest NIC team in Hyper-V. We go back to Ubuntu Linux. Do you remember my blog post about configuring an interface bond in a Ubuntu Hyper-V guest? If not, please read it as what I did there got me thinking about setting a static MAC address on a guest NIC team in Hyper-V.

    Ubuntu network bond

    As you have read by now in the blog post I linked to above, we need to enable MAC Spoofing on both vNICs members of an interface bond in Ubuntu virtual machine on Hyper-V. Only then will you have network connectivity and are you able to get a DHCP address. On Ubuntu (or Linux in general), the bond interface has a generated MAC address assigned. It does not take one of the MAC addresses of the member vNICs. That is why we need MAC spoofing enabled on both member vNIC in the Hyper-V settings for this to work! In a Windows guest, you will find that the MAC address for the LBFO team gets one of the MAC addresses of its member vNICs assigned. As such, this does not require NIC spoofing. During failover, it will swap to the other one.

    Setting a static MAC address on a guest NIC team in Hyper-V

    In Ubuntu, you can set a chosen static MAC address on a bond and on the member interfaces inside the guest operating system. Would we be able to do the same with a NIC team in a Windows Server guest virtual machine? Well, yes! It sounds like a dirty hack inspired by Linux bonding, which might be way beyond anything resembling a supported configuration. But, if it is allowed for Linux, why not leverage the same technique in Windows?

    Configuration walkthrough

    We use a mix of MAC address spoofing on the member vNICs with “enable this network adapter to be part of a team in the guest operating system” checked (not actually needed in this case) and a hardcoded MAC address on the team NIC and both member NICs inside the virtual machine. The same MAC address!

    Hyper-V static MAC address greyed out
    The team interface and its member all get the same static MAC address in the guest

    First, note the format of the MAC address. No dashes, dots, or colons. Also, that is a lot of clicking. Let’s try to do this with PowerShell. Using Set-NetAdapter throws an error to the fact that it detects the duplicate MAC address. It protects you against what it thinks is a bad idea.

    $TeamName = 'GUEST-TEAM'
    Set-NetAdapter -Name $TeamName -MacAddress "14-52-AC-25-DF-74"
    ForEach ($MemberNic in $TeamName){
    #Get-NetAdapter (Get-NetLbfoTeamMember -Team $MemberNic).Name | Format-Table
    Set-NetAdapter (Get-NetLbfoTeamMember -Team $MemberNic).Name  -MacAddress "14-52-AC-25-DF-74"
    } 
    

    Set-NetAdapter : The network address 1452AC25DF74 is already used on a network adapter with the name ‘Guest-team-member-01’ At line:2 char:1+ Set-NetAdapter -Name $TeamName -MacAddress “14-52-AC-25-DF-74″+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : InvalidArgument: (MSFT_NetAdapter…wisetech.corp”):ROOT/StandardCimv2/MSFT_NetAdapter) [Set-NetAdapter], CimException    + FullyQualifiedErrorId : Windows System Error 87,Set-NetAdapter
    Set-NetAdapter : The network address 1452AC25DF74 is already used on a network adapter with the name ‘Guest-team-member-01’
    At line:5 char:1
    + Set-NetAdapter (Get-NetLbfoTeamMember -Team $MemberNic).Name  -MacAdd …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (MSFT_NetAdapter…wisetech.corp”):ROOT/StandardCimv2/MSFT_NetAdapter) [Set-NetAdapter], CimException
        + FullyQualifiedErrorId : Windows System Error 87,Set-NetAdapter

    You need to use Set-NetAdapterAdvancedProperty. Mind you that the MAC address property for the team is called “MAC Address” and for the team member NIC “Network Address” just like in the GUI. Use the following code in the guest virtual machine.

    $Team = Get-NetLbfoTeam -Name 'GUEST-TEAM'
    $MACAddress = "1452AC25DF74"
    $TeamName = $Team.Name
    #Get-NetAdapterAdvancedProperty -Name $TeamName
    Set-NetAdapterAdvancedProperty -Name $TeamName -DisplayName 'MAC Address' -DisplayValue $MACAddress
    
    $TeamMemberNicNames = (Get-NetLbfoTeamMember -Team $TeamName).Name
    foreach ($TeamMember in $TeamMemberNicNames){
        #Get-NetAdapterAdvancedProperty -Name $TeamMember
        Set-NetAdapterAdvancedProperty -Name $TeamMember -DisplayName 'Network Address' -DisplayValue $MACAddress
    }
    

    Let’s check our handy work with PowerShell

    Hyper-V static MAC address greyed out
    Verify the team interface and its member all have the same static MAC address in the guest

    Last but not least, leave the dynamically assigned MAC addressed on the vNIC team members in Hyper-V setting but do enable MAC spoofing.

    Hyper-V static MAC address greyed out
    Enable MAC address spoofing

    Borrowing a trick from Linux for setting a static MAC address on a guest NIC team in Hyper-V

    With this setup, we do not need separate switches for each member vNIC for failover to work but it is still very much advised to do so if you want real failover. First, It sounds filthy, dirty, and rotten, but for lab, demo purposes, go on, be a devil. Secondly, can you use this in production? Yes, you can. Just mind the MAC addresses you assign to avoid conflicts. Now you can tie your backward software license key that depends on a fixed MAC address to a Windows LBFO in a Hyper-V virtual machine. Why? Because we can. Finally, I would perhaps have to say that you should not do it, but Linux does, and so can windows!

    How do I change MAC address in Hyper

    Open the Hyper-V console and go to the virtual machine settings. 2. Unfold the options of the network card 1 , display the Advanced Features 2 . Select the static option 3 from the MAC address and enter the address 4 .

    How do I assign a static IP to a Hyper

    Open Hyper-V Manager, go to Network Settings, and add an external NIC switch that you can give a Static IP on your Router that your Host machine uses.

    How do I make a static MAC address?

    Add Static MAC Address. Navigate to Switch -> Port Security -> Port Security -> Port Security Interface Config. You can manually enter single MAC addresses one port at a time, or convert all "learned" addresses to static.

    How do I fix my VM MAC address?

    Editing a VM MAC address.
    Shut down the VM..
    Navigate to the VM Settings > Network Adapters page for the VM you want to edit. Where is that? ... .
    For the network adapter you want to edit, click Edit..
    The Edit adapter dialog displays. Edit the MAC address using the guidelines listed below: ... .
    Click Edit Network Adapter..