Solving VMware network problems on Linux VMware guests

When you use VMware Server software to move or clone VMware Linux guest machines, you are asked by the VMware software if it should update the configuration file. When updating the configuration file, as requested by the software, your once working network settings won’t work anymore.

The following will help you to get on your way resolving these network problems, caused by MAC addresses, which are now out of sync.

The VMware configuration file

The updated configuration file with the extention vmx, contains a lot of information about the virtual machine that you have created, for instance information about your NIC (network) card, and is located in the same directory where your VMware machine files where created (for example C:\Virtual Machines\RHEL3U8_32).

The contents of my local (VMware Server version 1.1) vmx configuration file (C:\Virtual Machines\RHEL3U8_32\Red Hat Enterprise Linux 3.vmx) looks like:

config.version = "8"
virtualHW.version = "4"
numvcpus = "2"
scsi0.present = "TRUE"
memsize = "1024"
scsi0:0.present = "TRUE"
scsi0:0.fileName = "RHES3_32_HD01-000002.vmdk"
ide1:0.present = "TRUE"
ide1:0.fileName = "auto detect"
ide1:0.deviceType = "cdrom-raw"
floppy0.present = "FALSE"
Ethernet0.present = "TRUE"
displayName = "RHEL3U8 - 11GR1B1"
guestOS = "rhel3"
priority.grabbed = "normal"
priority.ungrabbed = "normal"
 
scsi0:1.present = "TRUE"
scsi0:1.fileName = "RHES3_32_HD02-000002.vmdk"
ide1:0.autodetect = "TRUE"
 
scsi0:0.redo = ""
scsi0:1.redo = ""
ethernet0.addressType = "generated"
uuid.location = "56 4d d3 5d de 35 5f 1a-12 be 75 4f f9 c1 9e 66"
uuid.bios = "56 4d d3 5d de 35 5f 1a-12 be 75 4f f9 c1 9e 66"
ethernet0.generatedAddress = "00:0c:29:c1:9e:66"
ethernet0.generatedAddressOffset = "0"
 
Ethernet0.connectionType = "nat"
 
ide1:0.startConnected = "FALSE"
 
checkpoint.vmState = ""
checkpoint.vmState.readOnly = "FALSE"

It contains all necessary info needed for my VMware Server software to start-up and/or deal with this environment.

Updating the configuration file will also update the unique MAC address mentioned in this file.

ethernet0.generatedAddress = "00:0c:29:c1:9e:66"
ethernet0.generatedAddressOffset = "0"

Cloned and/or moved VMware machines will therefore have a different MAC addresses in the vmx configuration file and in the Linux VMware guest environment and network traffic is not possible anymore between host and guest environments. The following actions, SUSE and RedHat environments are used as an example, can be taken to straighten up these network problems.

The examples are based on the first Ethernet card in your system, referenced by eth0.
If your system uses more Ethernet network cards, then replace the number 0 (of eth0) by the number that references your Ethernet card.

RedHat

  1. Take a note off the newly generated address, for example the shown value ’00:0c:29:c1:9e:66′
  2. Startup your virtual Linux machine.
  3. Login on your Linux environment with the root account, via the VMware console, and open a terminal window.
  4. In the directory /etc/sysconfig/network-scripts there will be a file for your (virtual) Ethernet card called ifcfg-eth0. This file contains your Linux
    MAC address.
  5. Update the MAC address in the ifcfg-eth0 file with the same MAC address as shown in your VMware vmx-configuration file (eg. ’00:0c:29:c1:9e:66′).
  6. Activate your Ethernet card by executing the “ifup eth0″ statement on the Linux command prompt (use ifdown eth0 to de-activate the Ethernet card).

SUSE

  1. Take a note off the newly generated address, for example the shown value ’00:0c:29:c1:9e:66′
  2. Startup your virtual Linux machine.
  3. Login on your Linux environment with the root account, via the VMware console, and open a terminal window.
  4. In the directory /etc/sysconfig/network resides a file with a part of the MAC address in its name.
    vamisux00:/# /etc/sysconfig/network # ls -l if*
     
    ifcfg-eth-id-00:50:56:a0:17:d7
  5. Rename this file to match the MAC address mentioned in your VMware configuration file.
    vamisux00:/# mv ifcfg-eth-id-00:50:56:a0:17:d7
                    ifcfg-eth-id-00:0c:29:c1:9e:66
  6. Activate your Ethernet card by executing the “ifup eth0” statement on the Linux command prompt (use ifdown eth0 to de-activate the Ethernet card).

Check your status

A method to check if everything went well is to use the ifconfig statement.

vamisux00:/# ifconfig /alla
 
eth0 Link encap:Ethernet HWaddr 00:0c:29:c1:9e:66
inet addr:10.10.10.10 Bcast:10.252.252.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5962141 errors:0 dropped:0 overruns:0 frame:0
TX packets:3686442 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6098753239 (5816.2 Mb) TX bytes:876441853 (835.8 Mb)
Base address:0xecc0 Memory:fe6e0000-fe700000
 
etc

If everything went OK; it will be possible to ping the outside world from within your virtual machine.

HELP – MAC address not unique (on your network)!

A MAC address should be unique on a network (theoretically) and reflects in its values, amongst others, the manufacturer of the network card and a unique number for the card itself. That this isn’t always the case, is often proven on big LAN events or by spoofing a MAC address manually on your Wireless LAN card.

I was in situation already once regarding cloning a VMware machine. I still don’t know why, but VMware generated every time the same MAC address. Anyway, I found the solution via the VMware community.

A Linux tool called vmmacgen (the VMware MAC Generator) exists, with which you can generate a unique MAC address. This is a Linux binary executable and therefore must be run on a Linux operation system. The vmmacgen tool can be found on the http://www.vmguru.com website.

It is described there as:

This is a small binary application written by Parag Mehta from VMware that randomly generates a valid MAC address that can be utilized by VMware ESX Server. The MAC addresses generated falls within the valid range of “Static” MAC Addresses that may be manually assigned in the virtual machines VMX file.

So I tried it also with VMware GSX and Server software, and it did the trick. The following is an example of its output.

vamisux00:/# file vmmacgen
 
vmmacgen: ELF 32-bit LSB executable, 
Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5,
dynamically linked (uses shared libs), not stripped 
 
vamisux00:/# ./vmmacgen
 
vmmacgen - 1.0
Generated Static MAC address is : 00:50:56:9:BA:95

Add the above generated MAC address as follows:

Ethernet{n}.addressType="static"
Ethernet{n}.address = "00:50:56:9:BA:95"
 
***** Remember to remove the following three lines *****
Ethernet{n}.generatedAddress
Ethernet{n}.addressType = "vpx" or "generated"
Ethernet{n}.generatedAddressOffset

You will have to use these generated values in your VMware vmx configuration file.

An example of a vmx configuration file before the change:

ethernet0.present = "TRUE"
ethernet0.networkName = ""
ethernet0.addressType = "vpx"
ethernet0.generatedAddress = "00:50:56:a0:17:d7"

An example of a vmx configuration file after the change:

ethernet0.present = "TRUE"
ethernet0.networkName = ""
ethernet0.addressType = "static"
ethernet0.address = "00:50:56:9:BA:95"

So the following changes were made:

  • The ethernet0.addressType value has to be changed to static
  • The ethernet0.generatedAddress parameter has to be changed to ethernet0.address
  • The old MAC address has to be replaced with the generated MAC address