Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

Changing the MAC address of a hosted virtual machine (507)

Details

This article provides steps to change the MAC address of a hosted virtual machine.

For an ESX/ESXi virtual machine, see Setting a static MAC address for a virtual NIC (219).

For a Fusion virtual machine, see Setting a MAC address for a virtual machine in VMware Fusion (1003479).

Solution

When a virtual machine is powered on, the VMware application automatically assigns it a MAC address. The software guarantees that virtual machines are assigned unique MAC addresses within a given host system. However, the software does not guarantee that a given virtual machine is assigned the same MAC address every time it is powered on. In addition, the VMware application does its best, but cannot guarantee, to automatically assign unique MAC addresses for virtual machines running on multiple host systems. A conflict may arise, for example, if the virtual network adapters on different physical servers share the same subnet and are assigned the same MAC address.

Avoiding MAC Address Changes

To avoid changes in the MAC address automatically assigned to a virtual machine, you must not move the virtual machine's configuration file. Moving it to a different host computer or even moving it to a different location on the same host computer changes the MAC address.

You also need to be sure not to change certain settings in the virtual machine's configuration files. If you never edit the configuration file by hand and do not remove the virtual Ethernet adapter, these settings remain untouched. If you do edit the configuration file by hand, be sure not to remove or change the options:

ethernetN.generatedAddress
ethernetN.addressType
ethernetN.generatedAddressOffset
uuid.location
uuid.bios
ethernetN.present

In these options, N is the number of the virtual Ethernet adapter. For example, ethernet0.

Note: To preserve a virtual Ethernet adapter's MAC address, you also must be careful not to remove the adapter. If you remove the adapter, then recreate it, the adapter may be assigned a new MAC address.

Manually Assigning a MAC Address

To guarantee that the same MAC address is assigned to a given virtual machine every time, even if the virtual machine is moved, or to guarantee a unique MAC address for each virtual machine within a networked environment, you can assign the address manually instead of allowing VMware Workstation to assign it automatically.

To assign the same, unique MAC address to any virtual machine manually, use a text editor to remove three lines from the configuration file and add one line. The configuration file has a .vmx extension at the end of the filename. On a Linux host, a virtual machine created with an earlier VMware product may have a configuration file with a .cfg extension.

  1. Open the virtual machine's .vmx configuration file with a text editor. For more information about editing a virtual machine's configuration file (.vmx), see Tips for editing a .vmx file (1714).

  2. Remove the three lines from the configuration file that begin with:

    ethernetN.generatedAddress
    ethernetN.addressType
    ethernetN.generatedAddressOffset


  3. Add a new static MAC address line to the configuration file with help of the following entries:

    ethernetN.address = "00:50:56:XX:YY:ZZ"
    ethernetN.addressType = “static”

  4. Save the configuration file.

In this example, XX must be a valid hexadecimal number between 00h and 3Fh, and YY and ZZ must be valid hexadecimal numbers between 00h and FFh. VMware Workstation and Fusion virtual machines do not support arbitrary MAC addresses, you must use this format.

As long as you choose a value for XX:YY:ZZ that is unique among your hard-coded addresses, conflicts between the automatically assigned MAC addresses and the manually assigned addresses should never occur.

To change the MAC address to a non-vmware address (in the case of a P2V where software on the PC is licensed against the original MAC address) add these lines to the .vmx:

ethernetN.addressType = “static”
ethernetN.address = “<address>”

where N is the adapter being changed.
 

For translated versions of this article, see:

Tags

changing-vm-mac-address  how-to  vm-configuration

Update History

03/15/2011 - Disambiguated articles for Fusion, hosted products, and ESX 06/16/2011 - added information about keeping a static MAC address after a P2V 08/23/2012 - Added Workstation 9.x to Products 09/05/13 -Added workstation 10 and Player 6 to product versions.

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 384 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (4000 or fewer characters)
  • 384 Ratings
Actions
KB: