Set static MAC address on a Hyper-V Server 2016 VM

In a Hyper-V host, the MAC addresses received by the VM’s network adapters are dynamic and are defined by the range of the host. I don’t want to repeat myself, I have written an article on this subject.

However, there are several cases that we need to have a static MAC address on a VM. For example, when we want to do DHCP Filtering or DHCP Reservations, or if an inventory service or even some application’s license is linked to a MAC address. In such a case, when we move the VM to another Hyper-V host, it must keep the same MAC address. Otherwise, if it had a dynamic address then it would get a new one.

Let’s see how we set a static MAC address to a VM in Hyper-V. As always, this can be done either through Hyper-V Manager or PowerShell.

Set static MAC address using Hyper-V Manager

First, make sure the VM is not running.

Open Hyper-V Manager and then VM settings. Here, expand the Network Adapter and go to Advanced Features.

Set static MAC address on a Hyper-V Server 2016 VM

To set the VM with a static MAC address, enable the Static option and enter the address you want.

Set static MAC address using PowerShell

This is done using the Set-VMNetworkAdapter cmdlet as you can view below.

Set-VMNetworkAdapter -VMName SRV01 -StaticMacAddress “00112233445566”

Finally, note that when you set up a static MAC address for a VM, be sure it is not within the dynamic address range generated by the Hyper-V host. If it is within the range, then it is possible to give the same address to another VM as the host does not control the management between static and dynamic addresses.

About Dimitris Tonias 143 Articles
My name is Dimitris Tonias, IT Pro, G(r)eek, focused on Server, Virtualization, and Cloud technologies.

Be the first to comment

Leave a Reply

Your email address will not be published.


*