News

MAC address cloning

If you've spent much time converting systems from physical to virtual, you've inevitably run into some application that has been licensed and keyed off of the MAC address of the physical system. When you're moving that system from physical to virtual, you've got a decision to make: You can either contact the software vendor and get a new license; or you can clone the MAC address from the physical server to the virtual server.

By default, MAC addresses for Virtual Machines aren't static. You need to generate a MAC address for the VM in the range 00:50:56:00:00:00 to 00:50:56:3f:ff:ff before you have the new license generated for you by the vendor. Once you have selected an appropriate address, edit the .vmx file for the VM you want to set the static MAC for and append the following lines:


ethernet0.addressType = "static"
ethernet0.address = "00:50:56:00:00:01"


There are two important things to note here. The first is that you need to manually keep track of the MAC addresses that you're assigning so you don't cause yourself headaches later. Secondly, when you give an address like this to a software vendor for licensing make sure you know how their licensing model works with respect to virtual machines before you call. It will be apparent to them that this is a generated address and may cause them to do some questioning of your licensing.

So, let's say you don't want to deal with the software vendor at all and you prefer to just clone the MAC address of the physical system. You can use the following method to specify *any* MAC address from within the guest OS:

Windows:
Right-click and select "Properties" on the network connection that you want to modify, then click the "Configure" button on the adapter, select advanced and then change the Property NetworkAddress from "Not Present" to Value "0000DEADBEEF" or whatever address it is that you're cloning.




You'll want to do this on the VM's console as you're likely to lose your remote connection at this point.

Linux:

Stop your networking service and bring the interface down ( the service command I use here is RedHat-centric )

$> service network stop
$> ifconfig eth0 hw ether 00:00:DE:AD:BE:EF
$> service network start


By default, ESX sets vSwitch security for Forged Transmits and MAC Address Changes to allow, but many administrators (myself included) set both of these policies to deny to assert some extra control over the virtual environment. If you change the MAC address by using the method inside the guest OS, you will need to ensure that the MAC Address Changes and Forged Transmit options are both set to allow if you want packets to flow in/out of your VM correctly.

Just recently, I became aware of another method to change the MAC address of a VM to any address by editing the .vmx file:


ethernet0.addressType = “static”
ethernet0.Address = “00:00:DE:AD:BE:EF″
ethernet0.checkMACAddress = “false”


The last line in the snippet above prevents ESX from doing the validity check on the MAC address for the VM. I believe this to be the best option for almost all scenarios as it gives you a number of key benefits:

  • You don't have to contact your software vendor for a new key
  • You don't have to change the security on your vSwitch to accomodate the change
  • In the event you upgrade your virtual hardware ( guest OS MAC change method ) you won't have to update the virtual nic with your custom .

    The final and most important lesson is that if you decide to clone the MAC address, you need to make sure that the physical machine that you took the MAC address from doesn't get "recycled" and hooked back up to the network. Rent a wood chipper if necessary.
  • Labels:

    Posted by Dominic Rivera at Monday, June 22, 2009.


    Archives

    10/01/2006 - 11/01/2006 | 03/01/2007 - 04/01/2007 | 04/01/2007 - 05/01/2007 | 05/01/2007 - 06/01/2007 | 06/01/2007 - 07/01/2007 | 07/01/2007 - 08/01/2007 | 09/01/2007 - 10/01/2007 | 10/01/2007 - 11/01/2007 | 11/01/2007 - 12/01/2007 | 12/01/2007 - 01/01/2008 | 01/01/2008 - 02/01/2008 | 02/01/2008 - 03/01/2008 | 03/01/2008 - 04/01/2008 | 04/01/2008 - 05/01/2008 | 05/01/2008 - 06/01/2008 | 06/01/2008 - 07/01/2008 | 08/01/2008 - 09/01/2008 | 09/01/2008 - 10/01/2008 | 10/01/2008 - 11/01/2008 | 03/01/2009 - 04/01/2009 | 06/01/2009 - 07/01/2009 | 07/01/2009 - 08/01/2009 |