Section 5.4. MAC Addresses


5.4. MAC Addresses

As you probably know, every physical NIC has its own unique MAC address. This is burned into the NIC by its manufacturer prior to shipping. What you may or may not know is that every virtual NIC has its own unique MAC address as well. A virtual NIC's MAC address can be changed manually if necessary.

5.4.1. MAC Address Overview

The MAC address is a six-byte hexadecimal number that looks something like this: 00-09-6B-BF-6D-31.

The first three bytes are a unique Vendor ID for the manufacturer of the network adapter. This is called the organizationally unique identifier or OUI. In the MAC address example, the OUI would be 00-09-6B, which is IBM.

Although VMware does not manufacture a physical network adapter, it does provide virtual ones. Thus, VMware has its own OUI; in fact, it has two.

The first VMware OUI is for automatically generated MAC addresses, and in most cases these are the MAC addresses your virtual machines will use. The second VMware OUI is used for MAC addresses that are manually set.

If you were to vi (see Chapter 13) one of your virtual machine's configuration files, it might look something like the image in Figure 5.22

Figure 5-22. A vi of a Virtual Machine's Configuration Files


The third line down, "Ethernet0.addressType =" shows that the MAC address, also known as the Ethernet address or physical address, has been automatically generated. The sixth line down, "ethernet0.generatedAddress = " shows that the MAC address in this example is 00:0c:29:c8:7f:88. The first three bytes, 00:0c:29, represent VMware's OUI for automatically generated MAC addresses. Every MAC address that is automatically generated in ESX (as well as GSX or Workstation) will have this OUI value. However, for the last three bytes, ESX Server uses a specific algorithm to generate MAC addresses.

Configuring & Implementing…
VMware's Algorithm for MAC Address Generation

The following is taken from the ESX Server 2.5 Administration Guide and describes how VMware' s algorithm for MAC address generation works:

"We use the VMware UUID (Universally Unique Identifier) to generate MAC addresses. We then check for any conflicts. If there is a conflict, we add an offset and check again, until there is no conflict. (The VMware UUID is based on the path to the virtual machine and the host's SMBIOS UUID.)

Once the MAC address has been generated, it does not change, unless the virtual machine is moved to a different locationfor example, a different path on the same server or a different ESX Server machine. We save the MAC address in the configuration file of the virtual machine.

ESX Server keeps track of all MAC addresses that have been assigned to the network adapters of running and suspended virtual machines on a given physical machine. ESX Server ensures that the virtual network adapters of all of these virtual machines have unique MAC addresses.

The MAC address of a powered-off virtual machine is not checked against running or suspended virtual machines. Therefore, it is possible, but unlikely, that when a virtual machine is powered on again, it can get a different MAC address. This is due to a conflict with a virtual machine that was powered on when this virtual machine was powered off."


5.4.2. Manually Setting MAC Addresses

There may be times when you need to manually set the MAC address of a virtual NIC due to address conflict or if you just want to practice doing it (we recommend this be done only in your test environment). To manually set a MAC address, you first need to know VMware's second OUI, which is 00:55:56. Next, you have to know what the range of the last three bits is.

Hexadecimal begins with 0 and ends with F. So, the range of any hexadecimal value is 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,fthus, you have 16 possibilities instead of the normal ten we're used to.

We know that we must first start with the OUI value, which for a manually set MAC address is

00:55:56:xx:yy:zz

xx. Yy.zz are the last three bits, and so the range for those values is 00.00.00 through 3f:ff:ff. Thus, the complete range of a manually set MAC address is

00:55:56:00:00:0000:55:56:3f:ff:ff

For the first of the last three bits, or the xx portion, you cannot go above 3f. Ranges above 3f are reserved for VMware GSX and VMware Workstation. Here are some examples of possible MAC addresses that you can manually set:

00:55:56:01:00:ff
00:55:56:0a:bb:01
00:55:56:3e:ff:f9

A recommendation you might want to follow if you are going to set MAC addresses manually is to pick a range of MAC addresses, say, 00:55:56:01:a1:zz, and only increment the last bit until you run out of values, which in this example would be ff, thus allowing for 256 MAC addresses. Make sure you document your MAC address range and the virtual machines that receive them. This will help keep you from assigning the same MAC address to multiple virtual machines. If you have multiple ESX Servers, you may want to have multiple MAC address ranges, such as the following:

ESX Server 1 = 00:55:56:01:a1:zz
ESX Server 2 = 00:55:56:02:a2:zz
ESX Server 3 = 00:55:56:03:a3:zz

So, now that you understand how to manually set a MAC address, you need to know where to set it.

If you vi a configuration file for your virtual machine and enter the Insert mode (Chapter 13), you need to edit two lines (see Figure 5.22).

The first line to edit in the previous example is the Ethernet0.addressType = "generated." You need to change the "generated" to "static." Next, in this example, you need to change the ethernet0.generateAddress = "00:0c:29:c8:7f::88. Here, the MAC address has been changed from 00:0c:29:c8:7f:88 to 00:55:56:01:a1:01. Save the changes to your configuration file and then vi the file again and you should see the changes (see Figure 5.23).

Figure 5-23. Changes Made to the Configuration File


It's important that you follow this MAC address convention as ESX Server does not support any random MAC address scheme. Following this convention ensures you never run into a MAC address conflict within your environment.




Virtualization With VMware ESX Server
Configuring VMware ESX Server 2.5 (Vol 1)
ISBN: 1597490199
EAN: 2147483647
Year: 2005
Pages: 173

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net