Everyday Virtualization

Blog archive

User-Specified MAC Address Within a VM

Reading through my past blogs, I saw a nice post by Vladan Seget on setting a virtual machine's MAC address within vSphere. This is an issue that comes up regardless of virtualization platform and there is no clear way to address fixed MAC addresses other than specifying one in a virtual machine.

Reasons for requiring a MAC address on a virtual machine to be user-specified usually stem from a P2V conversion, where an installed piece of software requires a MAC address as a licensing mechanism. Other situations can arise due to network address control (NAC) systems in use on a network or the Internet, which, again, may stem from a P2V conversion.

Before I explain how to change a MAC address, it is worth outlining a summary view of the MAC address nomenclature. There are six parts to a MAC address. The first three are pairs of hexadecimal numbering that are referred to as a MAC unique identifier. Ironically, these are the unique identifiers of the network interface controller (NIC) manufacturer and are replicated all the time. The last three parts of two hexadecimal numbering is the unique instance of that MAC address from the NIC brand.

Take, for example, the following MAC address: 00-0C-29-D3-88-7C. 00-0C-29 is the MAC unique identifier for VMware ESX virtualization, and D3-88-7C is the specific VM. Each hypervisor and NIC brand has a designated MAC unique identifier. Be sure to see this scorecard of virtual machine MAC address identifiers.

Depending on the hypervisor, the MAC address can be specified a number of different ways. Sun VirtualBox has a field that you can simply type in a desired MAC address. VMware vSphere allows you to specify it within the vSphere Client for user-specified addresses in the range of 00-0C-29-xx-xx-xx. For vSphere environments, if an address outside of this boundary needs to be used, you'll be required to edit the machine's .VMX file.

A custom MAC address set for a system at my private lab
Figure 1. VMware virtual machines can use the default range of MAC addresses, or a user specified address.(Click image to view larger version.)

VMware has this KB article on how to set a static MAC address for a virtual machine, but I recommend you use this sparingly, and avoid it if possible. One example where a static MAC address definition can be avoided is a system with a DHCP reservation. The reservation could be changed from the current physical server's MAC address to the new, auto-created address of the virtual machine.

Do you find you're having to modify MAC addresses often? I've only had to do it a few times, of which I can count on one hand. Share your tricks and tips here for this practice.

Posted by Rick Vanover on 04/22/2010 at 12:47 PM


Subscribe on YouTube