How can I set a fixed MAC address on my VM? I have software that requires this.
Here's what I have documented, two ways to do this...
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 VMs 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), VMwares OUI is 00:50:56. The last 3 octets are assigned to all of the NICs 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 NICs. If you are coming from a physical server you can use the previous NICs range instead, (ie. HP/Compaq NICs 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 Vmwares 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 thats 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
-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-
Here's what I have documented, two ways to do this...
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 VMs 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), VMwares OUI is 00:50:56. The last 3 octets are assigned to all of the NICs 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 NICs. If you are coming from a physical server you can use the previous NICs range instead, (ie. HP/Compaq NICs 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 Vmwares 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 thats 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
-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-
So no matter what physical NIC is used on the ESX server my VM MAC will stay the same?
Yes, each VM has their own unique MAC address that is independent of the ESX servers physical NICs.
If you want to learn more about networking check these out...
VMware ESX Server 3 802.1Q VLAN Solutions - http://www.vmware.com/pdf/esx3_vlan_wp.pdf
Networking Virtual Machines - http://download3.vmware.com/vmworld/2006/TAC9689-A.pdf
Networking Scenarios & Troubleshooting - http://download3.vmware.com/vmworld/2006/tac9689-b.pdf
ESX3 Networking Internals - http://www.vmware-tsx.com/download.php?asset_id=41
Thank you, Ninja grateful
Hello,
Thank you for the post on changing MAC Addresses. Once the config file is modified and VM is powered back on, I ran into a snag where it seems that the config file modifications don't take into effect. Is there anything else that needs to be done to apply the new file settings ?
Thank you
http://www.run-virtual.com/?page_id=173
You need this tool to make things a lot easier.
There is only a certain range you can use for MAC, that you can apply static address, otherwise, the MAC is generated by the VI console, and not the ESX server.
So if you changed the MAC address, it may have changed it back when the VM was powered on, because it may have been outside the allowable range.
If you edit the VMX file again are your changes still there? Did you use a valid MAC address (0-9 and a-f). Also if you do the editing of the vmx file method you must stay inside Vmwares allowed MAC address range(00:50:56:00:00:00 00:50:56:3F:FF:FF). If you can post your vmx file I can check it out for you.
Esiebert,
I tried the process you outlined by changing the NIC properties in Windows and found that if I set the MAC address outside the VMWare range the network connection would not work - the VM would not connect to the internet.
My impression from your description was that I should be able to set any MAC address I want using this method. Any idea what I might be doing wrong?
Thanks.
Which VMware product are you using?
Workstation 5.5.1
Oops
I didnt even notice the forum title as I'd entered through a search result.
The MAC address stays within the VMware product range by design. You can try to spoof the MAC address inside the Guest OS. That can be done either by setting the address in the virtual NIC or a registry hack, depending on which OS you have.
No problem, I've only tested and done this with ESX, I'm not sure how it works with Workstation. If you start a thread in the Workstation forum the guys over there can probably help you out.