VMware
 

Knowledge Base

Search the Knowledge Base:

Products:
Search In:
 

Changing the MAC Address of a Virtual Machine

Details

What are the best practices and reasons for changing the MAC address of a virtual machine?

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 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 following 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 receive a different MAC address.

For more information about editing a virtual machine's configuration file (.vmx), see www.vmware.com/support/kb/enduser/std_adp.php?p_faqid=1714.

Manually Assigning a MAC Address in Workstation and GSX Server

If you want to guarantee that the same MAC address is assigned to a given virtual machine every time, even if the virtual machine is moved, or if you want 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.

Remove the three lines that begin with the following from the configuration file:

ethernetN.generatedAddress
ethernetN.addressType
ethernetN.generatedAddressOffset
Add the following line to the configuration file:
ethernetN.address = 00:50:56:XX:YY:ZZ
In this line, XX must be a valid hexadecimal number between 00h and 3Fh, and YY and ZZ must be valid hexadecimal numbers between 00h and FFh. Because VMware Workstation virtual machines do not support arbitrary MAC addresses, you must use the above format.

So long as you choose a value for XX:YY:ZZ that is unique among your hard-coded addresses (where XX is a valid hexadecimal number between 00h and 3Fh, and YY and ZZ are valid hexadecimal numbers between 00h and FFh), conflicts between the automatically assigned MAC addresses and the manually assigned addresses should never occur.

Manually Assigning a MAC Address in ESX Server

In order to work around both the limit of 256 virtual network adapters per physical machine and possible MAC address conflicts between virtual machines, the MAC addresses can be assigned manually by system administrators. VMware uses a different OUI for manually generated addresses: 00:50:56. The MAC address range is 00:50:56:00:00:00-00:50:56:3F:FF:FF.

You can set the addresses by adding the following line to a virtual machine's configuration file:

ethernetN.address = 00:50:56:XX:YY:ZZ
 
Here, N refers to the number of the Ethernet adapter, XX is a valid hex number between 00 and 3F, and YY and ZZ are valid hex numbers between 00 and FF. The value for XX must not be greater than 3F in order to avoid conflict with MAC addresses that are generated by the VMware Workstation and VMware GSX Server products. Thus the maximum value for a manually generated MAC address is
ethernetN.address = 00:50:56:3F:FF:FF
 
You must also set the option in a virtual machine's configuration file:
ethernetN.addressType="static"
 
VMware ESX Server virtual machines do not support arbitrary MAC addresses, hence the above format must be used. So long as you choose XX:YY:ZZ uniquely among your hard-coded addresses, conflicts between the automatically assigned MAC addresses and the manually assigned ones should never occur.

Keywords

507; urlz

Feedback

Rating: 1 - Lowest 2 3 4 5 - Highest (7 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? (2000 or fewer characters)
Submit
Rating: 1 - Lowest 2 3 4 5 - Highest (7 Ratings)   
Actions