Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In my house I have all of my computers and sundry network connected devices configured to use DHCP. For devices that need to have static IP addresses I use DHCP reservations.
The reason why I do this is that it gives me a single place to look at my entire network configuration, and it allows me to make major network configuration changes easily.
A couple of weeks ago used SCVMM to quick migrate my FTP server from one Hyper-V server to another. Everything appeared to work correctly. But two days later I could no longer access the FTP server from an external computer.
After a bit of investigation I discovered that the virtual machines MAC address had changed, which had stopped my DHCP reservation from working, which had in turn stopped my port forwarding configuration on my router from working.
To figure out why this appeared to work at first and then later failed I needed to talk to our developers about when and why dynamic MAC addresses get regenerated in Hyper-V.
Before I explain the root cause – let me define some terms / concepts:
With Hyper-V you can configure a virtual machine to use a dynamic or a static MAC address for any given network adapter.
The default option is to use a dynamic MAC address – which means that Hyper-V will generate an initial MAC address for the network adapter, and it will regenerate the MAC address if it believes it is necessary.
If you use static MAC addresses you need to manually specify the MAC address to use, but Hyper-V will never change it.
Each Hyper-V server has a MAC address range that it uses for generating new dynamic MAC addresses. You can configure this range yourself if you want to.
A dynamic MAC address will get regenerated if:
The virtual machine is being turned on and the current MAC address is outside of the MAC address range configured for the current Hyper-V server.
The virtual machine is being turned on, or is restored from a saved state, and Hyper-V detects that another virtual machine is already using the specified MAC address.
The virtual machine is being turned on, or is restored from a saved state, and Hyper-V detects that the dynamic MAC address value in the virtual machine configuration has been set to zero.
Some more notes about dynamic MAC address regeneration:
If a virtual machine is coming back from a saved state and Hyper-V determines that the MAC address needs to be regenerated – the network adapter will be disconnected until the virtual machine is rebooted. This is done because Hyper-V cannot change the MAC address of a running virtual machine.
The only time you should expect to have a virtual machine with the MAC address set to zero is if you have imported the virtual machine and specified that you are copying (and not moving) the virtual machine.
So in my situation – my FTP server was moved to a Hyper-V server with a different MAC address range. Because the FTP server came across in a saved state; Hyper-V did not regenerate the MAC address until the first time the virtual machine rebooted. This is why everything appeared to work immediately after the virtual machine was moved – but then stopped working a couple of days later.
Cheers,
Ben
Anonymous
January 23, 2011
This is a great feateer but is there an equivilent in MED-V? We have all of our MED-V images generated from Virtual PC using bridged mode to enable no NAT communications but are struggling to find a consistent range of MAC addresses used by Virtual PC so we can map DHCP reservaqtions to the MED-V workspaces.
Anonymous
November 28, 2012
Good call... running multiple Hyper-V clusters here with various applications whose licenses are bound to the MAC address of the VM. Moving VMs from host to host within the cluster was not an issue, until the VM was restarted.
Anonymous
April 29, 2013
Thanks for this post Ben. This problem has caused many problems in my environment. Glad we know why this occurs now.
Anonymous
February 12, 2014
is there any way you can setup H-V to assign Static MAC Addresses by default?!
Anonymous
October 19, 2014
Hi mate, i have question regarding #3 "dynamic MAC address value in the virtual machine configuration has been set to zero. " how-to set Mac to zero?
also, may i have your alias? i could hardly find it out in address book
Anonymous
February 15, 2015
Thanks for the article. Would it be possible to improve the article by explaining how a hyper-v cluster host tracks its use of mac addresses and knows when they are no longer being used so it can re-issue. We have had duplicate mac-address issues with VMs on hyper-v 2008 r2 failover cluster. If a VM migrates to another hyper-v host is the original host aware of this in terms of mac address still in use? Or please explain how duplicate mac addresses occur so we can take steps to mitigate etc. Thank you.
Anonymous
February 19, 2015
Need to know if it is possible to use window 2012 server as virtual machine and assign ~200 MAC addresses.
Thank You
Anonymous
March 17, 2017
Is there a way to log when the regeneration happens, and are the old/new recorded?
Please sign in to use this experience.
Sign in