To change the MAC address of the Linux operating system:
Note: To perform these steps, you should be familiar with Linux commands.
Redhat
- Connect to vCenter Server using the vSphere Client
- Right-click the virtual machine and click Edit Settings.
- Click Network adapter and note the MAC Address.
For example, you see a MAC Address similar to:
xx:xx:xx:xx:xx:xx
- Power on the Linux virtual machine.
- Open a console and log in as root.
- Change directory to etc/sysconfig/network-scripts.
- 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).
- 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
- Connect to vCenter Server using the vSphere Client.
- Select the virtual machine and click Edit Settings.
- Click Network adapter and note the MAC address. For example, you see a MAC Address similar to:
xx:xx:xx:xx:xx:xx
- Power on the Linux virtual machine.
- Change directory to /etc/sysconfig/network.
- Run this command:
ls -l if*
/etc/sysconfig/network # ls -l if*
# ifcfg-eth-id-xx:xx:xx:xx:xx:xy
- 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
- 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:
- Change directory to /etc/sysconfig/network.
- Run touch command to create the file.
For example:
touch ifcfg-eth-id-xx:xx:xx:xx:xx:xx
- Set full read/write/execute permission to the file.
- 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.
- Open the /etc/sysconfig/network/ifcfg-eth-id-xx:xx:xx:xx:xx:xx file using a text editor.
- Add PERSISTENT_NAME=eth0 line to the end of the file.
- Save and close the file.
- Run this command to activate the ethernet card:
ifup eth0
Note: Please refer Operating System vendor documentation for latest changes and updates related to Network Management files and applications.