Solving VMware network problems on Linux VMware guests

5

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.

....

 

SMALL UPDATE:
A maybe more readable version (and how it looked like when I posted it) can now also be found here: http://www.liberidu.com/blog/?p=117 

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:

    <br />    <br />    <br />    <br />    <p>config.version = &quot;8&quot;<br />virtualHW.version = &quot;4&quot;<br />numvcpus = &quot;2&quot;<br />scsi0.present = &quot;TRUE&quot;<br />memsize = &quot;1024&quot;<br />scsi0:0.present = &quot;TRUE&quot;<br />scsi0:0.fileName = &quot;RHES3_32_HD01-000002.vmdk&quot;<br />ide1:0.present = &quot;TRUE&quot;<br />ide1:0.fileName = &quot;auto detect&quot;<br />ide1:0.deviceType = &quot;cdrom-raw&quot;<br />floppy0.present = &quot;FALSE&quot;<br />Ethernet0.present = &quot;TRUE&quot;<br />displayName = &quot;RHEL3U8 - 11GR1B1&quot;<br />guestOS = &quot;rhel3&quot;<br />priority.grabbed = &quot;normal&quot;<br />priority.ungrabbed = &quot;normal&quot;</p>




    <p>&nbsp;<br />scsi0:1.present = &quot;TRUE&quot;<br />scsi0:1.fileName = &quot;RHES3_32_HD02-000002.vmdk&quot;<br />ide1:0.autodetect = &quot;TRUE&quot;</p>
    <p><br />scsi0:0.redo = &quot;&quot;<br />scsi0:1.redo = &quot;&quot;<br />ethernet0.addressType = &quot;generated&quot;<br />uuid.location = &quot;56 4d d3 5d de 35 5f 1a-12 be 75 4f f9 c1 9e 66&quot;<br />uuid.bios = &quot;56 4d d3 5d de 35 5f 1a-12 be 75 4f f9 c1 9e 66&quot;<br />ethernet0.generatedAddress = &quot;00:0c:29:c1:9e:66&quot;<br />ethernet0.generatedAddressOffset = &quot;0&quot;</p>
    <p>Ethernet0.connectionType = &quot;nat&quot;</p>
    <p>ide1:0.startConnected = &quot;FALSE&quot;</p>
    <p>&nbsp;<br />checkpoint.vmState = &quot;&quot;<br />checkpoint.vmState.readOnly = &quot;FALSE&quot;</p>
  

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.

    <p>ethernet0.generatedAddress = &quot;00:0c:29:c1:9e:66&quot;<br />ethernet0.generatedAddressOffset = &quot;0&quot;</p>
  

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. 

    <p>vamisux00:/# /etc/sysconfig/network # ls -l if*</p>    <br />    <p>ifcfg-eth-id-00:50:56:a0:17:d7  </p>
  

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    <br />  

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.

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

    <p>…etc</p>  <br />  

 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 machine’s 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.

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

  

Add the above generated MAC address as following:

Ethernet&lt;n&gt;.addressType=&quot;static&quot;<br />Ethernet&lt;n&gt;.address = &quot;00:50:56:9:BA:95<br />***** Remember to remove the following three lines *****<br />Ethernet&lt;n&gt;.generatedAddress<br />Ethernet&lt;n&gt;.addressType = &quot;vpx&quot; or &quot;generated&quot;<br />Ethernet&lt;n&gt;.generatedAddressOffset&nbsp;&nbsp;

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 = &quot;TRUE&quot;<br />ethernet0.networkName = &quot;&quot;<br />ethernet0.addressType = &quot;vpx&quot;<br />ethernet0.generatedAddress = &quot;00:50:56:a0:17:d7&quot;  

An example of a vmx configuration file after the change

ethernet0.present = &quot;TRUE&quot;<br />ethernet0.networkName = &quot;&quot;<br />ethernet0.addressType = &quot;static&quot;<br />ethernet0.address = &quot;00:50:56:9:BA:95&quot;&nbsp;

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

I hope I could be of help.

 

Share.

About Author

Marco Gralike, working for AMIS Services BV as a Principal Oracle Database Consultant in the Netherlands, has experience as a DBA since 1994 (Oracle 6). Marco is also eager and skillful in other fields, like Operating System Administration and Application Servers, mainly to find working, performing solutions. Marco has been specializing in Oracle XMLDB, since 2003, focusing on his old love, database administration and performance. He is an Oracle XMLDB enthusiast ever since. He is also a dedicated contributor of the Oracle User Group community, helping people with their steep XMLDB learning curve. To this purpose, Marco also devoted his personal blog site to XMLDB and other Oracle issues. Marco is a member of the OakTable network and an Oracle ACE Director (specialization Oracle XMLDB).

5 Comments

  1. Hi,
    In RedHat Linux, The MAC addr is stored in:
    /etc/sysconfig/network file.
    Good luck,
    Harry Le
    Rice University

  2. My two Linux RHEL 4 dont communicate with each other, although they communicate to host individually.
    I have changed ip address class but failed, I am working on desktop PC not conneced to lan.

    Please help and suggest a wayout.

  3. Anthony M Altemara on

    Check /etc/sysconfig/hwconf for any addresses. If not there, look in the /etc/ tree for that file. It’s there in RHEL4 but Fedora may have moved it. Find it with: #find /etc -name hwconf

  4. Marco Gralike on

    What happens when you do the following:

    [root@]# arp
    Address HWtype HWaddress Flags Mask Iface
    14-319-373.amis.local ether 00:07:E9:6A:3C:C3 C eth0
    amisfw01.amis.nl ether 00:50:54:FF:1C:F0 C eth0
    amisnt02.amis.local ether 00:06:5B:FC:88:6F C eth0
    amisnt02.amis.local ether 00:06:5B:FC:88:6F C eth0

    A few leeds I found (looks like the behaviour in Fedora 2 should be same):

    http://www.fedoraforum.org/forum/showthread.php?t=3341
    http://www.ces.clemson.edu/linux/fc2-2200BG.shtml

    I’m not a linux expert, but I can imagine that if you use static or DHCP environment settings, this file maybe is OR is not created or needed when using for instance static.

  5. Steve Morton on

    I’m running Red Hat Fedora Core 2. I need to clone hard drives to create more machines. This also clones the MAC address of the original machine. There’s no entry in /etc/sysconfig/network-scripts/ifcfg-eth0 for the MAC address. Where is the MAC address stored ?

    Thank you.