Network conflict resolution: Changing a virtual machine MAC address

A virtual machine MAC address is randomly generated, but that doesn't guarantee you won't have duplicates. Find out how to change a VM's MAC address.

Is a virtual machine MAC address important, and how do I change it?

Media Access Control addresses have been around for a long time. Originally, each network interface was given a unique MAC address consisting of 12 numbers and letters (0-9, A-F) in the format XX:XX:XX:XX:XX:XX. Each manufacturer had its own sequence for the first half, and each network device was given a unique set of characters for the second half.

This system ensured every network device in the world had a unique MAC address, which differs from an IP address that an end user generally assigns or changes.

Today, most people don't give a virtual machine MAC address a second thought, because it is automatically created. Regardless of which virtualization platform you use, the same rules for generating MAC addresses apply. The first six characters indicate the manufacturer (e.g., VMware or Microsoft) and the next six are randomly generated. Each platform has its own rules about how to generate random addresses, but there are a few scenarios in which you may get two VMs with the same MAC address. When this occurs, it is usually referred to as a duplicate MAC address.

The most common cause of a duplicate MAC address is cloning a client. Physical-to-virtual and virtual-to-virtual copies will often keep as many settings the same as possible, including the MAC address. This isn't a problem unless you plan to keep both the original and the copy on the same network at the same time.

So, with all this in mind, what problems will a duplicate MAC address create?

Without diving too deep into the subject, MAC addresses are used at Layer 2 of the seven-layer OSI model. The Address resolution protocol is used to correlate IP addresses and MAC addresses, and you can view the cached ARP table on most network devices.

Network devices on the same network communicate via MAC address. This is done by either broadcasting the request to the current subnet and getting a response from the right device, or checking the local ARP cache as per the ARP table. The ARP table is populated from the initial broadcast to make network communication more efficient.

On a Windows server, you can view the ARP table by going to a command prompt and running the command arp -a.

When the ARP table is used, it will send the network traffic off to the matching IP address with no further checks. This can cause network loops and timeouts where traffic is being sent back and forth between devices but never getting to its destination.

You can view the actual MAC address in use on a Windows box with the command ipconfig /all.

Changing a virtual machine MAC address on Hyper-V or VMware is easy. Within the VM's properties, under Hardware, there will be a network adapter clearly showing the current MAC address. You can change the option to Manual (for VMware) or Dynamic (for Hyper-V) and enter a different virtual machine MAC address.

Microsoft System Center Virtual Machine Manager for Hyper-V propertiesMicrosoft System Center Virtual Machine Manager for Hyper-V properties
Adjusting VMware VM propertiesAdjusting VMware VM properties

I would recommend checking the ARP table on the same network to make sure the new MAC address you assign isn't already in use.

Keep in mind that you may need to clear the ARP cache on devices that continue to have connectivity issues (including switches and routers). On a Windows box, you can clear the local cache completely with the command arp -d *.

Dig Deeper on Virtual machine provisioning and configuration