Changing the MAC address of a hosted virtual machine

Details

This article provides best practices and reasons for changing 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 = “

where N is the adapter being changed.


Based on VMware KB  507
  • 0 Utenti hanno trovato utile questa risposta
Hai trovato utile questa risposta?

Articoli Correlati

Hardware and firmware requirements for 64-bit guest operating systems

PurposeThis article explains the host machine hardware and firmware requirements for installing...

Logging in to the vCenter Server 5.0 Web Client fails with the error: unable to connect to vCenter Inventory Service

DetailsAfter upgrading from vCenter Server 4.1 to 5.0, you experience these symptoms:Cannot log...

Multiple network entries in vCenter Server 5.0.x after migrating virtual machines from a virtual switch to a virtual distributed switch

SymptomsAfter migrating virtual machines from a virtual switch to a virtual Distributed...

Minimum requirements for the VMware vCenter Server 5.x Appliance

PurposeIf you are using the VMware vCenter Server Appliance, beginning with vSphere 5.0 you can...