Networking does not work in a cloned Linux virtual machine
search cancel

Networking does not work in a cloned Linux virtual machine

book

Article ID: 337212

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

Symptoms:
  • The network configuration in the Linux Guest operating system still refers to the original MAC addresses.
  • Mismatch between the MAC addresses in the virtual machine settings and the Linux operating system.
  • Networking does not work in a cloned Linux virtual machine.


Cause

This issue occurs when a virtual machine is cloned, the network adapter(s) are given new MAC addresses.

Resolution

To change the MAC address of the Linux operating system:

Note: To perform these steps, you should be familiar with Linux commands.

Redhat

  1. Connect to vCenter Server using the vSphere Client
  2. Right-click the virtual machine and click Edit Settings.
  3. Click Network adapter and note the MAC Address.

    For example, you see a MAC Address similar to:

    xx:xx:xx:xx:xx:xx

  4. Power on the Linux virtual machine.
  5. Open a console and log in as root.
  6. Change directory to etc/sysconfig/network-scripts.
  7. Edit ifcfg-eth0 using a plain text editor and update the MAC address to reflect the MAC address in Step 3.

    For more information, see Editing files on an ESX host using vi or nano (1020302).

  8. Activate the ethernet card by running this command:

    ifup eth0.

    Notes:
    • ifup eth0 may be required in some instances to activate the ethernet card.
    • The /etc/udev/rules.d/70-persistent-net.rules may also need to be updated to the new MAC address.

SUSE

  1. Connect to vCenter Server using the vSphere Client.
  2. Select the virtual machine and click Edit Settings.
  3. Click Network adapter and note the MAC address. For example, you see a MAC Address similar to:

    xx:xx:xx:xx:xx:xx

  4. Power on the Linux virtual machine.
  5. Change directory to /etc/sysconfig/network.
  6. Run this command:

    ls -l if*

    /etc/sysconfig/network # ls -l if*

    # ifcfg-eth-id-xx:xx:xx:xx:xx:xy
  7. Rename this file to match the MAC address in Step 3:

    #mv ifcfg-eth-id-xx:xx:xx:xx:xx:xy:d7 ifcfg-eth-id-xx:xx:xx:xx:xx:xx

  8. Activate the ethernet card by running this command:

    ifup eth0

Note: If the /etc/sysconfig/network/ifcfg-eth-id-MAC file (where MAC is the hardware address of the interface) does not exist, perform these steps:

  1. Change directory to /etc/sysconfig/network.
  2. Run touch command to create the file.

    For example:

    touch ifcfg-eth-id-xx:xx:xx:xx:xx:xx

  3. Set full read/write/execute permission to the file.
  4. Copy the contents of the /etc/sysconfig/network/ifcfg-eth0 file to the /etc/sysconfig/network/ifcfg-eth- id-xx:xx:xx:xx:xx:xx file.
  5. Open the /etc/sysconfig/network/ifcfg-eth-id-xx:xx:xx:xx:xx:xx file using a text editor.
  6. Add PERSISTENT_NAME=eth0 line to the end of the file.
  7. Save and close the file.
  8. Run this command to activate the ethernet card:

    ifup eth0


Additional Information