How to Reconfigure Network Settings After Cloning a VM in vSphere
This guide walks you through the step‑by‑step process of fixing network configuration on a CentOS virtual machine after cloning it in vSphere, covering hostname changes, MAC address updates, interface file edits, persistent‑net rules, and service restart.
Reconfiguring Network After VM Cloning in vSphere
After cloning a virtual machine in vSphere, the network settings are usually invalid and must be reconfigured. The following procedure restores connectivity for a CentOS VM.
1. Power on the VM and open the console.
2. Change the hostname (optional). In this example the original name centoswy01 is changed to centoswy02. Refer to a separate guide for detailed hostname changes.
3. Identify the current MAC address. Run ifconfig -a and note the HWaddr (e.g., 00:0C:29:97:13:F7).
4. Backup the original interface file. Execute cp /etc/sysconfig/network-scripts/ifcfg-eth0 ifcfg-eth1 to create a copy named ifcfg-eth1.
5. Edit ifcfg-eth0 . Open the file with vi /etc/sysconfig/network-scripts/ifcfg-eth0. The original content is shown below:
6. Update the file. Replace the HWADDR value with the MAC address obtained in step 3, set ONBOOT=yes, change BOOTPROTO from dhcp to static, and add the appropriate IP address, netmask, gateway, and DNS entries.
7. Resulting ifcfg-eth0 file.
8. Adjust persistent‑net rules. Edit /etc/udev/rules.d/70-persistent-net.rules with vi, comment out the first eth0 entry and enable the eth1 entry, then save and quit.
9. Restart the network service. Run service network restart. If the changes do not take effect, execute source /etc/sysconfig/network-scripts/ifcfg-eth0 to reload the configuration.
10. Verify connectivity. After reboot, use ifconfig to check the IP address and ping an external site (e.g., www.baidu.com) to confirm network access.
11. Troubleshooting. If the network still fails, ensure the HWADDR in ifcfg-eth0 matches the MAC address from ifconfig -a, then remove the persistent‑net rules file with rm -rf /etc/udev/rules.d/70-persistent-net.rules and reboot the VM:
rm -rf /etc/udev/rules.d/70-persistent-net.rules rebootOnce the MAC address and interface file are consistent, the cloned VM will obtain network connectivity.
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.
