VMware

This Question is Answered

2 "helpful" answers available (6 pts)
6 Replies Last post: Jul 9, 2007 9:31 AM by esiebert7625  

Hard-coding static MAC address for VM..do I need to posted: Jun 13, 2007 12:13 AM

Click to view mikeyboy's profile Enthusiast 81 posts since
Jun 21, 2006
Hi, please can anyone advise. We have an ESX Server 2.5.2 farm and we sometimes migrate VMs between hosts with Virtual Center (we power them off first and cold-migrate them, we don't use VMotion).

We have an app that requires a static MAC address; if it ever changes we will have problems.

I know that by default the MAC address is automatically generated when a VM is created and stored in the .vmx file in the ethernet0.generatedaddress parameter. I have done some testing where I have powered off the VM in question (which has an automatically generated MAC) and moved it from host to host and powered back on. I've done this a number of times and that MAC address has never changed. I've also looked at some other VMs we have that rely on a static MAC address which I know have moved about in the past, and we've never had a problem with MAC addresses changing. Which is what I want.

However...I have read some posts and KB articles stating that the MAC address *might* change and therefore I should be looking to 'hard-code' that MAC address as a static address.....is that correct for ESX 2.5.2, and under what circumstances might it change (bearing in mind that I've not seen any instances in my environment where the automatically generated MAC address has ever changed)?

Thankyou
Michael
Click to view Dave.Mishchenko's profile Guru 8,983 posts since
Nov 15, 2005
You can change ethernetN.GeneratedAddress to ethernetN.address in the VMX if you want to prevent a change, but when you upgrade to ESX 3.0 the VMware OUI range will change to start with 00:50:56.

You can also set the MAC manually on a Windows host if you bring up the properties for the NIC and then set the NetworkAddress field on the Advanced tab.
Click to view MR-T's profile Champion 4,146 posts since
Apr 19, 2005
The manual says "After the MAC address has been generated, it does not change unless the virtual machine is moved to a different location, for example, to a different path on the same server. "

Try this, to see if you can make it change.
Click to view VMNU's profile Novice 6 posts since
Mar 16, 2005
Hi

You will need to add/alter the following lines within the VMX file to the following:

Removing the two lines that begin with the following:
ethernet[n].generatedAddress = "00:0c:29:xx:yy:zz"
ethernet[n].generatedAddressOffset = "0"

Edit the following line:
ethernet[n].addressType = "generated"
Change to
ethernet[n].addressType = "static"

and add the following line:
ethernet[n].address = "00:50:56:xx:yy:zz"

In these options, [n] is the number of the virtual Ethernet adapter — for example ethernet0.

That way it will not change MAC.

Cheers
Click to view esiebert7625's profile Guru 6,794 posts since
Oct 23, 2006
Here's some documentation I wrote on this...

http://vmware-land.com/Vmware_Tips.html#Net3

How can I set a static MAC address for my VM?
This is useful for software that is licensed by the MAC address of the server it is running on or if you migrate a physical server to virtual and want to keep the same MAC address. A VM’s MAC address will change if the location of the VM changes, ie. different path on the same host. During a hot migration (Vmotion) the location of the VM does not change, this is also true of a VM that changes hosts due to HA/DRS migration. During a cold migration the location of the VM does change so the MAC address of the VM will change.

MAC addresses are hex values and consist of six groups of hex numbers. The first 3 octets of the MAC address is a unique code assigned to each NIC vendor, this is also called the Organizationally Unique Identifier (OUI), VMware’s OUI is “00:50:56”. The last 3 octets are assigned to all of the NIC’s for that vendor. Each MAC address must be unique to avoid conflicts with other network devices. You do not have to use the VMware assigned range (00:50:56) for your NIC’s. If you are coming from a physical server you can use the previous NIC’s range instead, (ie. HP/Compaq NIC’s use 00:08:02) as the first 3 octets. Just make sure the physical NIC and virtual NIC with the same MAC address are not active on the same physical network at the same time. There are several methods for setting a static MAC address on a VM which are listed below. If you use the first method you must stay inside VMware’s allowed MAC addresses (00:50:56:00:00:00 – 00:50:56:3F:FF:FF) or the VM will not start

Editing the VMX file of the VM:
• Edit the VMX file of the VM
• Change the following line from ethernetN.addressType="vpx" to ethernetN.addressType="static" (N is the number of your ethernet adapter, usually 0)
• Next change the line “ethernetN.GeneratedAddress” to “ethernetN.address” and then change the current MAC address to “00:50:56:XX:YY:ZZ” (again N is the number of your ethernet adapter and 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.)
• Power your VM back on. Login to the OS, go to the CMD prompt and type “ipconfig /all”, your manually assigned MAC address should be listed for the NIC that you changed

Setting the NIC properties in Windows:
• Edit the Local Area Connection propeties for the NIC you want to change
• Click the Configure button next to the NIC name
• On the Advanced tab select NetworkAddress
• In the Value field enter a new value for the MAC address, enter only numbers or letters, no spaces, dashes or colons. This MAC address can be any valid hex numbers between 00 and FF for any of the octets
• Click OK and that’s it, the new MAC address takes effect immediately and will override any MAC address set by Vmware

Fyi…if you find this post helpful, please award points using the Helpful/Correct buttons.
-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-
Thanks, Eric
Visit my website: http://vmware-land.com
-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-
Click to view esiebert7625's profile Guru 6,794 posts since
Oct 23, 2006
Typically cold migrations are used for VM's that are on local storage, if the VM was on shared storage most people vmotion it hot to another ESX host. So yes if you do a cold migration and the VM does not change locations then the MAC address will not change.

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities