Unable to manually change MAC address for virtual machine
search cancel

Unable to manually change MAC address for virtual machine

book

Article ID: 309948

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides steps to change the MAC address manually to be persistent after a reboot in ESX/ESXi 4.0 and ESXi 5.1 Patch 2.

Notes:


Symptoms:
  • You cannot change the MAC address of a network card from within a virtual machine.
  • The options to change the NetworkAddress or Locally Administered Address parameters on the network adapters in the virtual machine are not available. For more information, see Changing a MAC address in a Windows virtual machine (1008473).
  • Attempting to changing the MAC address manually from the vSphere Client fails with the error:

    The MAC address entered is not in the valid range. Valid values are between xx:xx:xx:xx:xx
     
  • Changing the MAC address in the virtual machine .vmx configuration file fails with the error:

    Please specify a static Ethernet address for ethernet0. Failed to configure ethernet0


Environment

VMware ESXi 4.0.x Embedded
VMware ESX 4.0.x
VMware vSphere ESXi 5.1
VMware ESXi 4.0.x Installable

Resolution

Note: The static and dynamic MAC address ranges are different in an ESX/ESXi environment. If you attempt to statically assign a MAC address from a previous virtual machine that has a dynamic MAC address, you may encounter issues.
 
It is recommended that you do not</u> configure virtual machines with previously used dynamic MAC addresses. The impact of configuring a virtual machine with a previously used dynamic MAC address may result in being unable to make configuration changes to the virtual machine in vCenter until it has been corrected.
 
To make a MAC address change persistent after a reboot, add or change the MAC address information to the virtual machine's .vmx configuration file.

Add or change MAC address information to the .vmx file on the ESX/ESXi host

To add or change the MAC address of a virtual machine:
  1. Shut down the virtual machine.
  2. Right-click the virtual machine and click Remove from Inventory.
  3. Login as the root user to a console session on the ESX/ESXi host. For more information, see Tech Support Mode for Emergency Support (1003677).
  4. Go to the virtual machine home directory:

    # cd /vmfs/volumes/DatastoreName/VMFolderName
     
  5. Make a backup of the existing virtual machine's .vmx configuration file with the command:

    # cp vmname.vmx vmname.vmx.old
     
  6. Open the .vmx configuration file in an editor such as vi or nano and add or change the following entries:

    ethernetN.checkMACAddress = “FALSE”
    ethernetN.addressType = “static”
    ethernetN.address = “XX:XX:XX:XX:XX:XX


    Where XX:XX:XX:XX:XX:XX is the new desired MAC address for the virtual machine.

    Note: For more information, see Editing files on an ESX host using vi or nano (1020302).
     
  7. Register the virtual machine back to the inventory. For more information, see Registering or adding a virtual machine to the inventory (1006160).
  8. Start the virtual machine.
Note: When configuring this manually the string "ethernetN.address = “XX:XX:XX:XX:XX:XX″ uses a lowercase "a" in address. The GUI does us an uppercase "A" as shown in the command below.
 

Editing the .vmx file through the GUI

To use the GUI to change the MAC address of a virtual machine:
  1. Shut down the virtual machine.
  2. Right-click the virtual machine and click Remove from Inventory.
  3. Download the .vmx configuration file for the virtual machine to your desktop using the Datastore Browser.
  4. Open the .vmx configuration file with an plain text editor and add or change the following entries:

    ethernetN.checkMACAddress = “FALSE”
    ethernetN.addressType = “static”
    ethernetN.Address = “XX:XX:XX:XX:XX:XX



    Where XX:XX:XX:XX:XX:XX is the new desired MAC address for the virtual machine.

     
  5. Upload the new (modified) .vmx file back to the same location (datastore) using the Datastore Browser.
  6. Copy the original .vmx file (using a name similar to vmname.vmx.old) for backup purposes.
  7. Register the virtual machine back to the inventory. For more information, see Registering or adding a virtual machine to the inventory (1006160).
  8. Start the virtual machine.


Additional Information

If you attempt to statically assign a MAC from a previous virtual machine that had a dynamic MAC address assigned when the static MAC address range and dynamic MAC address range are different, you experience errors.
Tech Support Mode for Emergency Support
How to register/add a VM to the Inventory in vCenter Server
Changing a MAC address in a Windows virtual machine
Using Tech Support Mode in ESXi 4.1, ESXi 5.x, and ESXi 6.x
Editing files on an ESX host using vi or nano
VMware ESXi 5.1, Patch ESXi510-201307401-BG: Updates esx-base and misc-drivers
仮想マシンの MAC アドレスを手動で変更できない
无法手动更改虚拟机的 MAC 地址