Home > VMWare > Manually assigning Mac Addresses to VMs

Manually assigning Mac Addresses to VMs

So let’s say we have a VM and it has a VMWare assigned Mac Address – but we want to specify a different MAC for the VM (either a previously assigned automatic VM one, or a 3rd Party one)

You have a few options.

1)    VMware provide this: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=507 – but I have had mixed results and sometimes needed to use MAC addresses that are not VM specific

2)    3rd party tools for changing the MAC in the OS (Windows in this case) http://download.cnet.com/SMAC-MAC-Address-Changer/3000-2085_4-10536535.html

3)    Edit the Mac Address on the NIC itself in TCPIP properties for the NIC (though often software can get around this .

4)    Have a hack around the VMX files:

Well there are a few posted articles, showing us how to assign VMware approved Macs (00:50:56:XX:XX:XX), but let’s say my software is licensed to a MAC 00:50:56:22:22:44 . and I have converted the host using a P2V . . what now?

Using the edit settings option for a VM only allows Macs within the alloted range. Annoyingly, even the the MAC address is stored in the .vmx file . . changing it here does not always reflect a change, as the minute you make a change to the NIC (e.g. change port group) it will validate the Mac Address and again kick up errors and get all emotional.

Even worse, the database for the VC saves the old MAC, so it may even revert to the VMware assigned MAC that was provisioned when you created the NIC – or will do so each time you make a subsequent change to the vNic.

Well first of all, let’s have a  look at the .vmx file (stored at /vmfs/volumes/<datatsore>/<VMname>/<VMname.vmx>   (by default at least)

You can access this by using a tool like WinSCP to connect to the ESX host directly.

If we look in this .vmx file, we see the following Ethernet related entries:

ethernet1.present = "true"
ethernet1.virtualDev = "vmxnet3"
ethernet1.networkName = "BACKUP_32_10.0.224.0"
ethernet1.addressType = "vpx"
ethernet1.generatedAddress = "00:50:56:b2:63:25"
ethernet1.pciSlotNumber = "160"
ethernet1.features = "1"
ethernet1.startConnected = "TRUE"

OK, we want to flush the history in the VC and create a new adapter with our own select MAC.

First of all, let’s remove the NIC from the VM (Right click the VM – Edit Settings)

If we now re-open the .vmx file we get the following ethernet entries:

ethernet1.present = "false"

Great, the remaining entries have been flushed.

Now, we’d like to edit the .vmx file and commit changes, so we need to unregister the VM – we can use the VC for this (right-click Vm and select ‘remove from Inventory’

Now let’s re-add the old details to the .vmx file, but

Sspecify these for a new adapter number

Amend the Mac Address

Amend the PCI Slot Number (incremented it by 10 this time – hit and miss though)

ethernet2.present = "true"
ethernet2.virtualDev = "vmxnet3"
ethernet2.networkName = "BACKUP_32_10.0.224.0"
ethernet2.addressType = "STATIC"ethernet2.pciSlotNumber = "180"
ethernet2.features = "1"
ethernet2.startConnected = "TRUE"

Note, if the MAC is a non VMware one, you’ll need to specify :

ethernet2.addressType = "STATIC"
ethernet2.address = "00:00:00:12:34:56"

If it is a previsouly automatically assigned VMware one that you are recycling:

ethernet1.addressType = "vpx"
ethernet1.generatedAddress = "00:50:56:b2:63:25"

Now simply right click the .vmx file from the Datastore Browser and Viola!

Of course, I under no circumstance endorse or support this, but I have to mention that I have been forced to use this for applications where applications were licensed to Mac addresses and I had migrated to VMware.

[category VMWare]

[tags VMWare]

Categories: VMWare Tags:
  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.