5.4. MAC AddressesAs 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 OverviewThe 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 FilesThe 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.
5.4.2. Manually Setting MAC AddressesThere 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
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
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:
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:
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 FileIt'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. |