Reconfigure Network After Cloning a VM in vSphere: Step‑by‑Step Guide
This tutorial walks you through the complete process of fixing network settings on a CentOS virtual machine cloned in vSphere, covering hostname changes, MAC address updates, network‑script edits, udev rule adjustments, and service restarts to restore connectivity.
Previously we shared how to clone a virtual machine using the vSphere Client; after cloning, the VM's network is non‑functional and requires reconfiguration, which differs from standard network setup. Below is the detailed tutorial.
Step 1: Power on the VM and open the console
Step 2: Change the hostname (optional)
If you wish to rename the cloned VM (originally centoswy01), change it to a new name such as centoswy02. See the linked tutorial for details.
Original name:
centoswy01New name:
centoswy02Step 3: Identify the current MAC address
Run ifconfig –a to list network interfaces and note the HWaddr (e.g., 00:0C:29:97:13:F7).
Step 4: Backup the network script
Execute cp /etc/sysconfig/network-scripts/ifcfg-eth0 ifcfg-eth1 to create a backup named ifcfg-eth1.
Step 5: Edit the ifcfg-eth0 file
Open the file with vi /etc/sysconfig/network-scripts/ifcfg-eth0. The original content is shown below.
Step 6: Modify key parameters
Change the HWADDR to match the MAC address obtained in Step 3, set ONBOOT=yes, change BOOTPROTO from dhcp to static, and add the IP address, netmask, gateway, and DNS entries.
Step 7: Resulting ifcfg-eth0 file
Step 8: Update udev persistent‑net rules
Edit vi /etc/udev/rules.d/70-persistent-net.rules, comment out the first eth0 entry and enable the eth1 entry, then save and quit.
Step 9: Restart the network service
Run service network restart. The command output is shown below; if the configuration does not take effect, use source to reload the file.
Step 10: Verify connectivity
After reboot, use ifconfig to check the IP address and ping www.baidu.com to confirm network access.
Step 11: Troubleshooting
If the network remains down, try the following:
Update HWADDR in ifcfg-eth0 to the MAC address shown by ifconfig -a (e.g., HWADDR="00:0C:29:97:13:f7").
Remove the persistent‑net rules file and reboot:
# rm -rf /etc/udev/rules.d/70-persistent-net.rules
# rebootIn summary, ensure that the cloned VM’s network interface and MAC address match the configuration in ifcfg-eth0 and the udev rules.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Python Crawling & Data Mining
Life's short, I code in Python. This channel shares Python web crawling, data mining, analysis, processing, visualization, automated testing, DevOps, big data, AI, cloud computing, machine learning tools, resources, news, technical articles, tutorial videos and learning materials. Join us!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
