Sunday, October 28, 2007

Ubuntu and VMWare VM Copies

The Problem:
I had created Ubuntu Server based virtual machine through VMWare Server sometime back and was in the process of creating two Ubuntu servers that would need to run simultaneously in a LAN. Each VM was using NATed networking and were getting the IP addresses through DHCP. Keeping the original as it was, I created 2 copies of the virtual machine files. As per VMWare recommendations, on startup for each new VM, I had VMWare create a new UID to prevent confusion.

I was pleasantly surprised to find that everything worked perfectly when I brought up each of the servers up separately but then when I brought both up, the one that came up second, started having network issues - specifically there seemed to be a IP / MAC address conflict between the 2 machines.

Initially I thought it was a VMWare issue. Perhaps VMWare was not creating a unique MAC address for the virtual machines when I copied them across. The vmx file which stores the VM meta information seemed to be the potential culprit and I all that was possible to do to make sure that the information in there was good. But eventually I had to admit that VMWare was handling this part of its functionality without a flaw. So where was the problem? Who or what was storing MAC addresses that was eventually leading to the conflict?

The Solution:
The answer was simple when I finally found it somewhat indirectly at the following posting. The two copies were being told by VMWare about their physical MAC addresses correctly. However, Ubuntu (V6.10) remembers the mapping between hardware ethernet addresses and the ethN name that they should get through the information in the /etc/iftab file. Since I had the exact same value for MAC address in all three iftab contents I kept getting conflict reports. Once I edited the contents in the 2 VM copies and matched them with the values configured in the vmx file everything started working fine.

Note the updates in this bug report though.

UPDATE: Its important to realize that by default in bridged networking, VMWare will select the first available interface to bridge. This may not be the interface you want to bridge over resulting in problems. Use the vmnetcfg.exe tool on Windows to select the interface to bridge over.

No comments: