How to set a static MAC address on VMware ESXi virtual machine

Question: I want to assign a static MAC address to a virtual machine (VM) on VMware ESXi. However, when I attempt to start a VM with a static MAC address, the VM fails to start and throws an error "00:0c:29:1f:4a:ab is not an allowed static Ethernet address. It conflicts with VMware reserved MACs". How can I set a static MAC address on VMware ESXi VMs?

When you create a VM on VMware ESXi, each network interface of the VM is assigned a dynamically generated MAC address. If you want to change this default behavior and assign a static MAC address to your VM, here is how to do it.

As you can see above, VMware's vSphere GUI client already has a menu for setting a static MAC address for a VM. However, this GUI-based method only allows you to choose a static MAC address from 00:50:56:xx:xx:xx, which is VMware-reserved MAC address range. If you attempt to set any arbitrary MAC address outside this MAC range, you will fail to launch the VM, and get the following error.

Then what if I want to assign any arbitrary MAC address to a VM?

Fortunately, there is a workaround to this limitation. The solution is, instead of using vSphere GUI client, editing .vmx file of your VM directly, after logging in to the ESXi host.

First, turn off the VM to which you want to assign a static MAC address.

Enable SSH access to your ESXi host if you haven't done it already. Then log in to the ESXi host via SSH.

Move to the directory where your VM's .vmx file is located:

# cd vmfs/volumes/datastore1/[name-of-vm]

Open .vmx file with a text editor, and add the following fields. Replace the MAC address field with your own.

ethernet0.addressType = "static"
ethernet0.checkMACAddress = "false"
ethernet0.address = "00:0c:29:1f:4b:ac"

Now you should be able to launch a VM with the static MAC address you defined in .vmx file.

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

4 thoughts on “How to set a static MAC address on VMware ESXi virtual machine

  1. Hi,
    Thanks for this post, this really saved my life, as I was trying to assign a reserved MAC statically. I couldn't use a different mac address, as I was forced by a license on the vm to use this specific one. You really saved me a lot of time and nerves 🙂

    BR
    Florian

  2. Hello. thank you for your solution. I use that and it is really applicable. but I have a problem. After this, my VM disconnect from network randomly...
    Would you please help me!?

  3. Hi,
    Thanks for the tip, which worked, however, I tried it in C++ GUI first. When that didn't work, I found your method. However, because I had used the GUI to start with, it actually added the MAC right at the bottom of the .VMX file. This foxed me for a bit as I couldn't start the VM and when I removed it from the inventory, the option to add was greyed out. I put in your settings, removed the GUI-added entry and all is well.

    Thanks

  4. Excellent advice! I also found that on my host esxi 6.0.0, I needed to edit the last 3 bytes of the uuid.bios and uuid.location values to match the last 3 bytes (nic) of the mac address I needed as well.

Leave a comment

Your email address will not be published. Required fields are marked *