The cloning of virtual machines greatly simplifies the need for more than one virtual machine, just a simple click on a clone to generate a virtual machine like the original virtual machine. Previously did not understand this, often is to manually copy a virtual machine files, Occupy space while also wasting time. Here is how to clone the virtual machine and the network card after cloning can not be used how to resolve.
1. Right-click on the virtual machine location you want to clone and manage it
2. Click Next here.
3, select the time of the clone source, I choose the current state, if you have more snapshots, select a suitable snapshot state.
4, here I choose to create a linked clone, the advantage is to save space, but the original virtual machine can be used.
5, custom name and location, this I want to use to do Web services, the name is called WEB01.
6, to this step, the clone of the virtual machine is complete.
7, open the virtual machine, and then login with the root, enter ifconfig after the discovery of Eth0 network card is not enabled, no network.
8, this time restart the network service, will prompt eth0 Nic is not ready, initialization failed. The reason is that when we cloned the virtual machine, the MAC address of the virtual machine source was copied over. The MAC address should be unique and cannot be duplicated, so this error occurs when we need to modify the MAC address of the eth0 configuration file. So how do we know which address to change to? Inside the/etc/udev/rules.d/70-persistent-net.rules file, a new MAC address is generated, and we open this file to see.
9, with vim open 70-persistent-net.rules file, you can see there are two network card configuration files, eth0 and eth1. Eth0 is the configuration of the source virtual machine, eth1 is the new configuration after cloning, where we need to remove the eth0 configuration, and then change the eth1 below to eth0.
Vim/etc/udev/rules.d/70-persistent-net.rules
9, the following changes, you need to remember the new MAC address, you will want to modify the eth0 configuration file.
10, use the command to extract the Mac just put it to the last line of the eth0 configuration file, easy to modify. If you are familiar with SED or vim, there will be a quicker way.
grep "ATTR"/etc/udev/rules.d/70-persistent-net.rules |cut-d ","-f4 >>/etc/sysconfig/network-scripts/ Ifcfg-eth0
11, change the MAC address, changed to the new "00:0c:29:bc:8b:b3", and then modify the IP address for an unused address, I changed here to 141.
12, after the modification as follows, save the exit.
13, restart the network services, found or failed, here need to restart the computer to take effect.
Shutdown-r now
14. After restarting, you can see that the NIC is working and the IP address is 192.168.239.141
15, with Xshell connection, see hostname is localhost, in order to better identify, the hostname changed to WEB01.
16, modify the host name of a lot of ways, here say a once and for all, is to modify the network configuration file, with Vim open/etc/sysconfig/network, and then modify the following
Vim/etc/sysconfig/network
17, save after exiting with source to make the configuration file take effect, and then exit reconnect, check the effect. You will notice that localhost is still displayed and you need to restart the virtual machine.
Shutdown-r now
18, restart after the discovery of the changes to take effect, modify the hostname This can be done with the modification of the network configuration file, so restart the line.
VMware clone virtual machines and network settings (CentOS)