You are here:   Research
  |  Login

Welcome to my blog, quickest way to find articles is usually to search for them.

Search in All Title Contents

Configuring the Hyper-V MAC address pool for a Lab Environment (and finding duplicates)

Jan 17 2017

Ugh, it happened again!

I forgot to increase the MAC Address pool on a new lab server, and started to get VMs with the same MAC address in my environment. This time I figured that if I blog about it, I’m more likely to remember it next time :)


When installing Hyper-V, it' sets up a MAC Address Pool of only 256 machines. That means, once you deploy virtual machine number 257, it’s going to reuse an existing MAC Address. Not fun. Especially if that other VM is still around. You can see/edit the MAC address pool in the virtual switch manager, or via PowerShell.


Editing the MAC address pool via GUI.


Getting the MAC address pool via PowerShell.


The PowerShell command (for copy and paste) is:

Get-VMHost | Select MacAddressMinimum, MacAddressMaximum | ft


Checking for duplicates

If you think you are having machines with duplicate MAC address, simply run this script on your Hyper-V host to find out. Cred goes to Didier Van Hoye (@WorkingHardInIT) for the loop logic.


$AllNICs = Get-VM | Get-VMNetworkAdapter | Where-Object {$_.MacAddress -ne "000000000000"}

if($AllNICs -ne $null)
    (($AllNICs).GetEnumerator() | Group-Object MacAddress | ? {$_.Count -gt 1}).Group | Ft MacAddress,Name,VMName -GroupBy MacAddress -AutoSize
    "No duplicated MAC addresses where found on your Hyper-V host"


Running the script on my Hyper-V host, showing I have a few machines with duplicate MAC addresses.


Fixing it

The solution?  Simply increase the MAC address pool, either in the GUI or in PowerShell. In this example I’m increasing it to 65536 machines. That should last a few weeks :)


Set-VMHost -MacAddressMinimum 00155D010000 -MacAddressMaximum 00155D01FFFF


Setting the MAC address pool via PowerShell.


Written by Johan Arwidmark

Happy deployment, and thanks for reading!

What our lawyers makes us say:

This information is provided "AS IS" with no warranties, confers no rights and is not supported by the authors or Deployment Artist.

Copyright © 2017 by Deployment Artist (the company behind deployment research). All rights reserved. No part of the information on this web site may be reproduced or posted in any form or by any means without the prior written permission of the publisher.

Shorthand: Don't pass off our work as yours, it's not nice.

Blog Archive