http://virtrix.blogspot.com/2007/04/vmware-configuring-static-mac-address.html

VMware: configuring a static MAC address in a VM


Sometimes it can be necessary to configure a static MAC address in a VM. A typical issue during P2V is an application that has its licensing based on the MAC address.

VMware has defined that VirtualCenter does not use the following range: 00:50:56:00:00:00 to 00:50:56:3F:FF:FF where 00:50:56 is the OUI.

The steps:

  1. Power off & remove the server from the VirtualCenter inventory. This is a necessary step, because VC will overwrite your settings during Power On!
  2. Edit the .vmx file and locate the following generated MAC address:
    Ethernet0.addressType =
    and
    Ethernet0.generatedAddress =
  3. Change the value for ethernet0.addressType from “vpx” to “static”
  4. Change ethernet0.GeneratedAddress to ethernet0.Address
  5. Change the current MAC to a MAC address in the following range:
    00:50:56:00:00:00-00:50:56:3F:FF:FF
  6. In VirtualCenter, select an ESX host and go to storage
  7. Browse the data store & locate your VM
  8. Right-click on the .vmx file, and select Add to inventory
  9. Power On the server. Issue the command ipconfig /all and locate the VMware NIC. Your manually assigned MAC address should be there.
I know you can set your MAC address inside Windows, but I would avoid this.

4 reacties:

Jase zei
You are correct that VirtualCenter will overwrite your settings.

However, if you start the VM from the command line on the ESX host, VirtualCenter will not overwrite the .vmx settings.

Also, you can force this setting from inside VirtualCenter.

With the VM powered off, choose Edit Settings, choose Options, choose Advanced, choose Configuration Parameters, then Add Row, you can enter the ethernet0.addresstype and ethernet0.address values.

Once added, they will disappear the next time you look at the Configuration Parameters window, but the changes will be there.

Good post though.

Thanks,
Jase
http://www.jasemccarty.com/

april 02, 2007 2:21 PM Cova zei
Or you could use the tool I wrote to automate this. Our environment requires a fixed MAC address for every server, and I got sick of doing them manually.

It is currently hosted over at www.run-virtual.com - you can get it here:
http://www.run-virtual.com/?page_id=173

april 02, 2007 9:20 PM Vincent Vlieghe zei
I do agree with Rob: when you have to do it x-times, use his VirtualMACTool. Tried, tested & working :)

april 04, 2007 11:02 AM budzy zei
Changing the physical address in windows is fine.

april 10, 2007 3:28 PM



extra info :



 

How do I avoid having Duplicate MAC Addresses on the virtual NICs


Let me preface this with 'What is a MAC Address' : Without trying to get technical, and in plain English, it is the number of the network card, like a serial number, that allows Ethernet equipment to "find" who it wants to talk to. There are a bunch of protocols to translate from MAC to IP address (ARP), and other things - However what you need to know is an Ethernet has packets for several different computers on the "wire" by design, the MAC destination is what the card (driver) looks for, and if it is destined for itself it tells the operating system to deal with it - If it is destined for somewhere else then it ignores the packet.

Most of the better designed cards (i.e. not your super cheap made in ___ cards) have a truly distinct serial number. Some of the junk quality cards have same serial numbers and come with software to reprogram the MAC address if you happen to buy two with the same serial number. That will cause all kinds of problems for your local network if you ever have that situation.

The same problems can be caused by virtual NICs if you have the same MAC numbers in multiple guests (especially if on physically different segments of a switched network, see things like ARP spoofing / MAC spoofing attacks).

This said the host and guests can't share the same MAC address.

Therefore Microsoft uses virtual MAC addresses for each guest. This virtual MAC address, just like a real one, could be duplicated. They build a distinct MAC from a GUID and store it in the .VMC configuration file. If you copied the .vhd and the .vmc files to another host the MAC address would move.

When you are operating in a layer 2 switched Ethernet network (which most everyone is nowdays) the switches have MAC caches - so the switch "remembers" where each MAC is and sends the packets down the correct wire based on this table of MAC addresses. If you move a MAC from one segment to another your switches may have a problem realizing there is a change. Usually an ARP packet will fix this, or an announcement packet.

If you happen to run into this the easier fix is to ping a non existant IP on your LAN, from the guest, in order to generate an ARP packet originating from your IP / MAC. This should find it's way through all your switches and reset their ARP lookup tables. Last Updated ( Wednesday, 26 March 2008 )